Quick question : generated functions and later defined functions


it says " generated function cannot call any method that was not defined prior to the definition of the generated function itself."

Is there a way to go beyond this? like including the later defined methods in the dispatch without using them in the generated expression.

Is this related to world age problem? And if so why Base.invokelast doesn’t work.


This package: https://github.com/NHDaly/StagedFunctions.jl is trying to get around that restriction.

1 Like

How is it trying to that? Do you know, GitHub page doesn’t have much info.

You write an abstract interpreter that itself is pure, but can return an total description of both the result and the methods needed to derive it.

so basically, what if I apply Core._apply_pure , it should solve my problem? Huh?

That can never be right as that function isn’t valid to use (outside of the compiler itself), but I can’t speak to the quality of any particular implementation. I’m just saying what you would need to implement.

1 Like