"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
+18 -18
View File
@@ -21,21 +21,21 @@ class Foo {
}
var foo = Foo.new()
IO.print(foo.method) // expect: getter
IO.print(foo.method()) // expect: no args
IO.print(foo.method(1)) // expect: 1
IO.print(foo.method(1, 2)) // expect: 3
IO.print(foo.method(1, 2, 3)) // expect: 6
IO.print(foo.method(1, 2, 3, 4)) // expect: 10
IO.print(foo.method(1, 2, 3, 4, 5)) // expect: 15
IO.print(foo.method(1, 2, 3, 4, 5, 6)) // expect: 21
IO.print(foo.method(1, 2, 3, 4, 5, 6, 7)) // expect: 28
IO.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8)) // expect: 36
IO.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8, 9)) // expect: 45
IO.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) // expect: 55
IO.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)) // expect: 66
IO.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)) // expect: 78
IO.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)) // expect: 91
IO.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)) // expect: 105
IO.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)) // expect: 120
IO.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)) // expect: 136
System.print(foo.method) // expect: getter
System.print(foo.method()) // expect: no args
System.print(foo.method(1)) // expect: 1
System.print(foo.method(1, 2)) // expect: 3
System.print(foo.method(1, 2, 3)) // expect: 6
System.print(foo.method(1, 2, 3, 4)) // expect: 10
System.print(foo.method(1, 2, 3, 4, 5)) // expect: 15
System.print(foo.method(1, 2, 3, 4, 5, 6)) // expect: 21
System.print(foo.method(1, 2, 3, 4, 5, 6, 7)) // expect: 28
System.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8)) // expect: 36
System.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8, 9)) // expect: 45
System.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) // expect: 55
System.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)) // expect: 66
System.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)) // expect: 78
System.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)) // expect: 91
System.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)) // expect: 105
System.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)) // expect: 120
System.print(foo.method(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)) // expect: 136
+1 -1
View File
@@ -3,4 +3,4 @@ class Foo {
bar {}
}
IO.print(Foo.new().bar) // expect: null
System.print(Foo.new().bar) // expect: null
+1 -1
View File
@@ -5,4 +5,4 @@ class Foo {
}
}
IO.print(Foo.new().thisHasAMethodNameThatIsExactly64CharactersLongWhichIsTheMaximum) // expect: result
System.print(Foo.new().thisHasAMethodNameThatIsExactly64CharactersLongWhichIsTheMaximum) // expect: result
+1 -1
View File
@@ -2022,4 +2022,4 @@ result = result + foo.method996
result = result + foo.method997
result = result + foo.method998
result = result + foo.method999
IO.print(result) // expect: 1000
System.print(result) // expect: 1000
+2 -2
View File
@@ -7,14 +7,14 @@ class Foo {
var foo = Foo.new()
// Allow newlines after commas and before ")".
IO.print(foo.method("a",
System.print(foo.method("a",
"b"
)) // expect: method a b
// Allow newlines after commas and before "]".
IO.print(foo["a",
System.print(foo["a",
"b"
+16 -16
View File
@@ -21,19 +21,19 @@ class Foo {
}
var foo = Foo.new()
IO.print(foo + "a") // expect: infix + a
IO.print(foo - "a") // expect: infix - a
IO.print(foo * "a") // expect: infix * a
IO.print(foo / "a") // expect: infix / a
IO.print(foo % "a") // expect: infix % a
IO.print(foo < "a") // expect: infix < a
IO.print(foo > "a") // expect: infix > a
IO.print(foo <= "a") // expect: infix <= a
IO.print(foo >= "a") // expect: infix >= a
IO.print(foo == "a") // expect: infix == a
IO.print(foo != "a") // expect: infix != a
IO.print(foo & "a") // expect: infix & a
IO.print(foo | "a") // expect: infix | a
IO.print(!foo) // expect: prefix !
IO.print(~foo) // expect: prefix ~
IO.print(-foo) // expect: prefix -
System.print(foo + "a") // expect: infix + a
System.print(foo - "a") // expect: infix - a
System.print(foo * "a") // expect: infix * a
System.print(foo / "a") // expect: infix / a
System.print(foo % "a") // expect: infix % a
System.print(foo < "a") // expect: infix < a
System.print(foo > "a") // expect: infix > a
System.print(foo <= "a") // expect: infix <= a
System.print(foo >= "a") // expect: infix >= a
System.print(foo == "a") // expect: infix == a
System.print(foo != "a") // expect: infix != a
System.print(foo & "a") // expect: infix & a
System.print(foo | "a") // expect: infix | a
System.print(!foo) // expect: prefix !
System.print(~foo) // expect: prefix ~
System.print(-foo) // expect: prefix -
+4 -4
View File
@@ -7,7 +7,7 @@ class Foo {
static bar(arg) { "on metaclass " + arg }
}
IO.print(Foo.new().bar) // expect: on instance
IO.print(Foo.bar) // expect: on metaclass
IO.print(Foo.new().bar("arg")) // expect: on instance arg
IO.print(Foo.bar("arg")) // expect: on metaclass arg
System.print(Foo.new().bar) // expect: on instance
System.print(Foo.bar) // expect: on metaclass
System.print(Foo.new().bar("arg")) // expect: on instance arg
System.print(Foo.bar("arg")) // expect: on metaclass arg
@@ -9,9 +9,9 @@ class Foo {
}
var foo = Foo.new()
IO.print(foo["a"]) // expect: 1-subscript a
IO.print(foo["a", "b"]) // expect: 2-subscript a b
IO.print(foo["a", "b", "c"]) // expect: 3-subscript a b c
IO.print(foo["a"] = "value") // expect: 1-subscript setter a = value
IO.print(foo["a", "b"] = "value") // expect: 2-subscript setter a b = value
IO.print(foo["a", "b", "c"] = "value") // expect: 3-subscript setter a b c = value
System.print(foo["a"]) // expect: 1-subscript a
System.print(foo["a", "b"]) // expect: 2-subscript a b
System.print(foo["a", "b", "c"]) // expect: 3-subscript a b c
System.print(foo["a"] = "value") // expect: 1-subscript setter a = value
System.print(foo["a", "b"] = "value") // expect: 2-subscript setter a b = value
System.print(foo["a", "b", "c"] = "value") // expect: 3-subscript setter a b c = value
+1 -1
View File
@@ -1 +1 @@
IO.print(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17) // expect error
System.print(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17) // expect error