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

Extensibility for Context object #23

Open
chrisheller opened this issue Jul 2, 2019 · 2 comments
Open

Extensibility for Context object #23

chrisheller opened this issue Jul 2, 2019 · 2 comments

Comments

@chrisheller
Copy link
Contributor

Are there any thoughts for adding extensibility to the Context object? It would be handy to be able to attach information calculated in a Handler to the Context for a given request.

For simple Handler-s you can just write inline anonymous procs that have visibility to variables calculated in a containing scope, but there's not an (easy) way to do this with a Handler that is not inline. This is especially true if you have multiple things that are being calculated by various Handler-s.

Thanks

@andreaferretti
Copy link
Owner

One thing that we may do is to change Context to Context[A], where we add a field custom: A, so that one can instantiate whatever context they like. The current context would then become Context[void], for which may add a type alias DefaultContext = Context[void].

Could this work for you? Do you have a concrete example where this necessity shows up, to better understand this use case?

@chrisheller
Copy link
Contributor Author

That would be great. Being able to attach some application specific context would be useful.

Security is a primary example where this would be helpful, but other things like user preferences, etc. would also be handy to have in a context object once they have been looked up and/or calculated.

Thanks

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

No branches or pull requests

2 participants