mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-12 06:38:45 +01:00
"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,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
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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 @@
|
||||
IO.print(Fn.new {}) // expect: <fn>
|
||||
System.print(Fn.new {}) // expect: <fn>
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user