implementation of record constructor auto-initialization [was Re: instance initializer]

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Sep 6 14:53:17 UTC 2019


On 06/09/2019 15:45, Brian Goetz wrote:
>>
>> Actually - not sure - what do you mean by "exit path"? We clearly 
>> can't have "returns" here. And, if we "throw" then we don't care much 
>> about initializing.
>>
>>
>
> Returns are exactly what I was concerned about; currently return is 
> allowed, though weird, in ctors.
>
> If you want to say “no return in compact ctor”, that’s a reasonable 
> simplification (though we’ll battle this beast again later when we 
> want to expand some of the compact-ctor goodies to more general class 
> constructors.)
>
I think I'd slightly prefer it to restrict it that way - not out of 
compiler complexity (as I said, a try/catch should be enough to handle 
it) - but out of managing user expectations.

Maurizio



More information about the amber-dev mailing list