#268 write function don't binds all print-variables

closed-invalid
clisp (525)
5
2005-09-06
2005-09-05
No

I think following code should unbind *print-length*
after exiting from "write" and print 10, but actually
CLISP prints 50.
I have tested it with LispWorks - that implementation
binds/unbinds all *print-* vars to their value if key
argument absent. That logic better, because it
protects vars from changes inside a custom print-
object functions

(defclass c () (f))

(defmethod print-object ((x c) s)
(setq *print-length* 50) (print "print-object"))

(progn
(setq *print-length* 10)
(write (make-instance 'c) )
(print *print-length*)
)

Discussion

  • Sam Steingold

    Sam Steingold - 2005-09-05

    Logged In: YES
    user_id=5735

    I do not see a requirement that the non-supplied keyword
    parameters effect a binding:

    http://www.lisp.org/HyperSpec/Body/fun_writecm_p_rintcm_princ.html
    For each explicitly supplied keyword parameter named in the
    next figure, the corresponding printer control variable is
    dynamically bound to its value while printing goes on; for
    each keyword parameter in the next figure that is not
    explicitly supplied, the value of the corresponding printer
    control variable is the same as it was at the time write was
    invoked.

     
  • Sam Steingold

    Sam Steingold - 2005-09-06

    Logged In: YES
    user_id=5735

    This bug report is now marked as "pending"/"invalid".
    This means that we think that the problem you report
    is not a problem with CLISP.
    Unless you - the reporter - act within 2 weeks,
    the bug will be permanently closed.
    Sorry about the inconvenience -
    we hope your silence means that
    you agree that this is not a bug in CLISP.

     
  • Sam Steingold

    Sam Steingold - 2005-09-06

    Logged In: YES
    user_id=5735

    note that it does not make any sense to require binding for
    non-supplied keyword parameters: that does not affect the
    relevant behavior while increasing the stack use, which is
    especially important given the highly recursive nature of
    the lisp printer

     
  • Sam Steingold

    Sam Steingold - 2005-09-06
    • status: open --> pending-invalid
     
  • Sergey Pavlov

    Sergey Pavlov - 2005-09-06
    • status: pending-invalid --> closed-invalid
     
  • Sergey Pavlov

    Sergey Pavlov - 2005-09-06

    Logged In: YES
    user_id=315000

    Yes, I agree with you.

    I just seen CMU-CL's "write" implementation before:

    (defun write (object &key
    ((:escape *print-escape*) *print-
    escape*)
    ((:radix *print-radix*) *print-radix*)
    ...
    ===============================

    but now I think it is because simplest method to
    implement "write" on Lisp language. To selective bind it
    is necessary to use "PROGV" form, which produces many
    conses.
    Thanks for answer.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks