[m-dev.] 0.13 release: op/3 syntax
Peter Schachte
schachte at csse.unimelb.edu.au
Fri Mar 3 11:59:29 AEDT 2006
Hi Doug and interested Mercurians,
I suggest we separate this discussion into two separate debates:
1) Should the Mercury language support user-extensible syntax?
2) If so, how?
And since the second question is predicated on an affirmative answer
to the first, I suggest we confine ourselves to the first until some
consensus emerges.
My argument in favor of user-extensible syntax is:
a) Users want it; operators have been pretty popular in
Prolog.
b) `op` doesn't support prefix and postfix operators,
different associativities, or different precedences. And
besides, it's dog ugly.
c) Beauty matters. Sometimes a judiciously defined operator
can make code or data much more readable.
d) Mini-languages can be quite useful. Eg, DCGs are a really
useful langauge feature. Often these can be made much more
readable with operators..
e) A language should be kept as small and simple as possible,
with as much as possible relegated to the library. But the
library shouldn't have priviledged access to the language;
adding something to the library should never lead someone
to introduce new operators to the language.
f) Users should be empowered as much as possible. The
language should make it as easy as possible for users to
extend it.
Sure, users can abuse operators. But there are lots of language
features that can be abused *cough* impurity *cough*; by itself that's
not a sufficient reason to reject a feature. And sure, operators can
make it harder to take an extract of a module out of context and
understand it. But it's always difficult to understand a part of a
module out of context. To understand any piece of code, you need to
understand the predicates and functions that it invokes, including the
types and order of arguments. Operators at worst also mean you need
to understand how they can be used as operators (of course, you don't
have to use the operators, but you may have to read them in someone
else's code). But they may also mean you have *less* to learn, and
make it easier to understand an extract out of context, since they may
permit use of a more familliar notation.
--
Peter Schachte Victory attained by violence is tantamount to a
schachte at cs.mu.OZ.AU defeat, for it is momentary.
www.cs.mu.oz.au/~schachte/ -- Mahatma Gandhi
Phone: +61 3 8344 1338
--------------------------------------------------------------------------
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