-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
In Noir's compiler, function types carry around an 'environment' that describes the things that are captured by the function type. This is particularly relevant for lambdas.
At the moment, we do nothing with this, carrying the information through the analysis phase for as long as possible before dropping it during syntax print. We could potentially make some use out of this, as—in combination with the types of the function arguments—we could use it to determine whether an arbitrary callable is pure. If it captures only non-references and takes no mutable references, then it is pure.
To add support for this, we would need to:
- Add support in the type syntax for it (e.g.
λ[e,*](arg,*) -> Ret). - Add support in the Lambda syntax for it (e.g.
fn[e,*](arg,*): Ret := expr). - Output this new syntax in the extractor.
- Add support for it in the
Tp.fnconstructor (e.g.Tp.fn (env : List Tp) (args : List Tp) (outTp : Tp)). - Add support for it in the
Expr.lamconstructor in a similar vein.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request