[m-dev.] Syntactic sugar for functor matching

Tyson Dowd trd at cs.mu.OZ.AU
Wed Oct 31 16:37:44 AEDT 2001


On 31-Oct-2001, Thomas Charles CONWAY <conway at cs.mu.OZ.AU> wrote:
> On Wed, Oct 31, 2001 at 04:07:40PM EST, Ralph Becket wrote:
> > Occasionally one comes across code like this:
> > 
> > p(constructor1(_, _, _), ...)             :- ...
> > p(constructor2(_, _, _, _, _), ...)       :- ...
> > p(constructor3(_, _, _, _), ...)          :- ...
> > p(constructor4(_, _, _, _, _, _, _), ...) :- ...
> > 
> > Which looks rather awkward.  Would there be any merit in extending
> > the language so that one could write
> > 
> > p(constructor1/3, ...) :- ...
> > p(constructor2/5, ...) :- ...
> > p(constructor3/4, ...) :- ...
> > p(constructor4/7, ...) :- ...
> 
> I would argue that Mercury has quite enough syntactic cruft as it is!
> That's not to say that such a feature might sometimes be useful, but
> rather that the language contains lots of crufty syntax already, and
> we would probably be better of migrating to a cleaner syntax.

Why don't you just accuse Ralph of peddling Perl... 

;-)

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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