ixid:

I note you always seem to use "in" in your functions and on reddit seemed to imply that this was the idiomatic way of using D yet I recall Jonathan M Davies posting that using "in" was a bad idea.

I think "in" is supposed to be(come) idiomatic, because it's short, and it's supposed to combine two attributes that you usually want, const and scope.

On the other hand scope for arguments is not implemented yet (and Walter doesn't show lot of interest in implementing it, I don't know why. Few days ago Hara has said he wants to try to implement scope. But it's a lot of work, so I don't know if and when he will be done). So if you annotate something with scope, and you let the reference escape, the code now compiles, but later will break.

Breaking the D code on Rosettacode is acceptable, because that site is like a wide variety of tiny test programs. So using "in" in Rosettacode is good. But if you are writing a largish D2 project, then Jonathan is right, it's better to not use "in" and scope arguments, unless you want to fix ton of future errors.

Bye,
bearophile

Reply via email to