| Short description: |
Join-Patterns for Ruby |
| Category: |
Library/thread |
| Status: |
usable |
| Created: |
2001-04-12 15:22:43 GMT |
| Last update: |
- |
| Owner: |
Michael Neumann
(Projects of this owner) |
| Homepage: |
not available |
| Download: |
http://www.stud.uni-karlsruhe.de/~uu9r/join.rb
|
| License: |
Ruby's |
| Dependency: |
|
| Description: |
Join-Patterns for Ruby implements the Join-Calculus as in JoCaml (http://pauillac.inria.fr/jocaml/) in Ruby.
Uses tuplespace.rb.
Is great for synchronizing concurrent calls, and
should work easily with dRuby (not tested).
Example on defining a counter:
# ...
js.let_def "count! n | inc ()" do
send "count!", @n+1
reply_to "inc"
end
js.let_def "count! n | get ()" do
send "count!", @n
reply_to "get", @n
end
# initialize counter with 4
js.send "count!", 4
# now you can increment from everywhere
js.send "inc"
js.send "inc"
p (js.send "get") # => 6
##########
The same in JoCaml:
let def count! n | inc () = count (n+1) | reply to inc
or count! n | get () = count n | reply to get ;;
|