Deprecating this(this)

Nicholas Wilson iamthewilsonator at hotmail.com
Sun Apr 1 15:01:02 UTC 2018


On Sunday, 1 April 2018 at 14:34:01 UTC, ag0aep6g wrote:
> On Sunday, 1 April 2018 at 13:37:43 UTC, Jonathan M Davis wrote:
>> One issue is that postblit constructors fundamentally don't 
>> work with const. The problem is that a postblit constructor 
>> works by copying the object and _then_ mutating it, and you 
>> can't mutate a const object.
>
> I'm not so sure if that's fundamental. Can't we just say that 
> the copy is head-mutable at the time when the postblit function 
> is called, and it only becomes fully const after that?
>
> The destination can't be const/immutable already, or you 
> wouldn't be able to write there anyway.

Ah, you said it much better than I did.


More information about the Digitalmars-d mailing list