[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
destructuring-bind doesn't handle &optional (arg 'default)
From: |
Kalle Olavi Niemitalo |
Subject: |
destructuring-bind doesn't handle &optional (arg 'default) |
Date: |
14 Apr 2001 12:41:48 +0300 |
In GNU Emacs 20.7.2 (i386-debian-linux-gnu, X toolkit)
of Fri Apr 13 2001 on PC486
configured using `configure i386-debian-linux-gnu --prefix=/usr
--sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib
--infodir=/usr/share/info --with-pop=yes --with-x=yes --with-x-toolkit=yes'
In defmacro*, optional arguments with default values work as expected:
ELISP> (require 'cl)
cl
ELISP> (defmacro* kon-test (&optional (arg 'default))
`',arg)
kon-test
ELISP> (kon-test)
default
ELISP> (kon-test foo)
foo
However, the corresponding `destructuring-bind' form signals an error:
ELISP> (destructuring-bind (&optional (arg 'default))
'()
arg)
*** Eval error *** Symbol's value as variable is void: bind-enquote
ELISP> (destructuring-bind (&optional (arg 'default))
'(foo)
arg)
*** Eval error *** Symbol's value as variable is void: bind-enquote
I expected the first expression to return `default' and the
second to return `foo', like with the macro. If I bind
`bind-enquote' around the form, it works (in interpreted code):
ELISP> (let ((bind-enquote nil))
(destructuring-bind (&optional (arg 'default))
'()
arg))
default
ELISP> (let ((bind-enquote nil))
(destructuring-bind (&optional (arg 'default))
'(foo)
arg))
foo
Thus I believe `bind-enquote' should be added in the list of
variables bound by the `destructuring-bind' macro.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- destructuring-bind doesn't handle &optional (arg 'default),
Kalle Olavi Niemitalo <=