Robert Dodier <robert.dodier at gmail.com> writes:
> On 1/11/12, Rupert Swarbrick <rswarbrick at gmail.com> wrote:
>
>> Grepping shows it declared special in src/fortra.lisp. I haven't looked
>> further into why.
>
> Well, the Fortran code changes the usual [ ] for array subscripts
> to ( ), that's why LB and RB are special.
>
> Thanks for sending the patch, but I've taken the simpler approach
> of just changing LB and RB to *LB* and *RB*, respectively;
> to the extent that other stuff changes, it makes it harder to see
> what is the purpose of the patch.
>
> What puzzles me about this problem is that LB is used in a
> lexical binding in share/linearalgebra/lu.lisp, but it affects the
> special variable by the same name -- I thought a declaration
> would be required in lu.lisp to cause that. What's going on there?
No, I don't think so. Consider the following:
(defun print-to-stdout (x) (princ x *standard-output*))
(with-output-to-string (*standard-output*)
(print-to-stdout "Hello world")
(values))
More convoluted and more similar to the original:
(with-output-to-string (strm)
(let ((*standard-output* strm))
(print-to-stdout "Hello world")
(values)))
has the same effect. I've just been staring at CLHS and can't find the
relevant passage unfortunately. I think I want to say something like
"LET binds a variable X to a new lexical binding, unless it already had
a dynamic binding in which case it binds it dynamically", but I'm not
sure where to look.
Re the patch, part of the reason I renamed the variables was to make the
names more unambiguous. Maybe at least a docstring on the two defvars
would be nice?
Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20120111/267fc72c/attachment.pgp>