-
-
Save ondreian/30a3ffbe35345fabe6a0ff91db560e42 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Error: | |
registry.pony:7:30: this parameter must be sendable (iso, val or tag) | |
be fetch(key: String, cb: ({tag (T)})) => | |
^ | |
Error: | |
registry.pony:10:18: this parameter must be sendable (iso, val or tag) | |
be access(cb: ({tag (Map[String, T tag])})) => | |
^ | |
Error: | |
registry.pony:13:30: this parameter must be sendable (iso, val or tag) | |
be put(key: String, value: T tag) => | |
^ | |
Error: | |
registry.pony:16:33: this parameter must be sendable (iso, val or tag) | |
be delete(key: String, value: T tag) => | |
^ | |
Makefile:2: recipe for target 'build' failed | |
make: *** [build] Error 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use "collections" | |
use "promises" | |
actor Registry[T] | |
embed _registry: Map[String, T tag] = _registry.create() | |
be fetch(key: String, cb: ({tag (T)})) => | |
cb(try _registry(key) end) | |
be access(cb: ({tag (Map[String, T tag])})) => | |
cb(_registry) | |
be put(key: String, value: T tag) => | |
_registry(key) = value | |
be delete(key: String, value: T tag) => | |
try | |
if _registry(key)? is value then | |
_registry.remove(key)? | |
end | |
end | |
be _fetch[A: T tag](key: String, promise: Promise[A]) => | |
try | |
promise(_registry(key)? as A) | |
else | |
promise.reject() | |
end | |
fun tag apply[A: T tag = T tag](key: String): Promise[A] => | |
let promise = Promise[A] | |
_fetch[A](key, promise) | |
promise |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment