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.
1.8 KiB
^title Map Class ^category core
An associative collection that maps keys to values. More details here.
Methods
clear()
Removes all entries from the map.
containsKey(key)
Returns true if the map contains key or false otherwise.
count
The number of entries in the map.
keys
A Sequence that can be used to iterate over the keys in the map. Note that iteration order is undefined. All keys will be iterated over, but may be in any order, and may even change between invocations of Wren.
iterate(iterator), iteratorValue(iterator)
Implements the iterator protocol for iterating over the elements in the list.
remove(key)
Removes [key] and the value associated with it from the map. Returns the value.
If the key was not present, returns null.
values
A Sequence that can be used to iterate over the values in the map. Note that iteration order is undefined. All values will be iterated over, but may be in any order, and may even change between invocations of Wren.
If multiple keys are associated with the same value, the value will appear multiple times in the sequence.
[key] operator
Gets the value associated with key in the map. If key is not present in the
map, returns null.
:::dart
var map = {"george": "harrison", "ringo": "starr"}
System.print(map["ringo"]) // "starr".
System.print(map["pete"]) // "null".
[key]=(value) operator
Associates value with key in the map. If key was already in the map, this
replaces the previous association.
It is a runtime error if the key is not a Bool, Class, Null, Num, Range, or String.