DIP49 - Define qualified postblit

Jonathan M Davis jmdavisProg at gmx.com
Sun Nov 17 00:40:48 PST 2013


On Tuesday, November 12, 2013 13:30:49 Kenji Hara wrote:
> 2013/11/11 Daniel Davidson <nospam at spam.com>
> 
> > From this thread (http://forum.dlang.org/post/mailman.89.1383248384.9546.
> > digitalmars-d-learn at puremagic.com) I was under the impression that
> > const/immutable and postblits don't mix. This DIP seems to be trying to
> > address that. One of the potential workarounds to this issue was the idea
> > of struct copy constructors. This is what I was referring to. With this
> > proposal, is there still a need for struct copy constructors?
> 
> 1.5 years ago, I did asked to Andrei about the postbit issue.
> 
> <http://forum.dlang.org/thread/CAFDvkcvvL8GxHQB=Rw9pTm-uxOKzNGVQNDv9w5Os3SkQ
> Cc=DLQ at mail.gmail.com>
> http://forum.dlang.org/thread/CAFDvkcvvL8GxHQB=Rw9pTm-uxOKzNGVQNDv9w5Os3SkQ
> Cc=DLQ at mail.gmail.com
> 
> 
> Andrei had thought that the issue will be fixed by adding "copy
> constructor" in D.
> However I believed that the postblit concept would be able to improved
> more. So I couldn't convince about his thought.
> 
> DIP49 is the final conclusion of my belief. I can say that copy constructor
> is unnecessary in D.

Yeah. You appear to have figued out how to make postblits work with const and 
immutable - though the rules seem to be a bit complicated - particularly for 
the "unique" postblit. All in all, I think that having copy constructors would 
be much simpler, so if we were starting from scratch, I think that I'd be in 
favor of copy constructors over postblit constructors. However, given that we 
already have postblit constructors, it would definitely be nicer if we could 
tweak them to make them work with const and immutable and avoid having to 
either replace postblits with copy constructors or having both.

In any case, great job!

- Jonathan M Davis


More information about the Digitalmars-d mailing list