On Sun, Mar 8, 2009 at 2:22 PM, Dominique Quatravaux <[email protected]> wrote:
> Also
> worth mentioning is that in OCaml, curry notation introduces some
> typing shenanigans that quite squarely violate the principle of least
> astonishment, see
> http://caml.inria.fr/resources/doc/faq/core.en.html#eta-expansion
> (although whether that particular problem also occurs in BitC's type
> system is miles beyond my understanding).

Because BitC doesn't have currying, the only way you can write that
example in BitC is to write the implied lambda explicitly:

(let ((map_id (lambda (l) (List.map (lambda (x) x) l))))
   ...)

Somewhat perversely, the rewriting strategy that I had in mind would
operate by noticing that List.map was missing an argument, and
therefore auto-inserting this lambda. I had not considered the fact
that this rewrite changes the nature of the polymorphism by deferring
the application.

The moral of this story, such as it is, is that let-polymorphism is
full of surprises. This certainly isn't the only one.

But OK, I think I am now convinced that the most I should do in the
direction of currying is use a syntax that might easily admit it later
-- and perhaps I should not even do that much.

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

Reply via email to