Member Patterns -- the bikeshed
Brian Goetz
brian.goetz at oracle.com
Mon Apr 1 17:06:32 UTC 2024
> I see, thanks. What I was missing is that I thought a "pattern" method
> cannot exist without its pair. And that explains why wasn't the short
> "inverse" syntax chosen: Because the fact that the "pattern" method
> has the same name / types is just a coincidence from the point of view
> of the compiler (hopefully I'm not misunderstanding something again).
Yes. Pairs of ctor/dtor (and similar for methods) are an extremely
useful *API structuring mechanism*, but they are not required by the
language.
The language will likely provide some help in pairing them up, for use
in contexts like withers and serialization, but that's it. Maybe this
help will be implicit (same name + same arity + same parameter/binding
types + same parameter/binding names means they are paired), maybe it
will be explicit (some sort of "invertible" modifier); we are working
through use cases now to figure this out. But we want pairing /
invertibility to be something that developers choose.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-spec-observers/attachments/20240401/e57534d8/attachment.htm>
More information about the amber-spec-observers
mailing list