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

--- Comment #0 from 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() {}

- 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:
------- You are receiving this mail because: -------

Reply via email to