"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:
@@ -0,0 +1,43 @@
|
||||
^title System Class
|
||||
^category core
|
||||
|
||||
The System class is a grab-bag of functionality exposed by the VM, mostly for
|
||||
use during development or debugging.
|
||||
|
||||
## Static Methods
|
||||
|
||||
### System.**print**()
|
||||
|
||||
Prints a single newline to the console.
|
||||
|
||||
### System.**print**(object)
|
||||
|
||||
Prints [object] to the console followed by a newline. If not already a string,
|
||||
the object is converted to a string by calling `toString` on it.
|
||||
|
||||
:::dart
|
||||
System.print("I like bananas") // Prints "I like bananas".
|
||||
|
||||
### System.**printAll**(sequence)
|
||||
|
||||
Iterates over [sequence] and prints each element, then prints a single newline
|
||||
at the end. Each element is converted to a string by calling `toString` on it.
|
||||
|
||||
:::dart
|
||||
System.printAll([1, [2, 3], 4]) // Prints "1[2, 3]4".
|
||||
|
||||
### System.**write**(object)
|
||||
|
||||
Prints a single value to the console, but does not print a newline character
|
||||
afterwards. Converts the value to a string by calling `toString` on it.
|
||||
|
||||
:::dart
|
||||
System.write(4 + 5) // Prints "9".
|
||||
|
||||
In the above example, the result of `4 + 5` is printed, and then the prompt is
|
||||
printed on the same line because no newline character was printed afterwards.
|
||||
|
||||
### System.**clock**
|
||||
|
||||
Returns the number of seconds (including fractional seconds) since the program
|
||||
was started. This is usually used for benchmarking.
|
||||
Reference in New Issue
Block a user