DIP53 and DIP49 (ver2) - New definitions for qualified constructors and postblits
Kenji Hara
k.hara.pg at gmail.com
Wed Dec 18 17:37:53 PST 2013
2013/12/19 Timon Gehr <timon.gehr at gmx.ch>
> The natural interpretation of a const constructor is that it constructs a
> const object directly. Such a constructor could eg. initialize a field
> declared with a mutable type using some external const reference.
>
> void foo(const(int[]) a){
> // ...
> struct S{
> int[] a;
> this()const{
> this.a=a;
> }
> }
> // ...
> }
>
> The DIP argues that such a construct is not particularly useful
Yes, that's one of the start point of my thoughts.
> and hence eliminates it for the purpose of using the syntax for a
> _different_ concept. There is no way to implement the above constructor
> using the new semantics.
>
No, that's not merely syntactic choice. The 'const' constructor/postblit is
a natural conclusion derived from the semantic meaning.
I tweaked descriptions in DIP to express it more clearly.
Kenji Hara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20131219/a2f249d7/attachment.html>
More information about the Digitalmars-d
mailing list