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

Add withWrap / mapWrap methods to endpoint builder #1152

Closed
kubukoz opened this issue Aug 14, 2023 · 3 comments
Closed

Add withWrap / mapWrap methods to endpoint builder #1152

kubukoz opened this issue Aug 14, 2023 · 3 comments
Labels
question Further information is requested
Milestone

Comments

@kubukoz
Copy link
Member

kubukoz commented Aug 14, 2023

Follow-up to #1097 - currently, there are no methods for customizing the wrap method of the endpoint (which is the method that essentially wraps an endpoint input into an operation).

There might be an (arguably obscure) use-case for customizing wrap, so let's consider adding those, or use this ticket to document the reason against that.

Note: this isn't blocking for 0.18 because adding these concrete methods can be done without breaking BC.

@kubukoz kubukoz added the question Further information is requested label Aug 14, 2023
@kubukoz kubukoz added this to the 0.18.0 milestone Aug 14, 2023
@Baccata
Copy link
Contributor

Baccata commented Aug 16, 2023

Can you formulate such a usecase ?

In the meantime, here's my train of thought :

  • A map modifying function would be of the shape I => I
  • The only way to do that "lawfully" (ie without unsafe casts) would be via a SchemaVisitor (or more generically, a PolyFunction[Schema, A =>> A => A])
  • The wrap method's canonical use-site is client-side interpreters, which are written in terms of SchemaVisitors (in part)
  • This kinda indicates that if there is such a transformation needs occurring, a good location for it would probably within the interpreter.

@kubukoz
Copy link
Member Author

kubukoz commented Aug 16, 2023

Can you formulate such a usecase ?

not at the moment, I just wanted to have an issue or discussion as a record of us in case we don't consider this functionality useful ;)

Agree on the next two points. I was thinking in terms of a transformation on a concrete endpoint, but that doesn't seem useful for anything outside of testing with a very specific endpoint.

However, on these:

The wrap method's canonical use-site is client-side interpreters, which are written in terms of SchemaVisitors (in part)
This kinda indicates that if there is such a transformation needs occurring, a good location for it would probably within the interpreter.

I mostly agree but you may not always be writing an interpreter of your own - you might want to wrap an existing one. Having to change a SchemaVisitor means you need to stop wrapping and do the internals yourself. However, this usecase is theoretical enough that I don't really think it's going to be an issue.

@Baccata
Copy link
Contributor

Baccata commented Sep 22, 2023

This layer got an overhaul, the modification of the wrap methods should be easier without the need of specific methods.

As a result, I'm closing this issue.

@Baccata Baccata closed this as completed Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants