DIP69 - Implement scope for escape proof references

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 4 07:42:25 PST 2014


> void foo(int[2]) {}
> void bar(int[]) {}
> void main() @nogc {
>     foo([1, 2]s);
>     bar([1, 2]s);
> }

Perhaps better:

void foo(int[2]) {}
void bar(scope int[]) {}
void main() @nogc {
     foo([1, 2]s);
     bar([1, 2]s);
}

Bye,
bearophile


More information about the Digitalmars-d mailing list