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

Simon Taylor stayl at cs.mu.OZ.AU
Tue Aug 15 16:15:24 AEST 2000


> On Mon, Aug 14, 2000 at 02:24:03PM +1000, Simon Taylor wrote:
> > 
> > > On 12-Aug-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > > > The change allows (or at least I think it should allow) other uses for
> > > > the symbols, so long as you specify the types enough to ensure that
> > > > type inference can resolve any ambiguities.
> > > 
> > > Would it be acceptable to only accept the brace syntax as syntax for
> > > tuples if you have imported the appropriate module (say `tuple')?
> > > 
> > > That way if you are keen on using {...} for set syntax, you can avoid
> > > using the tuple module (or :- use_module it, so you require module
> > > qualification if you do use it). 
> > 
> > I don't think that would work well. Terms with functor
> > `{}' can have any arity, so you couldn't write the set
> > constructor function in Mercury.
> 
> That's ok.  You'd have to write something like {[1,2,3]}, which should be
> read as '{}'([1,2,3]).  Then you could write a function {list(T)} = set(T) is
> det.  Not as pretty as without the square brackets, but still better than
> list_to_set([1,2,3]).

Some other reasons why this isn't a good idea:

1) It's inconsistent with how the other builtin constructors
are handled.

2) Gratuitous overloading like that should be avoided. If the
typechecker can't resolve the overloading, you probably should
add an explicit type qualification.

3) Why does set construction need special syntax?

Simon.

--------------------------------------------------------------------------
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