On 2019-08-12 11:25, a11e99z wrote:

its weird that next compiles in some weird form

import std;
static class A {
     static a() { "a".writeln; } // forgot return type
}

Since you have specified an attribute on "a", the compiler can infer the return type. In this case it's inferred to "void" since there is no return statement.

It's not really the attribute that makes it possible for the compiler to infer the return type, it probably can in most of the cases. It just needs to be an attribute to satisfy the parser.

--
/Jacob Carlborg

Reply via email to