On Mon, Feb 16, 2015 at 2:57 PM, William ML Leslie <
[email protected]> wrote:

> I'm a bit uncomfortable with what happens in the case of let-bound
> native-arity-polymorphic case:
>
> let f = choose_one x y z -- different arities​
> in f n m
> ​​
> How do you choose a native arity for the callsite?
>

In a sense, you don't. The arity of f is determined at its definition. In
this case, I cannot tell what it is, because I don't know what the return
value of choose_one is. But it cannot depend on the dynamic branch taken in
choose_one, because this isn't a lazy language.


>   If you say "it's 2", the algorithm is overspecified.  If you say that
> depends on the dynamic branch taken in choose_one, you can CPS transform
> and pass *all three* continuations.
>

I'm not understanding this statement. I'm not sure how a dynamic branch in
choose_one could yield a change in arity.


>    I don't think you want to do that.  Can we adopt a calling convention
> from something like STG or FORTH?
>

No. We need to be able to do the hardware-preferred (or more precisely:
conventional compiler preferred) calling convention.


> Have I misunderstood how you intend to compile this?
>

I suspect so, but I haven't done a very good job of describing it. I'll
attempt to correct that in just a little bit.


shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to