Open dckc opened 2 years ago
This pattern allows us to listen on specific actions, on the same channel (that is exposed to registry).
for (@("ACTION_A", return) <= entryCh) {...}
for (@("ACTION_B", parameter1, return) <= entryCh) {...}
for (@("ACTION_C", parameter1, parameter2, return) <= entryCh) {...}
Please explain how you would do it with the following pattern/syntax:
contract helloWorld(@name) = {...}
I already gave such an example, no?
contract MultiSigRevVault(@"makeSealerUnsealer", ret) = {
Yes but then, let's say you have 3 contract
like this one, how do you expose the 3 to the registry (eg: external rholang executions).
In our case it is as simple as this :
for (@("ACTION_A", return) <= entryCh) {...}
for (@("ACTION_B", parameter1, return) <= entryCh) {...}
for (@("ACTION_C", parameter1, parameter2, return) <= entryCh) {...}
insertArbitrary!(bundle+{*entryCh}, *entryUriCh) |
To call it from external rholang execution you just do that :
registryLookup!(`rho:id:abcdef`, *entryCh) |
for (entry <- entryCh) { entry!(("ACTION_A", *returnCh)) }
Yes but then, let's say you have 3
contract
like this one, how do you expose the 3 to the registry (eg: external rholang executions).
Again, I already gave an example of how to do this. The one MultiSigRevVault
name is exported to the registry, and the several contract
processes match on the method name in the 1st arg.
contract MultiSigRevVault(@"makeSealerUnsealer", ret) = {
//...
} |
contract MultiSigRevVault(@"deployerAuthKey", deployerId, ret) = {
// ...
}
ok Now I get it thanks !
Cool! I'd like to keep this open as a request to migrate to this idiomatic style.
Compare:
vs. the established pattern from the core dev team:
-- https://github.com/rchain/rchain/blob/dev/rholang/examples/tut-hello.rho
-- https://github.com/rchain/rchain/blob/dev/casper/src/main/resources/MultiSigRevVault.rho
Why not use
contract
? Why not use scala/JavaScript/Java/Smalltalk style CamelCase for naming?