scope for array parameters

bearophile bearophileHUGS at lycos.com
Tue Sep 4 16:50:12 PDT 2012


Jonathan M Davis:

> That's part of why I keep saying not to use in whenever it 
> comes up. scope is
> very broken, so in is very broken. And honestly, given how 
> often arrays are
> used in structs, I suspect that it's not at all uncommon for in 
> to be used incorrectly.

The situation with "in"/"scope" is worse than just deprecated 
stuff like "delete" or "typedef". I know those things are going 
away, so I don't use them, and this avoids the problem.


> I believe that the only case that
> has _any_ protection at all with scope right now is delegates, 
> which almost never should be const.

Do you mean code like this? What's bad about this? My delegate 
arguments
/function pointer arguments are usually const.

void foo(const int delegate(int) dg) {}
void main() {
     foo((int x) => x);
}

Bye,
bearophile


More information about the Digitalmars-d mailing list