Get static methods fully working.
They are compiled as local variables defined in an implicit scope surrounding the class. This has the right semantics and, better, means that there's no VM support needed for them. They're purely syntax sugar.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
class Foo {
|
||||
static write { IO.print(__field) } // Compile a use of the field...
|
||||
static init { __field = "value" } // ...before an assignment to it.
|
||||
}
|
||||
|
||||
// But invoke them in the right order.
|
||||
Foo.init
|
||||
Foo.write // expect: value
|
||||
Reference in New Issue
Block a user