Martin Baldan <martino...@gmail.com> writes:

> I have a little off-topic question.
> Why are there so few programming languages with true Polish syntax? I
> mean, prefix notation, fixed arity, no parens (except, maybe, for
> lists, sequences or similar). And of course, higher order functions.
> The only example I can think of is REBOL, but it has other features I
> don't like so much, or at least are not essential to the idea. Now
> there are some open-source clones, such as Boron, and now Red, but
> what about very different languages with the same concept?
>
> I like pure Polish notation because it seems as conceptually elegant
> as Lisp notation, but much closer to the way spoken language works.
> Why is it that this simple idea is so often conflated with ugly or
> superfluous features such as native support for infix notation, or a
> complex type system?

Parentheses allows to read code with less cerebral load than pure Polish
notation.

The problem, even with fixed arity, is that you need to know the arity
of each operator!

With parentheses you don't need to know the arity (and you get variable
arity for free).  This is good for the programmer who can reassign the
brain cells feed by parentheses to something else, (like solving the
programming problem at hand, instead of remembering a dictionnary of
operator and arities, or a table of operator precedence), and this is
good for the program, ie. for macros who can process the code without
knowing anything about the operators (the only thing macros need to know
about operators are:

- are they special operators? (there are a few of them, and for them the
  macro needs to know how to deal with them);

- are they macros? (then the macro can call macroexpand to resolve
  them);

- otherwise they are functions and nothing needs to be known about them,
  since the arity is implicitely given by the parentheses.


So parenthesis-less Polish notation is ok when all your operators are
binary operators, but in programming there are a lot of different
arities, so parenthesized Polish notation is better.



-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.
_______________________________________________
fonc mailing list
fonc@vpri.org
http://vpri.org/mailman/listinfo/fonc

Reply via email to