feat: replace new keyword with this constructor syntax and ClassName.new() calls across core library and docs

Replace all uses of the `new` reserved word with explicit `this new()` constructor definitions and `ClassName.new()` instantiation calls in builtin/core.wren. Update all documentation files (classes.markdown, fiber.markdown, fn.markdown, sequence.markdown, error-handling.markdown, expressions.markdown, fibers.markdown, functions.markdown) to reflect the new constructor syntax, removing `new` keyword examples and replacing them with `ClassName.new()` patterns and `this new()` definitions.
This commit is contained in:
Bob Nystrom
2015-07-10 16:18:22 +00:00
parent 121d39cb42
commit e19ff59cce
221 changed files with 864 additions and 654 deletions
+1 -1
View File
@@ -18,6 +18,6 @@ class Foo {
toString { "Foo.toString" }
}
IO.print([1, new Foo, 2].join(", ")) // expect: 1, Foo.toString, 2
IO.print([1, Foo.new(), 2].join(", ")) // expect: 1, Foo.toString, 2
// TODO: Handle lists that contain themselves.
+1 -1
View File
@@ -1,4 +1,4 @@
var list = new List
var list = List.new()
IO.print(list.count) // expect: 0
IO.print(list) // expect: []
+2 -2
View File
@@ -1,7 +1,7 @@
var a = [1, 4, 2, 1, 5]
var b = ["W", "o", "r", "l", "d"]
var max = new Fn {|a, b| a > b ? a : b }
var sum = new Fn {|a, b| a + b }
var max = Fn.new {|a, b| a > b ? a : b }
var sum = Fn.new {|a, b| a + b }
IO.print(a.reduce(max)) // expect: 5
IO.print(a.reduce(10, max)) // expect: 10
+1 -1
View File
@@ -12,6 +12,6 @@ class Foo {
toString { "Foo.toString" }
}
IO.print([1, new Foo, 2]) // expect: [1, Foo.toString, 2]
IO.print([1, Foo.new(), 2]) // expect: [1, Foo.toString, 2]
// TODO: Handle lists that contain themselves.