[m-dev.] for review: improvements for record syntax
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Dec 5 23:02:06 AEDT 2000
On 05-Dec-2000, Peter Schachte <schachte at cs.mu.OZ.AU> wrote:
> On Tue, Dec 05, 2000 at 02:51:34PM +1100, Fergus Henderson wrote:
> >
> > I do have one significant issue with this change, though: I don't
> > particularly like the order in which the transformation puts the
> > arguments. In particular, IMHO would be more natural to make `A = A0
> > ^ field(B, C) := D' compile to 'field :=' (A0, B, C, D, A) or perhaps
> > 'field := '(B, C, D, A0, A), rather than to 'field :=' (B, C, A0, D, A)
> > as (I think) is the case with the diff that you posted.
>
> I thought 'field :=' was supposed to be a function, not a predicate.
Yes, it is. My mistake.
> 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 Siman choose?
Simon chose (2).
I'm with Ralph in preferring (1).
> Anyway, if we pick policy (1), then W ^ f(X, Y) := Z could sensibly
> translate to either (1a) 'f :='(W, X, Y, Z) or (1b) 'f :='(Z, W, X, Y). For
> policy (2), either (2a) 'f :='(Z, X, Y, W) or (2b) 'f :='(X, Y, W, Z) would
> make sense. (1a) has the virtue of keeping the variables in the order they
> appear in the expression, which may be a bit easier to keep straight when
> you're coding these functions.
Yes. That's why I prefer (1a).
> (2b) is simple because ^ just applies the
> closure on the right to the argument on the left, and := just transmogrifies
> the function from f to 'f :=' and adds an extra argument on the end. The
> other two seem a bit odd to me.
>
> > For example, I think it would be more natural to transform
> > "Map = Map0 ^ elem(K) := V" to "'elem :=' (Map0, K, V, Map)",
> > not "'elem :=' (K, Map0, V, Map)",
>
> Shouldn't that be "Map = 'elem :='(K, Map0, V)", which would be policy
> (1a)?
Yes, that is what I meant to say, or at least what I would have
meant to say if I knew what I was talking about ;-)
--
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