[m-dev.] Why does the language insist on explicit lambdas?

Ralph Becket rbeck at microsoft.com
Fri May 11 03:27:47 AEST 2001


I posted a whinge about the error concerning the following 
not being valid code to the bugs list:

:- module foo.
:- interface.

:- func foo(func(A, B, C) = Z, A, B, C) = Z.

:- implementation.

foo(F, A, B, C) = foooo(F(A), B, C).

:- func foooo(func(B, C) = Z, B, C) = Z.

foooo(F, B, C) = F(B, C).

The language requires that we instead write

foo(F, A, B, C) = foooo((func(X, Y) = F(A, X, Y)), B, C).

This seems unnecessarily cumbersome to me.  I'm not asking
the compiler to do any higher order mode inference or
anything like that: it has all the information it needs to
construct the closure (my particular bug was in pred based
code where all the types and modes were explicitly listed),
but for some reason the reference manual says that ain't 
going to happen.  I've had a look through 
compiler/higher_order.m, but couldn't find any explanation 
for the restriction.

Is this restriction really necessary or is it just a matter
of getting round to making the compiler do the deed?

Cheers,

Ralph
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list