Pattern matching on multiple objects
David Alayachew
davidalayachew at gmail.com
Sun Apr 23 18:40:33 UTC 2023
Hello Brian,
Thanks for the response!
> Yes, many languages that have pattern matching allow
> constant literals to be used as patterns ("constant
> patterns"), so
>
> case Point(0, _):
>
> would match any point on the X axis.
Nice, the unnamed pattern makes this even more expressive than I recalled.
Very haskell-esque.
> The example Swaranga gave used constant patterns in this
> way, but that is orthogonal to the question being posed,
> which was about switching over multiple values at once.
Fair. Next time, I will start a separate thread and just reference the
source thread.
> Constant patterns have been discussed in early pattern
> matching writeups; we have left them on the "maybe for
> later" list, for a few reasons (and I'm glad we did.)
If you recall the reasons, I'd love to hear them.
> They may come into the lineup at some point, but in the
> meantime, there are higher-leverage features ahead of it.
Same goes for this too. What's the amber team working on at the moment?
Thank you for your time!
David Alayachew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230423/2d68f0de/attachment.htm>
More information about the amber-dev
mailing list