Closed titzer closed 2 years ago
func.bind
is no longer included in this proposal (now in Post-MVP), but roughly, you'd take the difference after unrolling both types.
If we opt for explicit type annotations, then func.bind
would actually have 2 annotations and a typing rule as follows:
func.bind $t $t' : [t0* (ref null $t)] -> [(ref $t')]`
- iff `unroll($t) = func [t0* t1*] -> [t2*]`
- and `unroll($t') = func [t1'*] -> [t2'*]`
- and `t1'* <: t1*`
- and `t2* <: t2'*`
I just updated the rule in Post-MVP.md to mirror this.
Without full type annotations, $t
would be inferred from the operand.
Closing as answered. Feel free to reopen if there are further questions.
I am having trouble wrapping my head around the intended type rules for
func.bind
. Currently,func.bind
includes a type annotation (call this$ft
) that should reference a signature type. The result of the instruction should beref $ft
. The top of the stack should contain a function reference (let's suppose its type isref null $et
). The difference in parameter arity between$et
and$ft
is the number of arguments that will be bound by this instruction (call thisdiff
).I am trying to understand how to relate the "residual" type (
$et
-diff
) to$ft
.Suppose
diff != 0
Issues come to mind: