Updated pattern match documents

Tagir Valeev amaembo at gmail.com
Sun Sep 9 05:37:32 UTC 2018

Hello! Great work, thanks!

Seems that the new document steps away from dedicated matching operator
like __matches which we saw before and reuses instanceof instead. Does this
mean that sole type name like String which is used in instanceof currently
is also a pattern? This could conflict with named constant. E. g.:

class Test {
  static final int String = 5;

  void test(Object obj) {
    if(obj instanceof String) {
      // obj == 5 or is a string?

With best regards,
Tagir Valeev.

сб, 8 сент. 2018 г., 1:41 Brian Goetz <brian.goetz at oracle.com>:

> I've updated the documents regarding pattern matching, and uploaded them
> here:
> http://cr.openjdk.java.net/~briangoetz/amber/pattern-match.html
> http://cr.openjdk.java.net/~briangoetz/amber/pattern-semantics.html
> The first document is an update of a previous document (old version
> available here:
> http://cr.openjdk.java.net/~briangoetz/amber/pattern-match_1.html), and
> outlines the general arc of the feature and general motivation.
> The second captures the discussions we've had regarding the messy
> details of typing, scoping, nullability, shadowing, etc.  I think we've
> made a lot of progress on these.
> We would not implement this all at once; we'd proceed incrementally,
> probably starting with type patterns in `instanceof`, and then
> proceeding to `switch` or to deconstruction patterns.
> Please review and comment.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20180909/b54a5371/attachment.html>

More information about the amber-spec-experts mailing list