Open ngeiswei opened 1 year ago
JIT type checking is related to (yet different from) #177 , because when we have a dependently typed function, e.g. (-> (: $t $T) $T)
its "real" (JIT) type will depend on the type of the fed argument. For the same reason, it might be relevant to #183 , and also to #181 , which could be solved by JIT types. Thus, it seems that JIT type checking can be an important component to solve different issues.
A simple program synthesis experiment reveals the need for a form of Just-In-Time type checking.
The following metta code tries all possible ways to serially compose two unary functions
f
andg
:However, although only one composition is valid
(. g f)
, it outputsMoving
superpose
outside of the composition operators makes it clear that the it is due to the lack of dynamicity of the type checker. For instance, the followingoutputs
which is what we want.
Replacing
superpose
with non-determinism via over-definition leads to the same result. For instance:outputs
Finally, although that might be a separate issue, one may notice that
outputs
instead of