User defined operators

Alex Martelli aleax at aleax.it
Tue Feb 25 08:18:08 EST 2003


Gilles Lenfant wrote:

> "Alex Martelli" <aleax at aleax.it> a écrit dans le message de news:
> pCI6a.312962$AA2.11837273 at news2.tin.it...
>> Turhan Ozen wrote:
>>
>> > Why it is not allowed to create a new operator but only modify the
>> > existing ones?
>>
>> The few languages that allow users to define new operators typically
>> need complicated infrastructure to allow precedence and associativity
> 
> Do you really think that Forth has a complicated infrastucture (some 10Kb
> for the kernel) ?

Not at all (I still recall with fondness my "Jupiter Ace" home computer,
whose Forth took far less than 10 KB -- it only had 8 KB of ROM for
everything) -- but, like Lisp's S-expressions, the way Forth lets you
"define new operators" is by making no distinction between operators and
functions, and having no concept of precedence and associativity.


> Okay, Forth syntax is not for newbies :-)

Actually, even though by the time I got my Ace (in '81 I think) I was
not a computing newbie any more, I think I'd have had an easier time
using it as a newbie than I had actually learning Fortran instead --
the trick, I believe, lied in being an aficionado of HP calculators
(and HP calculators were what I always managed to wheedle from my
parents throughout my time as a student -- their RPN simply left those
wimpish parentheses-using calculators in the dust -- funny, then, that
my first job was later at TI, but, I digress;-).

Problem with RPN is just that it doesn't scale up well to large,
readable programs.  But with 1KB of RAM avalable for user programs
in the Jupiter Ace, and even less on HP calculators, that was
hardly a problem, and every byte's saving was welcome.


Alex





More information about the Python-list mailing list