Bypassing the postblit?

Ritu ritu at metaprogramming.net
Mon Dec 30 03:34:07 PST 2013


> But then the source object may not be mutable. I am not a 
> compiler expert, but could a special case be made in D compiler 
> for the cases where the source struct instance is mutable and 
> is made available to ease such lazy initialization?


I am suggesting a DIP here.

Could the postblit take two arguments and make the source object 
available for possible mutation? We could have two variants of 
the postblit and the one with two arguments (source and 
destination *this* pointers) could be applied only to the cases 
where the source struct instance is mutable. And the normal 
postblit (in the form we have now) could apply to the cases where 
the source struct instance is immutable. As I said, I am not a 
compiler expert and I do not know if what I am saying makes sense.

Regards
- Ritu


More information about the Digitalmars-d mailing list