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
+5 -5
View File
@@ -1,5 +1,5 @@
IO.print(Fn.new {}.arity) // expect: 0
IO.print(Fn.new {|a| a}.arity) // expect: 1
IO.print(Fn.new {|a, b| a}.arity) // expect: 2
IO.print(Fn.new {|a, b, c| a}.arity) // expect: 3
IO.print(Fn.new {|a, b, c, d| a}.arity) // expect: 4
System.print(Fn.new {}.arity) // expect: 0
System.print(Fn.new {|a| a}.arity) // expect: 1
System.print(Fn.new {|a, b| a}.arity) // expect: 2
System.print(Fn.new {|a, b, c| a}.arity) // expect: 3
System.print(Fn.new {|a, b, c, d| a}.arity) // expect: 4
+4 -4
View File
@@ -1,7 +1,7 @@
var f0 = Fn.new { IO.print("zero") }
var f1 = Fn.new {|a| IO.print("one ", a) }
var f2 = Fn.new {|a, b| IO.print("two ", a, " ", b) }
var f3 = Fn.new {|a, b, c| IO.print("three ", a, " ", b, " ", c) }
var f0 = Fn.new { System.print("zero") }
var f1 = Fn.new {|a| System.print("one " + a) }
var f2 = Fn.new {|a, b| System.print("two " + a + " " + b) }
var f3 = Fn.new {|a, b, c| System.print("three " + a + " " + b + " " + c) }
f0.call("a") // expect: zero
f0.call("a", "b") // expect: zero
@@ -1,2 +1,2 @@
var f2 = Fn.new {|a, b| IO.print(a, b) }
var f2 = Fn.new {|a, b| System.print(a, b) }
f2.call("a") // expect runtime error: Function expects more arguments.
+10 -10
View File
@@ -1,16 +1,16 @@
// Not structurally equal.
IO.print(Fn.new { 123 } == Fn.new { 123 }) // expect: false
IO.print(Fn.new { 123 } != Fn.new { 123 }) // expect: true
System.print(Fn.new { 123 } == Fn.new { 123 }) // expect: false
System.print(Fn.new { 123 } != Fn.new { 123 }) // expect: true
// Not equal to other types.
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
System.print(Fn.new { 123 } == 1) // expect: false
System.print(Fn.new { 123 } == false) // expect: false
System.print(Fn.new { 123 } == "fn 123") // expect: false
System.print(Fn.new { 123 } != 1) // expect: true
System.print(Fn.new { 123 } != false) // expect: true
System.print(Fn.new { 123 } != "fn 123") // expect: true
// Equal by identity.
var f = Fn.new { 123 }
IO.print(f == f) // expect: true
IO.print(f != f) // expect: false
System.print(f == f) // expect: true
System.print(f != f) // expect: false
+1 -1
View File
@@ -1 +1 @@
IO.print(Fn.new {}) // expect: <fn>
System.print(Fn.new {}) // expect: <fn>
+4 -4
View File
@@ -1,4 +1,4 @@
IO.print(Fn.new { 0 } is Fn) // expect: true
IO.print(Fn.new { 0 } is Object) // expect: true
IO.print(Fn.new { 0 } is String) // expect: false
IO.print(Fn.new { 0 }.type == Fn) // expect: true
System.print(Fn.new { 0 } is Fn) // expect: true
System.print(Fn.new { 0 } is Object) // expect: true
System.print(Fn.new { 0 } is String) // expect: false
System.print(Fn.new { 0 }.type == Fn) // expect: true