2013/12/20 Timon Gehr <timon.gehr@gmx.ch>
On 12/19/2013 02:58 PM, Kenji Hara wrote:
2013/12/19 Timon Gehr <timon.gehr@gmx.ch <mailto:timon.gehr@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); }

It's not necessary concept.

    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.

I think it is necessary small learning cost, to keep language semantics simple.

Kenji Hara