2016-02-12 20:47:00 |
Richard M Kreuter |
description |
Once upon a time, SB-CLTL2:PARSE-MACRO returned a lambda expression, but more recently it returns a NAMED-LAMBDA [1]. (It also appears to have sprouted a second return value too.) This both disagrees with Steele [2] and is arguably a new way to break formerly portable code walkers that use SB-CLTL2. ("Arguably" because such code walkers would have to handle NAMED-LAMBDA in other macros' expansions, but now they need to do so in more places.)
This probably happened in commit a86cac2825c24fc8f2c3bd01f7d0860bb71512c7, though SB-INT:MAKE-MACRO-LAMBDA was introduced in b336bb2495b3addeb7708e811bb694328584a83a.
Anyway, in order to revert SB-CLTL2:PARSE-MACRO to its old result, it looks like it might suffice to return `(lambda ,(cddr (make-macro-lambda ...))), but I'm not sure.
(See also https://bugs.launchpad.net/sbcl/+bug/310097 for another report involving NAMED-LAMBDA; as in that case, it'd be friendlier for portable code walkers if SBCL offered a macroexpansion of NAMED-LAMBDA that didn't use implementation-dependent forms.)
[1] # Once...
$ ./run-sbcl.sh --no-userinit
(running SBCL from: .)
This is SBCL 1.2.11.0.sbcl-1.2.11.70-53fc0ef, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (require :sb-cltl2)
("SB-CLTL2")
* (sb-cltl2:parse-macro 'foo () ())
(LAMBDA (#:WHOLE536 #:ENVIRONMENT537)
(DECLARE (IGNORE #:ENVIRONMENT537))
(LET* ()
(DECLARE (MUFFLE-CONDITIONS CODE-DELETION-NOTE))
(LET ((#:ARGS539 (CDR #:WHOLE536)))
(UNLESS (SB-INT:PROPER-LIST-OF-LENGTH-P #:ARGS539 0 0)
(SB-KERNEL::ARG-COUNT-ERROR 'SB-CLTL2:PARSE-MACRO 'FOO #:ARGS539 'NIL 0
0)))
(LET* ()
(BLOCK FOO))))
# Some old version I had handy:
$ ./run-sbcl.sh --no-userinit
(running SBCL from: .)
This is SBCL 1.3.2.69-aff4a0f, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (require "SB-CLTL2")
("SB-CLTL2")
* (sb-cltl2:parse-macro 'foo () ())
(SB-INT:NAMED-LAMBDA "FOO"
(#:EXPR #:ENV)
(DECLARE (SB-C::LAMBDA-LIST NIL))
(DECLARE (IGNORE #:ENV))
(SB-C::NAMED-DS-BIND (:MACRO FOO . SB-CLTL2:PARSE-MACRO)
NIL
(CDR #:EXPR)
(BLOCK FOO)))
NIL
[2] http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node102.html |
Once upon a time, SB-CLTL2:PARSE-MACRO returned a lambda expression, but more recently it returns a NAMED-LAMBDA [1]. (It also appears to have sprouted a second return value too.) This both disagrees with Steele [2] and is arguably a new way to break formerly portable code walkers that use SB-CLTL2. ("Arguably" because such code walkers would have to handle NAMED-LAMBDA in other macros' expansions, but now they need to do so in more places.)
This probably happened in commit a86cac2825c24fc8f2c3bd01f7d0860bb71512c7, though SB-INT:MAKE-MACRO-LAMBDA was introduced in b336bb2495b3addeb7708e811bb694328584a83a.
Anyway, in order to revert SB-CLTL2:PARSE-MACRO to its old result, it looks like it might suffice to return `(lambda ,@(cddr (make-macro-lambda ...))), but I'm not sure.
(See also https://bugs.launchpad.net/sbcl/+bug/310097 for another report involving NAMED-LAMBDA; as in that case, it'd be friendlier for portable code walkers if SBCL offered a macroexpansion of NAMED-LAMBDA that didn't use implementation-dependent forms.)
[1] # Once...
$ ./run-sbcl.sh --no-userinit
(running SBCL from: .)
This is SBCL 1.2.11.0.sbcl-1.2.11.70-53fc0ef, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (require :sb-cltl2)
("SB-CLTL2")
* (sb-cltl2:parse-macro 'foo () ())
(LAMBDA (#:WHOLE536 #:ENVIRONMENT537)
(DECLARE (IGNORE #:ENVIRONMENT537))
(LET* ()
(DECLARE (MUFFLE-CONDITIONS CODE-DELETION-NOTE))
(LET ((#:ARGS539 (CDR #:WHOLE536)))
(UNLESS (SB-INT:PROPER-LIST-OF-LENGTH-P #:ARGS539 0 0)
(SB-KERNEL::ARG-COUNT-ERROR 'SB-CLTL2:PARSE-MACRO 'FOO #:ARGS539 'NIL 0
0)))
(LET* ()
(BLOCK FOO))))
# Some old version I had handy:
$ ./run-sbcl.sh --no-userinit
(running SBCL from: .)
This is SBCL 1.3.2.69-aff4a0f, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (require "SB-CLTL2")
("SB-CLTL2")
* (sb-cltl2:parse-macro 'foo () ())
(SB-INT:NAMED-LAMBDA "FOO"
(#:EXPR #:ENV)
(DECLARE (SB-C::LAMBDA-LIST NIL))
(DECLARE (IGNORE #:ENV))
(SB-C::NAMED-DS-BIND (:MACRO FOO . SB-CLTL2:PARSE-MACRO)
NIL
(CDR #:EXPR)
(BLOCK FOO)))
NIL
[2] http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node102.html |
|