[m-dev.] for review: tuples [1]

Peter Schachte schachte at cs.mu.OZ.AU
Fri Aug 11 22:43:12 AEST 2000


On Sun, Aug 06, 2000 at 02:36:59PM +1000, Simon Taylor wrote:
> >     2)  Much more orthodox notation mathematically (Using parentheses for
> > 	tuples is only a little less common than angle brackets; they're
> > 	certainly a *lot* more orthodox than braces).
> Not using parentheses was a deliberate decision so that unary tuples work
> when passed to a predicate which takes a polymorphic argument which is
> expected to be a tuple of any arity. If unary tuples don't work, then the
> arity needs to be passed separately so that the unary case can be handled

Ok, but braces just don't *look* right for tuples.

> >     3)  Doesn't take away the orthodox notation for sets.  It would be nice to
> >         reserve braces for sets at some later time.
> 
> I can't see this being useful. list_to_set([1, 2, 3]) is not that
> much worse than {1, 2, 3}.

Matter of taste, I guess.  I think list_to_set([1, 2, 3]) is much less
readable than {1,2,3}.  Writing {[1,2,3]} wouldn't be too bad, and could be
easily accomplished by defining func {}/1 as an alias for list_to_set.  Or
does your change prevent me from defining {}/1 as a function?  If it does,
this is not a backward compatible change.

How hard would it be to use the obvious syntax for tuples:  < ... > ?  Less
than is not currently a prefix operator, so it wouldn't be a problem.  The
only problem is that greater than is an infix op, so it would be difficult to
tell an infix greater than from the tuple terminator (maybe impossible in some
cases, but I can't think of any).  But I don't think it would be too
unreasonable to specify that if you want to use an infix greater than inside a
tuple, then you have to parenthesize the term.  It's not going to happen very
often, and I think it would be worth it to use angle brackets for tuples
rather than braces.

-- 
Peter Schachte <schachte at cs.mu.OZ.AU>  I'm not afraid of dying, I just don't
http://www.cs.mu.oz.au/~schachte/      want to be there when it happens.
Phone:  +61 3 8344 9166                    -- Woody Allen 
Fax:    +61 3 9348 1184                
--------------------------------------------------------------------------
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