Best practices for logical const

Peter Alexander peter.alexander.au at gmail.com
Sat Feb 15 04:23:53 PST 2014


If you want logical const in D, you just don't use const. If you 
try to hack around it, it will just come back and bite you.

As a result, when writing APIs, don't enforce constness of your 
parameters if you require logical const. e.g. a range will not 
necessarily have const front and empty. Trying to enforce that 
will lead to trouble.


More information about the Digitalmars-d mailing list