[External] : Re: Declared patterns -- translation and reflection
Brian Goetz
brian.goetz at oracle.com
Wed Mar 30 00:42:38 UTC 2022
>
> 1/ conceptually there is a mismatch, the syntax introduce names for
> the bindings, but they have no names at that point, bindings only have
> names AFTER the pattern matching succeed.
I think you have missed the point here. The names serve the
implementation of the pattern, not the interface -- just as parameter
names to methods do. As you see in the example, these are effectively
blank final locals in the body of the pattern, which must be assigned
to. (I'd have pointed this out if this were actually a message on
declaring deconstructors, but since the message is on translation and
reflection I didn't want to digress.)
> 2/ sending the value of the binding by name is alien to Java. In Java,
> sending values is by the position of the value.
It's not by name. I don't know where you got this idea.
> 3/ the conceptual mismatch also exists at runtime, you need to permute
> the value of bindings before creating the carrier because a carrier
> takes the value of the binding by position while the code will takes
> the value of the bindings by name (you need the equivalent of
> MethodHandles.permuteArguments() otherwise you will see the
> re-organisation of the code if they are side effects).
It's not by name. I don't know where you got this idea.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20220329/cf5f754c/attachment-0001.htm>
More information about the amber-spec-experts
mailing list