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

higher order functions #870

Open
schlichtanders opened this issue Dec 9, 2024 · 1 comment
Open

higher order functions #870

schlichtanders opened this issue Dec 9, 2024 · 1 comment

Comments

@schlichtanders
Copy link

In combination with HTTP.jl middleware is defined as a function returning a function, i.e. what is called a higher order function.

If I get it right, then Revise.jl does not support revising such usecases yet, i.e. when calling auth_middleware(router) and auth_middleware being like auth_middleware(handler) = function(request::HTTP.Request) ... end.

If something inside the return function of auth_middleware changes, then it does not seem to be revised (despite HTTP.listen! calls Base.invokelatest.

Is this description correct? Maybe I am confused because of different aspects. If it is correct is there already a workaround to revise the functions returned by higher order functions?

@timholy
Copy link
Owner

timholy commented Dec 28, 2024

If I understand correctly, this is an issue about "data". Any values returned by code are "data," even if those data are functions. You have to regenerate valid data if you revise in ways that would change the returned data. For example:

mycode() = 1
result = [mycode()]
# Now edit mycode() to return 2

This does not update result: you have to recompute it manually.

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