[m-dev.] for review: improvements for record syntax

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Dec 6 11:57:47 AEDT 2000


On 06-Dec-2000, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> Fergus wrote:
> > On 05-Dec-2000, Peter Schachte <schachte at cs.mu.OZ.AU> wrote:
> > > I see two sensible ways to handle `^'.  Given the term W ^ f(X, Y), it could
> > > traslate into either (1) f(W, X, Y) or (2) f(X, Y, W).  Ralph, I believe,
> > > preferred the former; I don't really have a preference.  I didn't look that
> > > closely at the diff, which approach did Simon choose?
> > 
> > Simon chose (2).
> > I'm with Ralph in preferring (1).
> 
> I think it's worth keeping the equivalence between field selection
> and function application.  The only reason they're not completely
> equivalent now is that the compiler doesn't do mode inference for
> higher-order terms.

Do you mean the equivalence `X ^ Y === Y(X)'?
Or in other words '^'(X, Y) === apply(Y, X)?
Note that `^' is not the same as `apply' because the arguments
are in a different order.

With (1) there is an equivalence between field selection
and function application: `X ^ f(...) === f(X, ...)'.
Again the only difference between `^' and `apply' is
the argument ordering.

I don't think the slightly simpler equivalence that you get with (2)
is worth the unnatural argument ordering that is needed with (2).

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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