[Issue 6917] New: with() at global scope too

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 8 19:25:19 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6917

           Summary: with() at global scope too
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-11-08 19:24:43 PST ---
A correct D2 program that defines a global immutable array of enum members:


enum MyEnum { first, second }
immutable MyEnum[] array = [MyEnum.first,MyEnum.second,MyEnum.second,
                            MyEnum.first,MyEnum.second,MyEnum.second];
void main() {}


To reduce the noise I'd like to use with() at global scope too (there is no
need to call is "static with"):


enum MyEnum { first, second }
with (MyEnum) {
    immutable MyEnum[] array = [first,second,second,first,second,second];
}
void main() {}


with is useful for global structs too.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list