[Issue 21633] anonymous class local scope confusion
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sat Feb 13 02:25:32 UTC 2021
    
    
  
https://issues.dlang.org/show_bug.cgi?id=21633
--- Comment #1 from Adam D. Ruppe <destructionator at gmail.com> ---
Well, upon a review of Java and the D spec, there is a way, pass it as a
constructor arg:
    return new class (a) A { this(int a) { this.a = a; } };
What a weird syntax. In Java it is `new A(a) { }` which is a little less
strange. But whatever, this is a possible solution to use the var without
renaming it.
So I retract that part.
I still think the scope behavior, while legal, is problematic to the human eye
though, so leaving this enhancement request open.
--
    
    
More information about the Digitalmars-d-bugs
mailing list