DIP53 and DIP49 (ver2) - New definitions for qualified constructors and postblits

Timon Gehr timon.gehr at gmx.ch
Thu Dec 19 07:16:18 PST 2013


On 12/19/2013 02:58 PM, Kenji Hara wrote:
> 2013/12/19 Timon Gehr <timon.gehr at gmx.ch <mailto:timon.gehr at gmx.ch>>
>
>     Well, a constructor can be thought of as yielding a result. A const
>     method returning 'this' cannot return an 'immutable' object.
>
>
> Constructor has no return value in semantic level.
>

Conceptually speaking, a struct constructor declaration immediately 
gives you a callable with the corresponding return type.

struct S{ this(int x)immutable{ } }
immutable(S) construct(int x){ return S(x); }


>     I do understand your rationale. What I am saying is that the DIP
>     adds a wildcard meaning to 'const' that was not previously there,
>     and I consider this to be more of a weakness than a strength.
>
>
> What is the weakness? As far as I can see, there is no *logical* failure.
>
> Indeed I can agree that the described concept in the DIP may be hard to
> understand, but it would be enough easy compared with the currently
> implemented thing.
>
> Kenji Hara

I think it is easy to understand. I just think that the 'const' 
qualifier is not descriptive.


More information about the Digitalmars-d mailing list