On 4/1/18 10:34 AM, 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.
Yes, precisely what I had been arguing here:
https://issues.dlang.org/show_bug.cgi?id=18417#c5, however
const/immutable postblit was recently deprecated by:
https://github.com/dlang/dmd/pull/8032
So I don't think D is going to allow const postblit any more. Maybe not
even postblit any more.
-Steve