records are dead long live to ...

forax at univ-mlv.fr forax at univ-mlv.fr
Fri Apr 12 18:40:39 UTC 2019


> De: "Kevin Bourrillion" <kevinb at google.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "amber-spec-experts" <amber-spec-experts at openjdk.java.net>
> Envoyé: Vendredi 12 Avril 2019 20:17:12
> Objet: Re: records are dead long live to ...

> On Fri, Apr 12, 2019 at 12:34 AM Remi Forax < [ mailto:forax at univ-mlv.fr |
> forax at univ-mlv.fr ] > wrote:

>> At the end of section "Why not "just" do tuples ?", you have this gem,
>> "A good starting point for thinking about records is that they are nominal
>> tuples."

> That is *a* starting point, but I think a barely useful one. Records have
> semantics, which makes them *worlds* different from tuples. Methods,
> supertypes, validation, specification... I think it's fair to say that all a
> record holds is a "tuple", but it's so much more. Record is to tuple as enum is
> to int.

Hi Kevin, 
I find interesting the example you have chosen, because you can interpret it as enum in C vs enum in Java, enum in C have no method, no supertype, etc but we still have kept the name "enum" for the equivalent in Java. 
In my opinion, the feature we have is more similar to a named tuple than a record, i fully agree that it's a named tuple on steroid, but as i said it's not dissimilar to the relation between an enum in C and an enum in Java. 

Rémi 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20190412/61d60015/attachment.html>


More information about the amber-spec-experts mailing list