fix: add explicit constructor to Foo class and fix abs example syntax in docs

- Add explicit `construct new() {}` to Foo class in error-handling doc to clarify method dispatch behavior
- Fix `(-123).abs` syntax in num.markdown to use parentheses for unary minus precedence
This commit is contained in:
Bob Nystrom
2016-02-15 06:18:53 +00:00
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -49,7 +49,9 @@ not found" one. If you call a method on an object and its class (and all of its
superclasses) don't define that method, there's nothing Wren can do:
:::wren
class Foo {}
class Foo {
construct new() {}
}
var foo = Foo.new()
foo.someRandomMethod
+1 -1
View File
@@ -20,7 +20,7 @@ The value of π.
The absolute value of the number.
:::wren
System.print(-123.abs) //> 123
System.print( (-123).abs ) //> 123
### **acos**