diff --git a/doc/implicit fields.txt b/doc/implicit fields.txt index bf394eb6..b052ddec 100644 --- a/doc/implicit fields.txt +++ b/doc/implicit fields.txt @@ -15,7 +15,7 @@ consider a module effectively a class. Consider: } class Inner { - io.write(_blah) // Does this declare field in Inner, or access Outer? + IO.write(_blah) // Does this declare field in Inner, or access Outer? } } diff --git a/doc/receiver-less calls 2.txt b/doc/receiver-less calls 2.txt index 4a5bbe7e..fdd3db12 100644 --- a/doc/receiver-less calls 2.txt +++ b/doc/receiver-less calls 2.txt @@ -30,7 +30,7 @@ getters for them that return fields. That's weird if you take into account setters, though. Consider: class Foo { - a { io.write(_prop) } + a { IO.write(_prop) } _prop = value { ... } } diff --git a/doc/receiver-less calls.txt b/doc/receiver-less calls.txt index 7fbb4a31..46dfe562 100644 --- a/doc/receiver-less calls.txt +++ b/doc/receiver-less calls.txt @@ -26,7 +26,7 @@ a top-level function in another module would be something like: This leaves the question of how *do* you call top level functions in your own module? I.e., how do we call foo here: - def foo(arg) { io.write("called foo!") } + def foo(arg) { IO.write("called foo!") } class SomeClass { bar { @@ -37,7 +37,7 @@ module? I.e., how do we call foo here: This is analogous to: class SomeModule { - static foo(arg) { io.write("called foo!") } + static foo(arg) { IO.write("called foo!") } class SomeClass { bar { diff --git a/doc/site/branching.markdown b/doc/site/branching.markdown index 0561d1f8..9b34e476 100644 --- a/doc/site/branching.markdown +++ b/doc/site/branching.markdown @@ -19,27 +19,27 @@ This means `0`, empty strings, and empty collections are all considered "true" v The simplest branching statement, `if` lets you conditionally skip a chunk of code. It looks like this: :::wren - if (ready) io.write("go!") + if (ready) IO.write("go!") That evaluates the parenthesized expression after `if`. If it's true, then the statement after the condition is evaluated. Otherwise it is skipped. Instead of a statement, you can have a block: :::wren if (ready) { - io.write("getSet") - io.write("go!") + IO.write("getSet") + IO.write("go!") } You may also provide an `else` branch. It will be executed if the condition is false: :::wren - if (ready) io.write("go!") else io.write("not ready!") + if (ready) IO.write("go!") else IO.write("not ready!") And, of course, it can take a block too: if (ready) { - io.write("go!") + IO.write("go!") } else { - io.write("not ready!") + IO.write("not ready!") } ## The logical operators `&&` and `||` @@ -49,13 +49,13 @@ The `&&` and `||` operators are lumped here under branching because they conditi An `&&` ("logical and") expression evaluates the left-hand argument. If it's falsey, it returns that value. Otherwise it evaluates and returns the right-hand argument. :::wren - io.write(false && 1) // false - io.write(1 && 2) // 2 + IO.write(false && 1) // false + IO.write(1 && 2) // 2 An `||` ("logical or") expression is reversed. If the left-hand argument is truthy, it's returned, otherwise the right-hand argument is evaluated and returned: :::wren - io.write(false || 1) // 1 - io.write(1 || 2) // 1 + IO.write(false || 1) // 1 + IO.write(1 || 2) // 1 **TODO: Conditional operator.** diff --git a/doc/site/method-calls.markdown b/doc/site/method-calls.markdown index bf361614..6664d1cf 100644 --- a/doc/site/method-calls.markdown +++ b/doc/site/method-calls.markdown @@ -4,7 +4,7 @@ Wren is object-oriented, so most code consists of method calls. Most of them look like so: :::wren - io.write("hello") + IO.write("hello") items.add("another") items.insert(1, "value") diff --git a/doc/site/syntax.markdown b/doc/site/syntax.markdown index fc497154..0c8d0e1f 100644 --- a/doc/site/syntax.markdown +++ b/doc/site/syntax.markdown @@ -38,8 +38,8 @@ never write `;` unless you want to cram a bunch of statements on one line. :::dart // Two statements: - io.write("hi") - io.write("bye") + IO.write("hi") + IO.write("bye") Sometimes, though, a statement doesn't fit on a single line and treating the newline as a semicolon would trip things up. To handle that, Wren has a very diff --git a/doc/site/variables.markdown b/doc/site/variables.markdown index d3bfb6fb..bc1f6610 100644 --- a/doc/site/variables.markdown +++ b/doc/site/variables.markdown @@ -12,7 +12,7 @@ defined, it can be accessed by name as you would expect. :::dart var animal = "Slow Loris" - io.write(animal) // Prints "Slow Loris". + IO.write(animal) // Prints "Slow Loris". ## Scope @@ -21,11 +21,11 @@ defined until the end of the block where that definition appears. :::dart { - io.write(a) // ERROR! a doesn't exist yet. + IO.write(a) // ERROR! a doesn't exist yet. var a = 123 - io.write(a) // "123" + IO.write(a) // "123" } - io.write(a) // ERROR! a doesn't exist anymore. + IO.write(a) // ERROR! a doesn't exist anymore. Variables defined at the top level of a script are *global*. All other variables are *local*. Declaring a variable in an inner scope with the same name as an @@ -36,9 +36,9 @@ something you likely intend to do much). var a = "outer" { var a = "inner" - io.write(a) // Prints "inner". + IO.write(a) // Prints "inner". } - io.write(a) // Prints "outer". + IO.write(a) // Prints "outer". Declaring a variable with the same name in the *same* scope *is* an error. @@ -63,6 +63,6 @@ assigned value. :::dart var a = "before" - io.write(a = "after") // Prints "after". + IO.write(a = "after") // Prints "after". **TODO: Forward references for globals, closures.**