-
Notifications
You must be signed in to change notification settings - Fork 145
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
WIP: Implement Java Interfaces with Frege Records #363
base: master
Are you sure you want to change the base?
Conversation
--- Wraps an expression into Thunk.lazy, without generics arguments: | ||
--- > Thunk.lazy(expr) | ||
asLazy :: JExpr -> JExpr | ||
asLazy 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.
This is slightly different from frege.compiler.gen.java.Common.lazyJX
. This function doesn't take a JType
. A java compiler can infer the generics of Thunk.lazy
from its argument, so there isn't a need to emit one, or is it?
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 probably so, however, I adopted the policy to not rely on Java type inference if at all possible, as the frege compiler should know the desired types anyway.
Or, to put it differently, if we don't know the types, then we might need to re-consider our code generation model.
Therefore, I prefer having everything explicit in general.
That being said, it is possible that we can avoid some clutter here and there in code generation primitives like "lazyJX". But then we should adopt this in general, not just for some code.
let nativsi = evalStG g $ symInfo nativsym | ||
fldsym <- TreeMap.lookup fldnm irsym.env | ||
pure $ wrapIRMethod g (head args) (tauJT g $ head taus) fldsym fldnm nativsi nativnm | ||
in JNewClass jrty (tail args) x |
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.
head args
here is the IR itself, so it's omitted. args
is ensured to be nonempty in the sanity
function.
So that it is possible to run programs even if some of them failed to compile
This PR is not meant to be merged (yet)!
The ongoing effort to implement the feature #360.
The changes are in
frege/compiler/gen/java/MethodCall.fr
.Cases to consider:
Maybe
tonull
marshallingEither
tothrow
marshalling