[ clisp-Bugs-3517196 ] #'apply reacts differently to dotted list when compiled

SourceForge.net <[email protected]>
Newsgroups gmane.lisp.clisp.devel
Message-ID <[email protected]>
Bugs item #3517196, was opened at 2012-04-12 06:23
Message generated for change (Comment added) made by haible
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=101355&aid=3517196&group_id=1355

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: clisp
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Bill Evans (mariposabill)
Assigned to: Bruno Haible (haible)
Summary: #'apply reacts differently to dotted list when compiled

Initial Comment:
My abject apologies if this is a feature, not a bug.

If I (apply #'something 5 6 (append NIL "X")), where #'something begins with "defun something (a b &rest pieces)", then within #'something, (type-of pieces) will be either NULL (if the lisp program is interpreted) or (SIMPLE-BASE-STRING 1) (if the lisp program is compiled).  Granted, I shouldn't be doing that, but ...

=== platform:
Linux tiger 2.6.32-5-686 #1 SMP Tue Mar 8 21:36:00 UTC 2011 i686 GNU/Linux
=== glibc version:
GNU C Library (Debian EGLIBC 2.11.2-10) stable release version 2.11.2, by Roland McGrath et al.
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.4.5.
Compiled on a Linux 2.6.32 system on 2011-01-23.
Available extensions:
        crypt add-on version 2.1 by Michael Glad and others
        GNU Libidn by Simon Josefsson
        Native POSIX Threads Library by Ulrich Drepper et al
        BIND-8.2.3-T5B
For bug reporting instructions, please see:
<http://www.debian.org/Bugs/>.
=== clisp version:
GNU CLISP 2.49 (2010-07-07) (built 3543225158) (memory 3543225458)
Software: GNU C 4.4.5 
gcc -g -O2 -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type -Wmissing-declarations -Wno-sign-compare -Wno-format-nonliteral -O2 -fexpensive-optimizations -falign-functions=4 -DENABLE_UNICODE -DDYNAMIC_MODULES -I.  -lreadline -lncurses -ldl    libgnu_cl.a 
SAFETY=0 HEAPCODES LINUX_NOEXEC_HEAPCODES SPVW_BLOCKS SPVW_MIXED TRIVIALMAP_MEMORY
libreadline 6.1
Features: 
(REGEXP SYSCALLS I18N LOOP COMPILER CLOS MOP CLISP ANSI-CL COMMON-LISP LISP=CL
 INTERPRETER SOCKETS GENERIC-STREAMS LOGICAL-PATHNAMES SCREEN GETTEXT UNICODE
 BASE-CHAR=CHARACTER PC386 UNIX)
C Modules: (clisp i18n syscalls regexp)
Installation directory: /u/home/clisp/bug4/home/lib/clisp-2.49/
User language: ENGLISH
Machine: I686 (I686) tiger.x441afea5.org [10.0.0.1]
=== build details:
I downloaded the currently released version of clisp today (12 Apr 2012) from http://ftp.gnu.org/pub/gnu/clisp/latest.

I built it the normal way, as shown in the attached script.  Placed into its own empty directory, that script downloads the source, builds and installs clisp, and runs the program, first interpreted and then compiled.

----------------------------------------------------------------------

>Comment By: Bruno Haible (haible)
Date: 2012-04-12 08:58

Message:
Confirmed:

> (defun something (a b &rest pieces) (type-of pieces))
> (apply #'something 5 6 (append NIL "X"))
NULL
> (compile 'something)
SOMETHING ;
2 ;
NIL
> (apply #'something 5 6 (append NIL "X"))
(SIMPLE-BASE-STRING 1)

SBCL yields an error in this situation.

In CLHS
http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function
a function is supposed to be "called with zero or more arguments". A dotted
argument list is not foreseen.

Also, in
http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html#apply
the arguments list is defined to be a "spreadable argument list
designator",
"whose last element is a list L2 of length m". This does not allow a dotted
list.

See also CLHS
http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1-3.html
"The value of a rest parameter is permitted, but not required, to share
structure with the last argument to apply."

>From a user's perspective, I think it would be good if clisp would be
changed to emit an error in this case as well, in interpreted mode only.
In compiled mode, which is not designed to do maximum error checking, I
would not change anything.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=101355&aid=3517196&group_id=1355

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.