Retoor software development Projects Research SearchXNG
Register Sign In

17 lines
340 B
Plaintext
Raw Normal View History

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.
2015-07-10 18:18:22 +02:00
// TODO: Change this.
class Foo {
this named() { _field = "named" }
this other() { _field = "other" }
toString { _field }
}
IO.print(Foo.named()) // expect: named
IO.print(Foo.other()) // expect: other
// Returns the new instance.
var foo = Foo.named()
IO.print(foo is Foo) // expect: true
IO.print(foo.toString) // expect: named
Reference in New Issue Copy Permalink
e19ff59cce
wren/test/language/constructor/named.wren
Response time: 30ms
Mail Licenses API