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

Kenji Hara k.hara.pg at gmail.com
Thu Dec 19 07:32:21 PST 2013


2013/12/20 Timon Gehr <timon.gehr at gmx.ch>

> 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); }
>

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20131220/ac40f569/attachment.html>


More information about the Digitalmars-d mailing list