[m-dev.] Syntactic sugar for functor matching

Ralph Becket rafe at cs.mu.OZ.AU
Wed Oct 31 16:07:40 AEDT 2001


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, ...) :- ...

or something similar (I am aware that overloading `/' this way is
probably not a good thing.)

On the other hand, this is perhaps just too infrequent a "problem" to
worry about.

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