defaultvalue and enclosing instances
    Remi Forax 
    forax at univ-mlv.fr
       
    Fri Sep 14 17:05:03 UTC 2018
    
    
  
----- Mail original -----
> De: "Victor Nazarov" <asviraspossible at gmail.com>
> À: "John Rose" <john.r.rose at oracle.com>
> Cc: "valhalla-dev" <valhalla-dev at openjdk.java.net>
> Envoyé: Vendredi 14 Septembre 2018 18:17:08
> Objet: Re: defaultvalue and enclosing instances
> пт, 14 сент. 2018 г., 19:06 John Rose <john.r.rose at oracle.com>:
> 
>> On Sep 14, 2018, at 1:32 AM, Srikanth <srikanth.adayapalam at oracle.com>
>> wrote:
>> >
>> > ... (d) other solutions ...
>>
>> The simplest one comes to mind:  Allow T.default to have a default
>> up-reference
>> of null, as a special case for inner values.  Referring to the outer
>> instance from
>> a default inner instance will thus fail with NPE.  "It hurts when I do
>> this, Doctor"
>> "Then don't do that."
>>
> 
> But this means that you can't use enclosed value type instances. The whole
> point of enclosed instances is guarateed presence of enclosing instance.
you can still initialize the value with __WithField
> Then why not to forbid enclosed value type instances altogeather in
> compiler and class-file verifier?
> 
> --
> Victor Nazarov
> 
Rémi
    
    
More information about the valhalla-dev
mailing list