Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nyuichi/mruby-partcont
partial continuation (a.k.a. delimited continuation) extension for mruby
https://github.com/nyuichi/mruby-partcont
Last synced: 2 months ago
JSON representation
partial continuation (a.k.a. delimited continuation) extension for mruby
- Host: GitHub
- URL: https://github.com/nyuichi/mruby-partcont
- Owner: nyuichi
- Created: 2013-09-28T09:02:38.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-10-04T14:32:08.000Z (about 11 years ago)
- Last Synced: 2023-03-11T16:37:24.545Z (almost 2 years ago)
- Language: C
- Size: 102 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mruby-partcont
partial continuation support for mruby.
## Install
```ruby
MRuby::Build.new do |conf|# ... (snip) ...
conf.gem :github => 'wasabiz/mruby-partcont'
end
```mruby-partcont does not depends on other libraries or extensions, but
for the safety it is highly recommended to add at the end of the gem build conf.## Example
```ruby
reset {
p 1
shift {|k|
p 2
k.call()
p 3
}
p 4
}
# 1
# 2
# 4
# 3
# => nil
```## APIs
- `Continuation class`
Represents a delimited continuation that cuts the process from where
the shift operator is called up to the nearest reset operator. Since continuations
have infinite extent, once they are created it is possible to call them anytime anywhere,
and even however many times. When the continuation is cut (making a continuation closure),
the bottom of the stack of the delimited continuation is dynamically chosen.- `Kernel.#reset { ... } -> value`
- `Kernel.#shift {|k| ... } -> value`## ToDos
- control/prompt
- full (undelimited) continuation support
- documentation## auther
Yuichi Nishiwaki