2013/12/19 Timon Gehr <[email protected]> > 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
