You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.<fragments>
Select Case node
Case Match <address type=<%= addressType %>>
<first-name><%= firstName %></first-name>
<last-name><%= lastName %></last-name>
</address>
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.
The text was updated successfully, but these errors were encountered:
I realize that many legacy applications still use XML, but do we really want to keep adding support for XML when there are far better ways for serializing and transferring data?
It's not like you can't achieve the same thing with some simple System.Xml.Linq stuff:
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:
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.
The text was updated successfully, but these errors were encountered: