The next iteration of scope
via Digitalmars-d
digitalmars-d at puremagic.com
Wed Apr 1 10:00:43 PDT 2015
On Tuesday, 31 March 2015 at 20:07:19 UTC, Walter Bright wrote:
> Consider the code:
>
> struct Foo { C obj; }
> @safe void bar(C c, Foo* f) { f.obj = c; }
>
> Under the proposal, for @safe code, this would have to be
> written as:
>
> @safe void bar(static C c, Foo* f) ...
>
Either that, or:
@safe void bar(C c return!f, Foo* f) ...
or:
@safe void bar()(C c, Foo* f) ...
> I'm concerned this may break an astonishing amount of code.
We could go a step further and infer scope for all @safe
functions, except those with at least one explicit annotation.
This would be almost backward compatible, except for the fact
that some arguments then suddenly become scope and therefore the
mangling changes.
More information about the Digitalmars-d
mailing list