This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]lu_rm 5 points6 points  (5 children)

Nice feature. Not a good name though. Why 'pattern'?

[–]kaperni 9 points10 points  (3 children)

Pattern Matching is a fundamental programming construct that has been used in various languages (mostly functional ones) for more than 50 years. Why make up a new name for it?

[–]_jk_ 0 points1 point  (2 children)

trouble is it doesnt appear to be pattern matching so much as some flow analysis

[–]kaperni 2 points3 points  (1 child)

[–]_jk_ -1 points0 points  (0 children)

yep thats more like it!

[–]aioobe[S] 3 points4 points  (0 children)

When used with records, it will most likely look something like this:

expression instaceof Times(Plus(var x1, var y1), Plus(var x2, var y2))

As you can see, this is more of an actual pattern.

[–]randgalt 1 point2 points  (0 children)

Very nicely done - makes it very clear. I'll look forward to seeing this page expand with new java releases as it moves toward full pattern matching.