[mercury-users] Question

Juergen Stuber juergen at mpi-sb.mpg.de
Tue Aug 24 19:06:02 AEST 1999


Fergus Henderson <fjh at cs.mu.OZ.AU> writes:
>
> On 23-Aug-1999, Juergen Stuber <juergen at mpi-sb.mpg.de> wrote:
> > Fergus Henderson <fjh at cs.mu.OZ.AU> writes:
> > > > > But the compiler complains about the type of X not being func(A) = B.
> > > > > Am I doing anything wrong? 
> > > > 
> > > > I think automatic currying doesn't apply here, so you have to
> > > > do it explicitly.
> > > 
> > > That's correct.
> > 
> > After thinking a little bit more about it, I'm almost convinced
> > that this is a bug.
> 
> It's not a bug.  That is, the design was deliberately chosen,
> with a reasonable understanding of its implications, and the
> implementation correctly implements that design; you may of course
> disagree about whether or not it was a good design.

Since it is syntactic sugar anyway, I don't think it is very important.

> > Why should `Double = scalar_product([2])' be handled differently
> > from `FY = F(Y)' when `F' is a binary function?

> The other question is about the rationale for that language design choice:
> why did we choose this design?  Why should the language be defined in a way
> that causes `Double = scalar_product([2])' to be handled differently from
> `FY = F(Y)' when `F' is a binary function?  The answer to this one is that
> the former is easier to type than the latter.  The expression
> `Double = scalar_product([2])' has a finite number of possible type
> assignments (generally only one, unless some of the symbols involved
> are overloaded), whereas if `FY = F(Y)' were allowed to supply only some
> of `F's arguments, rather than all of them, then the expression `FY = F(Y)'
> would have an infinite number of different possible type assignments.
> Supporting that kind of thing would significantly complicate the type
> checker.

This is because apply is overloaded to take an arbitrary number of arguments.
If everything were curried in the first place (like in ML or Haskell) and
F(X1,...,Xn) were just syntactic sugar for (...((F(X1))(X2))...(Xn))
then this wouldn't be a problem, or would it?

Jürgen

-- 
Jürgen Stuber <juergen at mpi-sb.mpg.de>
http://www.mpi-sb.mpg.de/~juergen/
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list