jlc@sofluc.demon.co.uk (Jonathan) writes:
> Date: Mon, 27 Nov 1995 13:05:37 +0000
> Organization: SofLuc Ltd
> ...
> Sigh! Aaron, you should be forced to write in C++ for a while, and _then_
> you would have reason to complain about tiresome repetition.
Thanks for the tip. I'll try to remain as far away from C++ as I
can.
> Actually, if you want a fast prototyping language, I don't understand why
> you should have to declare any local variables at all (this criticism
> applies equally to lisp and other dynamic languages). The compiler could
> easily notice all the free variables in a procedure and declare them
> as lvars _unless_ they were explicitly declared otherwise.
That would not work for languages like Pop-11 and Scheme where there
is no difference between an identifier holding a procedure as its
value and an identifier holding anything else as its value. For the
vast majority of `free' variables in a typical procedure are names
of procedures defined outside the current procedure, and the above
suggestion would stop them working completely, unless you declared
all procedure names used in procedure P as global to P, which would
be at least as tedious as having to declare lvars.
> Why restrict
> this to input/output? Or did I misinfer from your post (I haven't seen
> more recent poplog versions).
By far the most common use of input and output parameters is to hold
values only for the benefit of the code textually scoped within the
procedure. So it is reasonable for declaration of such things as
lvars to be the default. Occasionally one needs to locally redirect
printing in a procedure that's given a character consumer, in which
case writing
define redirect(...., cucharout, .....);
dlocal cucharout;
...
will do the trick. But that sort of thing is so rare that the lvars
default seems right. One reason we did not do that years ago was
that many people argued that it was better to have access to
variable values at run time for debugging purposes, which is hard
with lvars. But there are now better debugging tools, (LIB DEBUGGER)
and any, with current machine speeds, and the speed of incremental
compilation it is often just as simple and quick to insert trace
printing commands recompile and re-run. I often use temporary
commands of this sort of form
[fred ^fred joe ^joe]==>
for this purpose.
Best wishes.
Aaron
--
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs )
School of Computer Science, The University of Birmingham, B15 2TT, England
EMAIL A.Sloman@cs.bham.ac.uk
Phone: +44-121-414-4775 (Sec 3711) Fax: +44-121-414-4281
|