[mercury-users] discriminated union question
Ralph Becket
rbeck at microsoft.com
Thu Apr 19 00:33:48 AEST 2001
> "Ralph Becket" <rbeck at microsoft.com> wrote:
> I've been meaning to change the definition for pair to
> use {}/2 tuples
> and replace -/2 over pairs with a function with the
> appropriate set of
> modes. pair/2 does crop up in several places in the
> library, but I'd
> encourage people to move to the new tuple types where possible.
>
> Erlang uses {Key,Value} for pairs rather than Prolog's Key-Value.
> It's probably the single UGLIEST thing in Erlang.
>
Well this one's open to debate. Last time I suggested carrying out
the change the only people who expressed an opinion supported the
idea.
> An important advantage of the (-)/2 pair constructor is that it is
> *different* from generic tuples. It would be a great pity to
> lose that.
It's not clear to me what the advantage is. Perhaps it would be
sensible
to use -/2 to denote key-value pairs, but in that case I think the pair
type should be renamed as such.
The change I was suggesting would still support -/2 for pairing and
pattern matching, the only difference being that pairs would actually
be {}/2s and we could take back fst/1 and snd/1 for tuples.
-- Ralph
--------------------------------------------------------------------------
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