"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:
@@ -28,7 +28,7 @@ using the `Fiber` class's constructor:
|
||||
|
||||
:::dart
|
||||
var fiber = Fiber.new {
|
||||
IO.print("This runs in a separate fiber.")
|
||||
System.print("This runs in a separate fiber.")
|
||||
}
|
||||
|
||||
Creating a fiber does not immediately run it. It's just a first class bundle of
|
||||
@@ -48,7 +48,7 @@ until it passes control to another fiber. If it reaches the end of its body,
|
||||
it's considered *done*:
|
||||
|
||||
:::dart
|
||||
var fiber = Fiber.new { IO.print("Hi") }
|
||||
var fiber = Fiber.new { System.print("Hi") }
|
||||
fiber.isDone // false
|
||||
fiber.call()
|
||||
fiber.isDone // true
|
||||
@@ -71,16 +71,16 @@ You can make a fiber yield by calling the static `yield()` method on `Fiber`:
|
||||
|
||||
:::dart
|
||||
var fiber = Fiber.new {
|
||||
IO.print("fiber 1")
|
||||
System.print("fiber 1")
|
||||
Fiber.yield()
|
||||
IO.print("fiber 2")
|
||||
System.print("fiber 2")
|
||||
}
|
||||
|
||||
IO.print("main 1")
|
||||
System.print("main 1")
|
||||
fiber.call()
|
||||
IO.print("main 2")
|
||||
System.print("main 2")
|
||||
fiber.call()
|
||||
IO.print("main 3")
|
||||
System.print("main 3")
|
||||
|
||||
This program prints:
|
||||
|
||||
@@ -105,7 +105,7 @@ of the `yield()` call:
|
||||
:::dart
|
||||
var fiber = Fiber.new {
|
||||
var result = Fiber.yield()
|
||||
IO.print(result)
|
||||
System.print(result)
|
||||
}
|
||||
|
||||
fiber.call("discarded")
|
||||
@@ -124,7 +124,7 @@ invoke the fiber:
|
||||
Fiber.yield("sent")
|
||||
}
|
||||
|
||||
IO.print(fiber.call())
|
||||
System.print(fiber.call())
|
||||
|
||||
This also prints "sent".
|
||||
|
||||
|
||||
Reference in New Issue
Block a user