On Wed, Dec 18, 2013 at 08:09:54PM +0100, 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 ... :-)
I know, and IMO this deserves a bug in bugzilla. The idea behind Ddoc is very good, but there are quite a few areas in the current implementation that leaves one disappointed, and this is one of them. (I know I'm opening a can of worms here, since a good number of people prefer writing function modifiers on the left, but I feel strongly enough about this to bring it up. :P) > >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. Yes. T -- Windows: the ultimate triumph of marketing over technology. -- Adrian von Bidder
