[m-dev.] Syntactic sugar for functor matching

Peter Schachte schachte at cs.mu.OZ.AU
Thu Nov 1 15:47:54 AEDT 2001


On Thu, Nov 01, 2001 at 03:15:12PM +1100, Michael Day wrote:
> 
> > Solving the problem Fergus is referring to would mean Mercury would have to
> > forbid a type having two constructors with the same name (and different
> > arities).  At least as far as I can see allowing a syntax that doesn't
> > specify the arity but still uniquely determines a constructor seems to mean
> > that the functor name alone must determine the constructor.  But if you're
> > willing to accept that, here's a suggestion.
> 
> Presumably types could still have two constructors with the same name but
> different arity as long as neither of them were used in the pattern
> matching you've described (if aforementioned pattern matching is smart
> enough, anyway).

You could be sophisticated in where you draw the line, such as based on the
names or types of arguments, but there's no way you can unambiguously write
foo[] when the type has two constructors named foo.

-- 
Peter Schachte              There is no statute of limitations on stupidity.
schachte at cs.mu.OZ.AU        -- Randomly produced by a computer program
www.cs.mu.oz.au/~schachte/  called Markov3. 
Phone: +61 3 8344 9166      
--------------------------------------------------------------------------
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