ocap-happy method dispatch idioms in Rholang  


Member Moderator
Joined:6 months  ago
Posts: 20
18/06/2018 9:49 pm  
I've seen a few different idioms for method dispatch in rholang... some fit better with ocap patterns such as caretaker better than others.
contract @[*thisMint, "makePurse"](@init, return) ...
is in MakeMint.rho  ( https://github.com/rchain/rchain/pull/962). I think that idiom works less well.
I don't see how to make a revocable forwarder for thisMint. ocap patterns such as revocable forwarder and membrane depend on being able to process each message sent to an object. and in this idiom, the makePurse message is not sent to thisMint but rather to @[*thisMint, "makePurse"]
Mike Stay notes you can create new names rfMint, forward, and kill, then say

forward!(true) |
contract @[*rfMint, "makePurse"](@init, return) = {
  for (@shouldForward <- forward) {
    forward!(shouldForward) |
    if (shouldForward) {
      @[*thisMint, "makePurse](init, *return)
    } else {
} |
contract kill() = {
  for (_ <- forward) { forward!(false) }
but it's awkward that you have to make a revokable forwarder for each "method" of mint.

Member Moderator
Joined:7 months  ago
Posts: 39
19/06/2018 2:02 pm  

I replied to your comment on GitHub with how I would compose the "compound name" idiom with revocable forwarders.



Please Login or Register