UFCS for struct opCall?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Apr 9 09:36:09 PDT 2013


On 4/9/13 12:27 PM, deadalnix wrote:
> On Tuesday, 9 April 2013 at 16:22:08 UTC, Andrei Alexandrescu wrote:
>> How do you address construction of immutable objects?
>>
>
> In general, the first assignement of a field in a constructor must be
> handled as a declaration, not as an assignement. It solve
> const/immutable construction issues as well as avoiding unecessary
> copy/destruction as Ali pointed in a recent post.
>
> The magic only happens in the constructor, so it can still be considered
> as a regular function seen from the outside.

Right. This part I agree with. All I'm saying is that constructors are 
typechecked differently from other functions, so they must be 
distinguished somehow. Probably we're in violent agreement, or if not: 
are you suggesting a change?

Andrei


More information about the Digitalmars-d mailing list