hg: amber/amber: hooking records to patterns
forax at univ-mlv.fr
forax at univ-mlv.fr
Fri Apr 6 18:59:54 UTC 2018
----- Mail original -----
> De: "Brian Goetz" <brian.goetz at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>, "Vicente Romero" <vicente.romero at oracle.com>
> Cc: "amber-dev" <amber-dev at openjdk.java.net>
> Envoyé: Vendredi 6 Avril 2018 20:52:46
> Objet: Re: hg: amber/amber: hooking records to patterns
> For one reason, because there might not _be_ a primary constructor.
> Suppose I have a pattern that takes a matrix and returns its
> eigenvalues. There isn't necessarily a "primary constructor" that takes
> the eigenvalues and returns a matrix. The descriptor describes the
> arity and types of the binding variables -- it's pure type information.
> Maybe there's an inverse method with a related descriptor, maybe there
> isn't.
You can extract the arity and the types from the array of components,
the arity is the number of components, the type is the return type of the method type of each component.
I agree that the primary constructor may not exist for all classes but for a record, there is one,
and having the array of components and the constructor allows to do a full round trip, object -> components -> object,
so you can build any serializations, the different kind of cloning (shallow or not) on top of that.
Rémi
>
>
> On 4/6/2018 2:29 PM, Remi Forax wrote:
>> I'm Ok with this design for the extractor, exporting the component method
>> handles,
>> it's not clear for me why the descriptor is not a method handle corresponding to
>> the primary constructor instead of a method type.
>>
>> For the implementation, i suppose it's temporary until it uses a ConstantDynamic
>> instead of an Indy.
>> Also Flag.RECORD should be named Flag.EXTRACTOR when applied on a method even if
>> it shares the same value.
>>
>> regards,
>> Rémi
>>
>> ----- Mail original -----
>>> De: "Vicente Romero" <vicente.romero at oracle.com>
>>> À: "amber-dev" <amber-dev at openjdk.java.net>
>>> Envoyé: Vendredi 6 Avril 2018 19:01:44
>>> Objet: hg: amber/amber: hooking records to patterns
>>> Changeset: 829d99f94b43
>>> Author: vromero
>>> Date: 2018-04-06 12:28 -0400
>>> URL: http://hg.openjdk.java.net/amber/amber/rev/829d99f94b43
>>>
>>> hooking records to patterns
>>>
>>> ! make/autoconf/spec.gmk.in
>>> ! src/java.base/share/classes/java/lang/compiler/Extractor.java
>>> ! src/java.base/share/classes/module-info.java
>>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java
>>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
>>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java
> >> ! src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java
More information about the amber-dev
mailing list