"IO" -> "System".

Get rid of the separate opt-in IO class and replace it with a core
System class.

- Remove wren_io.c, wren_io.h, and io.wren.
- Remove the flags that disable it.
- Remove the overloads for print() with different arity. (It was an
  experiment, but I don't think it's that useful.)
- Remove IO.read(). That will reappear using libuv in the CLI at some
  point.
- Remove IO.time. Doesn't seem to have been used.
- Update all of the tests, docs, etc.

I'm sorry for all the breakage this causes, but I think "System" is a
better name for this class (it makes it natural to add things like
"System.gc()") and frees up "IO" for referring to the CLI's IO module.
This commit is contained in:
Bob Nystrom
2015-09-15 07:46:09 -07:00
parent 66b89a493f
commit 58e4d26648
491 changed files with 3285 additions and 3544 deletions

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

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

View File

@ -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.

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

View File

@ -1 +1 @@
IO.print(Fn.new {}) // expect: <fn>
System.print(Fn.new {}) // expect: <fn>

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