Not yet again !

forax at univ-mlv.fr forax at univ-mlv.fr
Sun Oct 22 00:50:30 UTC 2023


----- Original Message -----
> From: "Brian Goetz" <brian.goetz at oracle.com>
> To: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "valhalla-spec-experts" <valhalla-spec-experts at openjdk.java.net>
> Sent: Sunday, October 22, 2023 1:33:01 AM
> Subject: Re: Not yet again !

>> You may find easier to answer to a direct question:
> 
> Since you're the one complaining, the burden is really on you to explain
> why it is _not_ a good idea.  But I have an answer anyway:
> 
>> Why do you want the tearability of a nullable value type, which is an
>> implementation detail, to be part of the type system ?
>>
> 
> Because it is not an implementation detail.  It is a semantic property
> of the class that describes how instances may react under race.
> Whether or not a marker interface is the best way to do this or not,
> this is 100% fair game for representing in the type system.
> 
> Got any other arguments?

No, same argument, the interface by being part of the type system should make the property "being tearable" transitive but this is not the case.

The marker interface make the instance typed by the interface not-tearable but the instance of a class that implements the interface tearable. 

A class that contains a field typed by the interface is not tearable.
An array of the interface has its element not tearable.
A field/array element typed by an interface Foo that extends that interface is not tearable, too.

So a field/array element typed by the interface and all its sub-interfaces/sub-abstract-classes are not tearable but all the sub-concrete-value-classes are tearable.

For me, this is an abuse of the notion of interface/subtyping and I really hope I will not have to explain that to my students ...

regards,
Rémi


More information about the valhalla-spec-observers mailing list