-
Notifications
You must be signed in to change notification settings - Fork 14
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
Evidence Monomorphization #229
Conversation
There is still some way to go, but good news first: triples can be successfully monomorphized in the Chez-lift backend:
The important part to look at is |
Still not fully working since we need to elaborate state correctly.
Recursive mono
We just looked at it together. There are a few limitations and open issues:
Otherwise, we agreed to merge this. I'll go over it once more and then merge regardless of the missing things (TM). |
// e.g. state(init) { (ev){x: Ref} => ... } | ||
case Var(init: Expr, body: Block.BlockLit) | ||
case Get(id: Id, ev: Evidence, annotatedTpe: ValueType) | ||
case Put(id: Id, ev: Evidence, value: Expr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact that Get
and Put
have an id : Id
confused me a lot. These should be Expr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right -- for regions it could be general expressions. For local variables it is always just names.
In the source language this will always be names. How would you read from / write to a more complicated variable expression?
For example
f(x) = 3
is not wellformed, it needs to be:
var z ...;
z = 3
Of course, we could in principle generalize here, but I don't see the value of that, yet.
If we would generalize, then it would be a block
, not an expr
, no? References ought to be second-class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Long story short: References are not (yet) first (second) class citizens.
@CodiumAI-Agent /review (good luck ;) ) |
PR Analysis
PR Feedback
How to use
|
This is still a WIP.
Right now there is a problem: for every different flow type we generate a fresh nominal type.
So, when we generate different types for the parameter of a function and for the argument at the call site, it is not surprising that we cannot call the function :)
As an example, here is the generated scheme code:
Note that at the callsite we create a
make-Function_940
, but at the definition site we use the accessorapply0_943
which belongs to a different function type.This is not so clearly visible in the lifted/monomorphized core, since there the functions and selectors do not print unique ids:
We either need to rely on structural subtyping of the target, or insert coercions manually...