"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,4 +1,4 @@
|
||||
class Foo {
|
||||
construct new() {}
|
||||
}
|
||||
IO.print(!Foo.new()) // expect: false
|
||||
System.print(!Foo.new()) // expect: false
|
||||
|
||||
+19
-19
@@ -1,27 +1,27 @@
|
||||
// Value types compare by value.
|
||||
IO.print(Object.same(true, true)) // expect: true
|
||||
IO.print(Object.same(true, false)) // expect: false
|
||||
System.print(Object.same(true, true)) // expect: true
|
||||
System.print(Object.same(true, false)) // expect: false
|
||||
|
||||
IO.print(Object.same(null, null)) // expect: true
|
||||
System.print(Object.same(null, null)) // expect: true
|
||||
|
||||
IO.print(Object.same(1 + 2, 2 + 1)) // expect: true
|
||||
IO.print(Object.same(1 + 2, 2 + 2)) // expect: false
|
||||
System.print(Object.same(1 + 2, 2 + 1)) // expect: true
|
||||
System.print(Object.same(1 + 2, 2 + 2)) // expect: false
|
||||
|
||||
IO.print(Object.same(1..2, 1..2)) // expect: true
|
||||
IO.print(Object.same(1..2, 1..3)) // expect: false
|
||||
System.print(Object.same(1..2, 1..2)) // expect: true
|
||||
System.print(Object.same(1..2, 1..3)) // expect: false
|
||||
|
||||
IO.print(Object.same("ab", "a" + "b")) // expect: true
|
||||
IO.print(Object.same("ab", "a" + "c")) // expect: false
|
||||
System.print(Object.same("ab", "a" + "b")) // expect: true
|
||||
System.print(Object.same("ab", "a" + "c")) // expect: false
|
||||
|
||||
// Different types are never the same.
|
||||
IO.print(Object.same(null, false)) // expect: false
|
||||
IO.print(Object.same(true, 2)) // expect: false
|
||||
IO.print(Object.same(1..2, 2)) // expect: false
|
||||
IO.print(Object.same("1", 1)) // expect: false
|
||||
System.print(Object.same(null, false)) // expect: false
|
||||
System.print(Object.same(true, 2)) // expect: false
|
||||
System.print(Object.same(1..2, 2)) // expect: false
|
||||
System.print(Object.same("1", 1)) // expect: false
|
||||
|
||||
// Classes compare by identity.
|
||||
IO.print(Object.same(Bool, Num)) // expect: false
|
||||
IO.print(Object.same(Bool, Bool)) // expect: true
|
||||
System.print(Object.same(Bool, Num)) // expect: false
|
||||
System.print(Object.same(Bool, Bool)) // expect: true
|
||||
|
||||
// Other types compare by identity.
|
||||
class Foo {
|
||||
@@ -29,8 +29,8 @@ class Foo {
|
||||
}
|
||||
|
||||
var foo = Foo.new()
|
||||
IO.print(Object.same(foo, foo)) // expect: true
|
||||
IO.print(Object.same(foo, Foo.new())) // expect: false
|
||||
System.print(Object.same(foo, foo)) // expect: true
|
||||
System.print(Object.same(foo, Foo.new())) // expect: false
|
||||
|
||||
// Ignores == operators.
|
||||
class Bar {
|
||||
@@ -39,5 +39,5 @@ class Bar {
|
||||
}
|
||||
|
||||
var bar = Bar.new()
|
||||
IO.print(Object.same(bar, bar)) // expect: true
|
||||
IO.print(Object.same(bar, Bar.new())) // expect: false
|
||||
System.print(Object.same(bar, bar)) // expect: true
|
||||
System.print(Object.same(bar, Bar.new())) // expect: false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Foo {
|
||||
construct new() {}
|
||||
}
|
||||
IO.print(Foo.new().toString == "instance of Foo") // expect: true
|
||||
System.print(Foo.new().toString == "instance of Foo") // expect: true
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
class Foo {}
|
||||
|
||||
// Object's class is a class.
|
||||
IO.print(Object is Class) // expect: true
|
||||
System.print(Object is Class) // expect: true
|
||||
|
||||
// Its metatype is also a class.
|
||||
IO.print(Object.type is Class) // expect: true
|
||||
System.print(Object.type is Class) // expect: true
|
||||
|
||||
// The metatype's metatype is Class.
|
||||
IO.print(Object.type.type == Class) // expect: true
|
||||
System.print(Object.type.type == Class) // expect: true
|
||||
|
||||
// Object has a distinct metaclass.
|
||||
IO.print(Object.type.name) // expect: Object metaclass
|
||||
System.print(Object.type.name) // expect: Object metaclass
|
||||
|
||||
Reference in New Issue
Block a user