-
Notifications
You must be signed in to change notification settings - Fork 7
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
Can you LoadConstant a FuncDefn? #829
Comments
Indeed there is nothing in the spec at the moment to prevent a We've suggested on #285 that we might change Static edges into two kinds - static values (from Consts), and function values (from FuncDefns). I think this would solve the problem here (as well as allowing to simplify the Type hierarchy so that all functions are monomorphic). It would require that we kept Const nodes containing Hugrs, however, I think these could be Tierkreis-extension CustomConsts (and CallIndirect in the Tierkreis extension too); the spec of how to link these Hugrs-inside-Consts can then be left to the Tierkreis extension too (whereas ATM that belongs in the main spec and is missing). Re. scoped definitions, these were included so that rewrites (adding new Defns) could be kept local, rather than having to add FuncDefn's into a global table. I don't think we want to change that (@ss2165 ?). However, I think it's reasonable to have a rule about nonlocal edges, i.e. that the nodes that nonlocal Value edges may enter (i.e. the nodes that are hierarchy-ancestors of the target but not the source) be limited to DFG, Conditional, TailLoop, CFG, BasicBlock -- that is, no Defns (edges into graphs inside Consts are already ruled out). |
For now you can't. This means that there is no means to pass a FuncDefn to a higher order function.
One does have an alternative, to define the to-be-LoadConstant-ed FuncDefn in a Const node, and to LoadConstant that. One expects the result of this would be for frontends to never generate FuncDefns when they had the choice.
#788 describes a related problem, whether non-local edges can enter FuncDefns and if so, what the semantics of that are.
Suggested changes:
The text was updated successfully, but these errors were encountered: