You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attaching some context from @emilyaherbert how we we can do this:
In general, most generic functions are called without type arguments, so most of the time this check will fail, missing valid cache opportunities.
Right now when type checking a function application, the compiler:
retrieves the function
monomorphizes it
creates an error if an incorrect number of arguments are provided and early exists
type checks the arguments to the function, find the types of the arguments, and simultaneously unifies the types of the arguments with the expected types of the function parameters
Considering that most generic functions are called (and monomorphized) without type arguments, a good high-level design for using the cache might look like:
type check the arguments to the function, collect the types of the arguments
retrieve the function
potentially monomorphize, depending on the type of the arguments and the type arguments themselves
create an error if an incorrect number of arguments are provided and early exist
unify the types of the arguments with the types of the function parameters
This would allow us to use the types of the arguments in monormorphization
The text was updated successfully, but these errors were encountered:
tritao
added
the
compiler: frontend
Everything to do with type checking, control flow analysis, and everything between parsing and IRgen
label
Sep 5, 2022
Attaching some context from @emilyaherbert how we we can do this:
The text was updated successfully, but these errors were encountered: