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:
@@ -1,4 +1,4 @@
|
||||
var fiber = new Fiber {}
|
||||
var fiber = Fiber.new {}
|
||||
|
||||
var map = {
|
||||
null: "null value",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var map = new Map
|
||||
var map = Map.new()
|
||||
|
||||
IO.print(map.count) // expect: 0
|
||||
IO.print(map) // expect: {}
|
||||
|
||||
@@ -12,7 +12,7 @@ class Foo {
|
||||
toString { "Foo.toString" }
|
||||
}
|
||||
|
||||
IO.print({1: new Foo}) // expect: {1: Foo.toString}
|
||||
IO.print({1: Foo.new()}) // expect: {1: Foo.toString}
|
||||
|
||||
// Since iteration order is unspecified, we don't know what order the results
|
||||
// will be.
|
||||
|
||||
Reference in New Issue
Block a user