On Mon, 24 Jun 2024, Larry Garfield wrote:
> On Thu, Jun 20, 2024, at 5:38 PM, Larry Garfield wrote:
>
> * The placement of is
on match()
is still an open question.
"The latter is more explicit, and would allow individual arms to be
pattern matched or not depending on the presence of is."
Which would make it probably more useful, so I would be in favour of
having each arm have the "is".
> * No one has really weighed in on nested patterns for captured
> variables. Any thoughts there?
In your example, you have:
if ($foo is Foo{a: @($someA), $b is Point(x: 5, y: @($someY)) }) {
And my brain can't parse that. I would have *no* idea what that means at
first sight.
In addition to just normal captured, variables:
"For object patterns (only), if the variable name to extract to is the
same as the name of the property, then the property name may be
omitted."
This is one I don't like. It adds another syntax, and IMO also makes
something less obvious what is happening. Too much magic™.
So please:
if ($p is Point {z: $z, x: 3, y: $y} ) {
And not:
if ($p is Point {$z, x: 3, $y} ) {
cheers,
Derick