On Friday, 10 October 2014 at 02:38:42 UTC, Walter Bright wrote:
const is used both as a storage class and as a type constructor, and is distinguished by the grammar:

   const(T) v; // type constructor, it affects the type T

const T v; // storage class, affects the symbol v and the type of v

In particular,

   const T *v;

does not mean:

   const(T)* v;

Once again, I am thoroughly confused as to why the space is put before the * in a language where the * is associated with the type, and not the identifier. If it had been written like

const T* v;

Then it would be obvious that it means

const(T*) v;

At which point I ask, why word it such that 'const' affects the symbol v, and not the type T*? And why does the former syntax even exist if it is more proper to use the latter?

Reply via email to