Make constructors just methods.
* Eliminate "new" reserved word. * Allow "this" before a method definition to define a constructor. * Only create a default constructor for classes that don't define one.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
class Foo {
|
||||
this real() {}
|
||||
}
|
||||
|
||||
// Classes do not get an argument-less "new()" if they define a constructor.
|
||||
var foo = Foo.new() // expect runtime error: Foo metaclass does not implement 'new()'.
|
||||
Reference in New Issue
Block a user