instance initializer

Vicente Romero vicente.romero at
Fri Sep 6 03:07:44 UTC 2019

On 9/5/19 9:50 PM, John Rose wrote:
> On Sep 5, 2019, at 5:54 PM, Brian Goetz <brian.goetz at 
> <mailto:brian.goetz at>> wrote:
>> In that case, what we would see is that on exit, neither i nor j were 
>> either DA or DU, and we would issue a compiler error.  For each 
>> field, there are three possibilities:
>>  - The field is DU on all paths out of the ctor; we initialize it 
>> from the corresponding parameter.
>>  - The field is DA on all paths out of the ctor; we do nothing.
>>  - The field is neither DU nor DA on some path out of the ctor; error.
>> We could extend this analysis to the init block, where if its either 
>> of the first two cases, we feed that information back into the ctor 
>> analysis, and always error in the third case -- the real question is 
>> whether its worth the bother.
> OK, I’m missing something subtle here.  Is the assignment “j = j” 
> sugar for “this.j = j”, where the latter j is the component parameter?

no it is not "j = j" have the same meaning in a record constructor and 
in a class constructor, it is assigning to the argument not to the field

More information about the amber-spec-observers mailing list