Syntactic sugaring proposals for Rholang
Purpose
The purpose of this page is to capture proposals of syntactic sugaring to benefit users of Rholang and to track discussion and decision-making related to these proposals.
How to use this page
All contributors welcome! Please do not remove content that you didn't author.
Proposals
Proposal | Discussion | Decision |
|---|---|---|
let PLet. Proc2 ::= "let" [Binding] "in" "{" Proc3 "}"; BindingProcToPat. Binding ::= [Name] NameRemainder "<-" Proc3 ; | prototyped in PR #2055 see also RCHAIN-2641 The delimiter shown is ←; should it be =? |
|
lambda
| The desugared version is what one has to write anyway in order to use tools like ListOps. The expressiveness of Rholang will be hugely improved. |
|
"contract methods" (technically they are not methods but I have no idea how to call them ) contract channel.methodName(a, b, c) | channel.methodName!(P, Q, R) will translate to: contract channel(@"methodName", a, b, c) | channel!("methodName", P, Q, R) which translates to: for (@"methodName", a, b, c <= channel)
| Could make the code more readable and also friendlier to OOP devs |
|
contract varargs
| Such a syntax feature would allow us to write multi-arity contracts easier. Also we could write decorator contracts that receive a message with any structure, do some work and then forward the original message to a lower level |
|
...would desugar to for(@(_, MakeMint) <- MakeMintCh) { ... } } |
... } For this we will have to make the registry lookup as a special case of system processes but since it's used everywhere I don't see that as being a problem. |
|
ch1 ! ("someMethod", ←ch2, ← ch3) ...would desugar to for( x ← ch2, y ← ch3) { ch1 ! ( "someMethod", x , y ) } |
|
|
ch1#method ! (arg1, arg2,...) ...would desugar to ch1 ! ( "method", arg1, arg2,...) |
|
|
|
| |
|
| |
|
| |
|
| |
|
|