[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Keith Price <price@usc.edu>: &Rest failure]



    Date: Wed, 8 May 91 10:59:07 PDT
    From: price@usc.edu (Keith Price)


    Does the following behavior make any sense?  It doesn't make any sense to me.

Yes, it does.  It seems that you have momentarily forgotten that on
Symbolics machines, &rest conses on the stack.  Thus, you should not
return the &rest arg but a copy of it because the &rest list will likely
contain garbage after returning from the function.

Example:

Command: (defun test (a &rest b) (copy-list b))
TEST
Command: (test 1 2 3)
(2 3)

For further info, see the documentation section "Safety of &REST
Arguments".

    We ran the following simple test on the original 8.0 world in order to see if
    it was something we did.  It behaves the same on a 3650, 3675, 3645.  We have
    no XL machines.

    Basically, &rest does not seem to work on defun.  (It works on defmacro.)
    This is strange to us since we have many other uses of &rest in defuns that
    work, but today no new compiles or definitions seem to work.

    The following is the screen output from the fresh base 8.0 world:
    D,#TD1PsT[Begin using 006 escapes](1 0 (NIL 0) (:SWISS :BOLD :NORMAL) "HL12B")This Lisp world has not been configured for use at the local site.
    0 1Certain operations will not work correctly until this is done.
    0 1Please read the Software Installation Guide for information on
    0 1using the Set Site command to configure your Lisp machine.
    0Note:  Servers are currently disabled.

    Please login.
    Command: (si:login-to-sys-host)
    NIL
    Command: (defun test (a &rest b) b)
    TEST
    Command: (test 1 2 3)
    (#:TERMINAL-IO-SYN-STREAM NIL #<LOCATIVE 144264073> . #<DTP-COMPILED-FUNCTION (:INTERNAL GPRINT:PRINT-OBJECT 0) 463724053>)
    Command: 


	    Keith Price
	    price@usc.edu