In pony access pattern page:
https://patterns.ponylang.org/async/access.html
The following source code is
use collections = "collections"
actor SharedRegisters
let _data: collections.Map[String, I64] = _data.create()
be write(name: String, value: I64) =>
"""
Write to the named register, setting its value to the given value.
"""
_data(name) = value
be read(name: String, fn: {(I64)} val) =>
"""
Read the value of the named register and pass it to the given function.
A register which has never been written to will have a value of zero.
"""
fn(try _data(name) else 0 end)
http://playground.ponylang.org/?gist=441163b1de339e775b926d60ff5039d7
This causes the following error
main.pony:17:22: call is not partial but the method is - a question mark is required after this call
fn(try _data(name) else 0 end)
^
Info:
packages/collections/map.pony:46:36: method is here
fun apply(key: box->K!): this->V ? =>
Maybe I think a partial function.
be read(name: String, fn: {(I64)} val) =>
"""
Read the value of the named register and pass it to the given function.
A register which has never been written to will have a value of zero.
"""
fn(try _data(name)? else 0 end)
In pony access pattern page:
https://patterns.ponylang.org/async/access.html
The following source code is
http://playground.ponylang.org/?gist=441163b1de339e775b926d60ff5039d7
This causes the following error
Maybe I think a partial function.