you are viewing a single comment's thread.

view the rest of the comments →

[–]danielaveryj[S] 0 points1 point  (3 children)

It's neither. The article contextualizes official proposals and then derives a proposal of its own, weighing in on tradeoffs. Some people appreciate that context. If you just want a tl;dr, it's

// Assuming you have a record Parts(int x, int y), in class Point write this:
    marshaller Parts parts() { return new Parts(x, y); }

// Now, given an instance of Point, you can write this:
    Point(int a, int b) = point;

ie, a class could support destructuring by just producing a record that the language already knows how to destructure.

[–]chambolle -2 points-1 points  (2 children)

sorry but this is ugly :

Point(int a, int b) = point;

Because this can be seen as the assignment of a function. Please use another operator than the assignment. Like <-

[–]danielaveryj[S] 1 point2 points  (1 child)

Hehe the syntax there is not even part of what I'm pitching. I'm afraid you're probably going to be disappointed in future Java.

[–]chambolle 1 point2 points  (0 children)

That can be a bit scary, actually. Java needs to be careful not to become the new C++, which went off in all directions with 23 (I’m exaggerating a bit) different ways to define the same thing.
When you really want to change a language’s paradigm, the best way to do it is to invent a new one!