Scope locals
forax at univ-mlv.fr
forax at univ-mlv.fr
Fri May 7 15:24:36 UTC 2021
----- Mail original -----
> De: "Andrew Haley" <aph at redhat.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "loom-dev" <loom-dev at openjdk.java.net>
> Envoyé: Vendredi 7 Mai 2021 17:08:30
> Objet: Re: Scope locals
> On 5/7/21 4:04 PM, Andrew Haley wrote:
>> On 5/7/21 3:51 PM, Remi Forax wrote:
>>> I wonder if it is necessary to allow to register more than one scope local
>>> variable before entering the scope in the API given that using a primitive
>>> class (from Valhalla) to group the values should be slightly more efficient
>>> that using several scope locals.
>>
>> It definitely would be, but there may well be separate consumers
>> using separately-declared scope locals. It's tempting, though.
>
> Ah, there is another problem with this approach. Let's say you have an
> API that produces scope-local bindings. A record wouldn't help if
> you needed an opaque set of bindings, which is surely a use case for
> this.
Primitive classes and records are two separate concerns,
i've just used a primitive record (primitive class + record) in the example because it's less lines to write.
So for opaque bindings, users can use a primitive class.
>
> --
> Andrew Haley (he/him)
> Java Platform Lead Engineer
> Red Hat UK Ltd. <https://www.redhat.com>
> https://keybase.io/andrewhaley
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
Rémi
More information about the loom-dev
mailing list