"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:
@@ -1,34 +0,0 @@
|
||||
class Foo {
|
||||
construct new() {}
|
||||
|
||||
toString { "Foo.toString" }
|
||||
}
|
||||
|
||||
// Calls toString on argument.
|
||||
IO.print(Foo.new()) // expect: Foo.toString
|
||||
|
||||
// With one argument, returns the argument.
|
||||
IO.print(IO.print(1) == 1) // expect: 1
|
||||
// expect: true
|
||||
|
||||
// With more than one argument, returns null.
|
||||
IO.print(IO.print(1, 2) == null) // expect: 12
|
||||
// expect: true
|
||||
|
||||
// Allows multiple arguments and concatenates them.
|
||||
IO.print(1) // expect: 1
|
||||
IO.print(1, 2) // expect: 12
|
||||
IO.print(1, 2, 3) // expect: 123
|
||||
IO.print(1, 2, 3, 4) // expect: 1234
|
||||
IO.print(1, 2, 3, 4, 5) // expect: 12345
|
||||
IO.print(1, 2, 3, 4, 5, 6) // expect: 123456
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7) // expect: 1234567
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8) // expect: 12345678
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8, 9) // expect: 123456789
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) // expect: 12345678910
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) // expect: 1234567891011
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) // expect: 123456789101112
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13) // expect: 12345678910111213
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14) // expect: 1234567891011121314
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) // expect: 123456789101112131415
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) // expect: 12345678910111213141516
|
||||
@@ -1,6 +0,0 @@
|
||||
class BadToString {
|
||||
construct new() {}
|
||||
toString { 3 }
|
||||
}
|
||||
|
||||
IO.print(BadToString.new()) // expect: [invalid toString]
|
||||
@@ -1,13 +0,0 @@
|
||||
var a = IO.read("a:") // stdin: first
|
||||
var b = IO.read("b:") // stdin: second
|
||||
IO.print
|
||||
// Using write() here because the read lines include the trailing newline.
|
||||
IO.write(a)
|
||||
IO.write(b)
|
||||
|
||||
// Since stdin isn't echoed back to stdout, we don't see the input lines here,
|
||||
// and there is no newline between the two prompts since that normally comes
|
||||
// from the input itself.
|
||||
// expect: a:b:
|
||||
// expect: first
|
||||
// expect: second
|
||||
@@ -1 +0,0 @@
|
||||
IO.read(null) // expect runtime error: Prompt must be a string.
|
||||
@@ -1 +0,0 @@
|
||||
IO.write(IO.read()) // expect: null
|
||||
@@ -1,7 +0,0 @@
|
||||
class BadToString {
|
||||
construct new() {}
|
||||
toString { 3 }
|
||||
}
|
||||
|
||||
IO.write(BadToString.new()) // expect: [invalid toString]
|
||||
IO.print
|
||||
Reference in New Issue
Block a user