A peek at the roadmap for pattern matching and more
Guy Steele
guy.steele at oracle.com
Thu Aug 13 19:39:33 UTC 2020
> On Aug 13, 2020, at 9:06 AM, forax at univ-mlv.fr wrote:
>
> . . .
> ok, let's take a step back because i think the current proposal has fall in a kind of local maximum in term of design.
>
> We want a destructor, a destructor is a method that returns a list of values the same way a constructor takes a list of parameters.
> The way to represent that list of value is to use a record.
While I agree that this sort of approach can be made to work, I have to say it is philosophically puzzling to say that the way to destruct (or deconstruct) an object is to take values from the relevant fields and then package them up in some other object! Superficially, at least, it seems like this approach leads to an infinite regress.
Whereas I can more easily understand that the job of
public deconstructor Point(int x, int y) {
x = this.x;
y = this.y;
}
is to take values out of the object “this” and put them into separate _variables_, not a new object. (Granted, these variables have a somewhat new and mysterious existence and character.)
More information about the amber-spec-observers
mailing list