How do you do "const nazi" in D?

Marc jckj33 at gmail.com
Wed Jan 3 17:27:38 UTC 2018


for a safe programming, since C/C++ times I try to make thing 
const as possible. locals, parameters etc anything which isn't 
going to change.
How do you do that in D? immutable everywhere?

for example:

>	foreach(Field field; fields) {
>		immutable string htmlOutputfile = genHTMLFilename();

do you use immutable here?

and on:

> Field fromFile(in string filename) {

do you use in here if filename isn't going to change?

I'm trying to make my own const nazi guide for D, if anyone would 
like to give your opinion on this, I would be glad.


More information about the Digitalmars-d-learn mailing list