-
Notifications
You must be signed in to change notification settings - Fork 14
Closed
Description
We don't currently have a notion of "public" functions.
In the spec, "main" is defined as the "entry point", but surely there are cases where the HUGR is a library and some subset of the top-level functions are "public".
The notion of publicity is important at least for:
- removing unused functions (a public function and all it's transitive callees should not be deleted)
- dataflow analysis (for a public function we cannot assume we know all callsites)
Maybe a FuncDecl
is public, or maybe it is a private alias to a public function. It's not clear to me when the publicity of a FuncDecl would matter. (I suppose when deleting unused functions?
LLVM has the concept of "linkage" which contains this binary notion of publicity. Linkage has lots of details allowing it to model weak symbols etc.
We could:
- add a
public: bool
field toFuncDefn
, - establish a convention where
hugr.public: true
metadata means public. - leave it unspecified, anything that cares should take a set of nodes identifying all public funcs.
Metadata
Metadata
Assignees
Labels
No labels