`const ref T` or `ref const T`?

Dom DiSc dominikus at scherkl.de
Thu Aug 15 10:37:52 UTC 2024


On Thursday, 15 August 2024 at 09:05:02 UTC, IchorDev wrote:
> Yeah, I feel you. When I first started writing in D I’d also 
> use `const ref` [...] I found the ordering to violate English 
> adjective ordering. `ref const T` sounds wrong in the same way 
> as ‘red big balloon’.

Yeah. As long as the language allows both, I would always go with 
the version that sounds more like proper english.
But if we do a restriction at all, I would require to always put 
const at the end (e.g. 'ref T const') to keep it consistent for 
functions and values.



More information about the Digitalmars-d mailing list