Updated pattern match documents
john.r.rose at oracle.com
Tue Oct 2 05:43:32 UTC 2018
On Oct 1, 2018, at 9:48 PM, Tagir Valeev <amaembo at gmail.com> wrote:
> I tried to think how to break this. Some interesting cases could arise
> if nullable type patterns are allowed for instanceof (which could be
> useful sometimes):
Yes, the trailing structure of the pattern gets tangled up with the
right-context of a typical expression.
One way to fix that is to make "x instanceof P" have a much lower
precedence than "x instanceof C", where C is a name and P is a
pattern which is not a name.
We don't have a precedent grammar, but we can demand that the
right-context of "x instanceof P" is comma, close paren, or the like.
The practical effect of this will be to force people to put parentheses
around "x instanceof P" when there is ambiguity.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the amber-spec-experts