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:
@@ -1,16 +1,16 @@
|
||||
// Not structurally equal.
|
||||
IO.print(new Fn { 123 } == new Fn { 123 }) // expect: false
|
||||
IO.print(new Fn { 123 } != new Fn { 123 }) // expect: true
|
||||
IO.print(Fn.new { 123 } == Fn.new { 123 }) // expect: false
|
||||
IO.print(Fn.new { 123 } != Fn.new { 123 }) // expect: true
|
||||
|
||||
// Not equal to other types.
|
||||
IO.print(new Fn { 123 } == 1) // expect: false
|
||||
IO.print(new Fn { 123 } == false) // expect: false
|
||||
IO.print(new Fn { 123 } == "fn 123") // expect: false
|
||||
IO.print(new Fn { 123 } != 1) // expect: true
|
||||
IO.print(new Fn { 123 } != false) // expect: true
|
||||
IO.print(new Fn { 123 } != "fn 123") // expect: true
|
||||
IO.print(Fn.new { 123 } == 1) // expect: false
|
||||
IO.print(Fn.new { 123 } == false) // expect: false
|
||||
IO.print(Fn.new { 123 } == "fn 123") // expect: false
|
||||
IO.print(Fn.new { 123 } != 1) // expect: true
|
||||
IO.print(Fn.new { 123 } != false) // expect: true
|
||||
IO.print(Fn.new { 123 } != "fn 123") // expect: true
|
||||
|
||||
// Equal by identity.
|
||||
var f = new Fn { 123 }
|
||||
var f = Fn.new { 123 }
|
||||
IO.print(f == f) // expect: true
|
||||
IO.print(f != f) // expect: false
|
||||
|
||||
Reference in New Issue
Block a user