Comment #0 by default_357-line — 2021-03-14T11:59:40Z
Consider the following code:
enum Foo { A, B }
Foo a = Foo.A;
void main() {
with (Foo) { mixin("Foo a = Foo.A; a = Foo.B;"); }
assert(a == Foo.A);
with (Foo) mixin("Foo a = Foo.A; a = Foo.B;");
assert(a == Foo.A);
}
The assert fails, because the "a = Foo.B;" mixin statement inside the bracketless with (Foo) gets put "after" the with. In other words, the multi-statement mixin breaks out of its scope.
Comment #1 by robert.schadek — 2024-12-13T19:15:12Z