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

Timon Gehr timon.gehr at gmx.ch
Wed Dec 18 12:16:14 PST 2013


On 12/18/2013 08:09 PM, Joseph Rushton Wakeling wrote:
> On 18/12/13 19:40, H. S. Teoh wrote:
>> For this reason, it is better to write 'const' on the right side of the
>> function name than on the left
>
> Yes, and it's exactly the practice I follow, although Ddoc replaces it
> on the left-hand side ... :-)
>
>> And also to always write `const(int)` rather than the potentially
>> ambiguous `const int`. It may feel unnecessarily verbose at first, until
>> you have to distinguish between:
>>
>>     const(int)[] func();
>>     const(int[]) func();
>>     int[] func() const;
>>     const(int)[] func() const;
>>     const(int[]) func() const;
>>
>> then you begin to appreciate the notation. :)
>
> Well, quite :-)  I'm not complaining about the issues here, I'm
> suggesting that inventing an extra keyword for the cases discussed in
> these DIPs is not necessary, because the analogy and connection with
> existing use of const/immutable is valuable.

There is no such analogy or connection.


More information about the Digitalmars-d mailing list