feat: replace IO class with System class and remove separate IO module

- Delete wren_io.c, wren_io.h, and io.wren source files
- Remove multi-arity print overloads and IO.read/IO.time methods
- Add System class with print, printAll, write, writeAll methods to core.wren
- Update all documentation examples and README to use System.print instead of IO.print
This commit is contained in:
Bob Nystrom
2015-09-15 14:46:09 +00:00
parent f12581a674
commit aa72900a9e
491 changed files with 3285 additions and 3544 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
// Newline after '?'.
IO.print(true ?
System.print(true ?
"yes" : "no") // expect: yes
// Newline after ':'.
IO.print(false ? "yes" :
System.print(false ? "yes" :
"no") // expect: no
+40 -40
View File
@@ -5,52 +5,52 @@ class Foo {
}
// Condition precedence.
IO.print(true ? 1 : 2) // expect: 1
IO.print((true) ? 1 : 2) // expect: 1
IO.print([true][0] ? 1 : 2) // expect: 1
IO.print(Foo.bar ? 1 : 2) // expect: 1
IO.print(3..4 ? 1 : 2) // expect: 1
IO.print(3 * 4 ? 1 : 2) // expect: 1
IO.print(3 + 4 ? 1 : 2) // expect: 1
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(Foo.new() ? 1 : 2) // expect: 1
System.print(true ? 1 : 2) // expect: 1
System.print((true) ? 1 : 2) // expect: 1
System.print([true][0] ? 1 : 2) // expect: 1
System.print(Foo.bar ? 1 : 2) // expect: 1
System.print(3..4 ? 1 : 2) // expect: 1
System.print(3 * 4 ? 1 : 2) // expect: 1
System.print(3 + 4 ? 1 : 2) // expect: 1
System.print(true || false ? 1 : 2) // expect: 1
System.print(!false ? 1 : 2) // expect: 1
System.print(~0 ? 1 : 2) // expect: 1
System.print(3 is Num ? 1 : 2) // expect: 1
System.print(Foo.new() ? 1 : 2) // expect: 1
var a = 0
IO.print(a = 3 ? 1 : 2) // expect: 1
IO.print(a) // expect: 1
System.print(a = 3 ? 1 : 2) // expect: 1
System.print(a) // expect: 1
// Then branch precedence.
IO.print(true ? (1) : 2) // expect: 1
IO.print(true ? [1][0] : 2) // expect: 1
IO.print(true ? Foo.baz : 2) // expect: 1
IO.print(true ? 3..4 : 2) // expect: 3..4
IO.print(true ? 3 * 4 : 2) // expect: 12
IO.print(true ? 3 + 4 : 2) // expect: 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 ? Foo.new() : 2) // expect: instance of Foo
System.print(true ? (1) : 2) // expect: 1
System.print(true ? [1][0] : 2) // expect: 1
System.print(true ? Foo.baz : 2) // expect: 1
System.print(true ? 3..4 : 2) // expect: 3..4
System.print(true ? 3 * 4 : 2) // expect: 12
System.print(true ? 3 + 4 : 2) // expect: 7
System.print(true ? 1 || false : 2) // expect: 1
System.print(true ? !true : 2) // expect: false
System.print(true ? ~0 : 2) // expect: 4294967295
System.print(true ? 3 is Bool : 2) // expect: false
System.print(true ? Foo.new() : 2) // expect: instance of Foo
IO.print(true ? a = 5 : 2) // expect: 5
IO.print(a) // expect: 5
System.print(true ? a = 5 : 2) // expect: 5
System.print(a) // expect: 5
// Else branch precedence.
IO.print(false ? 1 : (2)) // expect: 2
IO.print(false ? 1 : [2][0]) // expect: 2
IO.print(false ? 2 : Foo.baz) // expect: 1
IO.print(false ? 1 : 3..4) // expect: 3..4
IO.print(false ? 1 : 3 * 4) // expect: 12
IO.print(false ? 1 : 3 + 4) // expect: 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 : Foo.new()) // expect: instance of Foo
System.print(false ? 1 : (2)) // expect: 2
System.print(false ? 1 : [2][0]) // expect: 2
System.print(false ? 2 : Foo.baz) // expect: 1
System.print(false ? 1 : 3..4) // expect: 3..4
System.print(false ? 1 : 3 * 4) // expect: 12
System.print(false ? 1 : 3 + 4) // expect: 7
System.print(false ? 1 : 2 || false) // expect: 2
System.print(false ? 1 : !false) // expect: true
System.print(false ? 1 : ~0) // expect: 4294967295
System.print(false ? 1 : 3 is Num) // expect: true
System.print(false ? 1 : Foo.new()) // expect: instance of Foo
// Associativity.
IO.print(true ? 2 : true ? 4 : 5) // expect: 2
IO.print(false ? 2 : true ? 4 : 5) // expect: 4
System.print(true ? 2 : true ? 4 : 5) // expect: 2
System.print(false ? 2 : true ? 4 : 5) // expect: 4
+2 -2
View File
@@ -1,2 +1,2 @@
true ? IO.print("ok") : IO.print("no") // expect: ok
false ? IO.print("no") : IO.print("ok") // expect: ok
true ? System.print("ok") : System.print("no") // expect: ok
false ? System.print("no") : System.print("ok") // expect: ok