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:
@@ -15,7 +15,7 @@ IO.print(true || false ? 1 : 2) // expect: 1
|
||||
IO.print(!false ? 1 : 2) // expect: 1
|
||||
IO.print(~0 ? 1 : 2) // expect: 1
|
||||
IO.print(3 is Num ? 1 : 2) // expect: 1
|
||||
IO.print(new Foo ? 1 : 2) // expect: 1
|
||||
IO.print(Foo.new() ? 1 : 2) // expect: 1
|
||||
|
||||
var a = 0
|
||||
IO.print(a = 3 ? 1 : 2) // expect: 1
|
||||
@@ -32,7 +32,7 @@ IO.print(true ? 1 || false : 2) // expect: 1
|
||||
IO.print(true ? !true : 2) // expect: false
|
||||
IO.print(true ? ~0 : 2) // expect: 4294967295
|
||||
IO.print(true ? 3 is Bool : 2) // expect: false
|
||||
IO.print(true ? new Foo : 2) // expect: instance of Foo
|
||||
IO.print(true ? Foo.new() : 2) // expect: instance of Foo
|
||||
|
||||
IO.print(true ? a = 5 : 2) // expect: 5
|
||||
IO.print(a) // expect: 5
|
||||
@@ -48,7 +48,7 @@ IO.print(false ? 1 : 2 || false) // expect: 2
|
||||
IO.print(false ? 1 : !false) // expect: true
|
||||
IO.print(false ? 1 : ~0) // expect: 4294967295
|
||||
IO.print(false ? 1 : 3 is Num) // expect: true
|
||||
IO.print(false ? 1 : new Foo) // expect: instance of Foo
|
||||
IO.print(false ? 1 : Foo.new()) // expect: instance of Foo
|
||||
|
||||
// Associativity.
|
||||
IO.print(true ? 2 : true ? 4 : 5) // expect: 2
|
||||
|
||||
Reference in New Issue
Block a user