Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transparent proxy support #50

Open
jimscarver opened this issue May 3, 2022 · 1 comment
Open

transparent proxy support #50

jimscarver opened this issue May 3, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@jimscarver
Copy link
Collaborator

jimscarver commented May 3, 2022

Introduction/Motivation/Abstract

Proxy channels are valuable to control access to a capability such as ont time capabilities, revocable capabilities, remote channels (#45), decorator patterns, etc. Currently when we do not know how many arguments might be sent to a proxy we must implement a contract for every possible number of arguments. Unless we limit the number of arguments in a send the proxy will fail if the channel receives a message with too many arguments.

The proposal is that arg... binds the name arg to a tuple and arg... in a send sends the arguments in the tuple.

contract proxy(tuple...) = {
  channel!(tuple...)
}

Motivating Examples

Currently a simple rholang proxy is awkward and inefficient. It requires a contract for each of the possible number of arguments

contract proxy(one) { channel!(one) } |
contract proxy(one, two) { channel!(one, two) } |
contract proxy(one, two, three) { channel!(one, two, three) } |
...

Examples

Match can allow simplified control of proxy alternatives. e.g.

match tuple {
  (one,two) => { proxy!(one, two) }
  * => { proxy!(tuple...) } 
}

Comparison Examples

Counter-Examples

Design

Counter-Examples

Drawbacks

Alternatives

References

https://refactoring.guru/design-patterns/proxy

@jimscarver jimscarver added the enhancement New feature or request label May 3, 2022
@jimscarver
Copy link
Collaborator Author

Another use case: Transparent proxies for channels created in test programs could be used to trace sends and to channels and test assertions to help facilitate debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants