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

           Summary: Some untidy attributes
           Product: D
           Version: 2.041
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid, rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-03-11 14:08:26 PST ---
This D2 program compiles and runs with no errors or warnings:


static foo1() {}
final foo2() {}
ref foo3() {}
enum void foo4() {}
nothrow foo5() {}
pure foo6() {}
static int x1 = 10;
static x2 = 10;
void main() {}


Notes:
- foo1, x1, x2: I don't know what a static global void function/variable is in
D2, so 'static' can be disallowed for global functions/variables.
- foo2, foo3, foo4: they look like bugs.
- Are most of those attributes supposed to not need the "void"? I think
requiring for example "pure void" is a little better than allowing just "pure".


The following lines don't compile, is this correct? 

int static x3 = 10;
int enum x4 = 1;
int const x5 = 2;


I like the strictness of the Java compiler, it makes sure your attributes are
all correct and meaningful, this helps avoid possible bugs. And I'm sure it
helps newbies learn the language in less time too (because when you don't know
the rules yet, it's very useful if they don't change).

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

Reply via email to