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

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Wed Dec 18 11:09:54 PST 2013


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.


More information about the Digitalmars-d mailing list