dotnet / dotnet/vblang

XML patterns

Open
#139 1 comment 0 reactions 0 assignees View on GitHub
Proposal
Dominant language
No language data
Stars
328
Forks
71
PR merge metrics
No merged PRs in 30d

Description

This builds on proposal #124 "Pattern Matching".

In addition to the new patterns proposed in #124 and #101 I think it would make sense to consider revisiting existing literal/object creation expressions in the language and seeing if we can come up with valuable patterns for them, for example XML. Scala actually has both XML literals and XML pattern matching.

Following the principles for pattern matching established in #124 that pattern syntax should mirror construction syntax so it would look like this:

```
For Each node in doc.
Select Case node
Case Match

>
<%= firstName %>
<%= lastName %>

When addressType <> "work"

Console.WriteLine($"Contact found! {lastName}, {firstName}")

Case Else
...
End Select
End Select
```

It's a bit clunkier than I'd like (as much as XML literals are) but it could be powerful for XML document parsing/processing and would make sure this feature keeps up with other advancements to the language. Also, it's better than XSLT, which is the bare minimum anyone can really ask of life.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.