From: Christian Ohler <ohler@gnu.org>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: Lexical binding
Date: Mon, 04 Apr 2011 09:32:27 +1000 [thread overview]
Message-ID: <4D99038B.7060702@gnu.org> (raw)
In-Reply-To: <BANLkTinuJSWn_L6gwrAVEGnWgFkd8Q5Gjg@mail.gmail.com>
On 3/04/11 22:26, Juanma Barranquero wrote:
> On Sun, Apr 3, 2011 at 14:05, Christian Ohler<ohler@gnu.org> wrote:
>
>> In loop destructuring, you can use nil for fields that you want to ignore:
>>
>> (loop for (nil width . nil) in bs-attributes-list
>> if (numberp width) sum width)
>
> Yes, but it is less informative.
>
>> If you want to keep the ignored fields named, you could do something like
>>
>> (loop for (name width . rest) in bs-attributes-list
>> do (progn name rest) ; ignore
>> if (numberp width) sum width)
>
> And this is just ugly.
How about:
(loop for (name width . rest) in bs-attributes-list
do (ignore name rest)
if (numberp width) sum width)
> Anyway, the point is that (elisp)11.9.5.1 "Converting a package to use
> lexical scoping" says:
>
> To silence byte-compiler warnings about unused variables, just use a
> variable name that start with an underscore, which the byte-compiler
> interpret as an indication that this is a variable known not to be used.
>
> but this exception is quite less useful if assignments produce the
> "variable `_x' not left unused" warning.
IIRC, Common Lisp distinguishes between (declare (ignore ...)) and
(declare (ignorable ...)). The latter is useful for macros that
introduce bindings that may or may not be used. This doesn't really
help with `loop', though, since it shouldn't declare its bindings ignorable.
I guess Emacs Lisp's new underscore syntax is the equivalent of (declare
(ignore ...)), with no way to (declare (ignorable ...)). If this is the
case, then I agree it's not quite expressive enough, and requires idioms
like the above (with many macros, not just `loop').
Christian.
next prev parent reply other threads:[~2011-04-03 23:32 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-01 17:32 Lexical binding Stefan Monnier
2011-04-01 19:12 ` David De La Harpe Golden
2011-04-01 19:46 ` Eli Zaretskii
2011-04-04 16:05 ` Stefan Monnier
2011-04-01 20:04 ` Daniel Colascione
2011-04-01 20:39 ` cedet-bzr build failure (was : Lexical binding) Darren Hoo
2011-04-01 21:21 ` David Engster
2011-04-01 22:26 ` Darren Hoo
2011-04-02 12:40 ` David Engster
2011-04-02 13:42 ` Eric M. Ludlam
2011-04-02 18:22 ` cedet-bzr build failure David Engster
2011-04-02 18:29 ` cedet-bzr build failure (was : Lexical binding) Darren Hoo
2011-04-01 20:42 ` Lexical binding Eli Zaretskii
2011-04-01 22:13 ` Juanma Barranquero
2011-04-02 2:33 ` Juanma Barranquero
2011-04-02 3:36 ` Juanma Barranquero
2011-04-02 18:38 ` Stefan Monnier
2011-04-04 16:04 ` Juanma Barranquero
2011-04-04 21:44 ` Stefan Monnier
2011-04-04 21:56 ` Juanma Barranquero
2011-04-04 22:03 ` David Kastrup
2011-04-04 22:34 ` Stefan Monnier
2011-04-02 18:38 ` Stefan Monnier
2011-04-02 18:50 ` Juanma Barranquero
2011-04-02 18:57 ` Juanma Barranquero
2011-04-03 12:05 ` Christian Ohler
2011-04-03 12:26 ` Juanma Barranquero
2011-04-03 23:32 ` Christian Ohler [this message]
2011-04-04 0:12 ` Juanma Barranquero
2011-04-04 16:22 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D99038B.7060702@gnu.org \
--to=ohler@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=lekktu@gmail.com \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.