unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Philipp <p.stephani2@gmail.com>
Cc: 24641@debbugs.gnu.org
Subject: bug#24641: 26.0.50; let-alist: Incorrect byte-compile warning about unused lexical variable
Date: Sat, 08 Oct 2016 09:09:52 -0400	[thread overview]
Message-ID: <87fuo7vvfj.fsf@users.sourceforge.net> (raw)
In-Reply-To: <wvr4k2djypt4.fsf@phst-glaptop2.i-did-not-set--mail-host-address--so-tickle-me> (Philipp's message of "Sat, 08 Oct 2016 14:43:03 +0200")

retitle 24641 let-alist redundantly binds variables already bound by nested let-alist calls
severity 24641 minor
tags 24641 confirmed
quit

Philipp <p.stephani2@gmail.com> writes:

> $ cat /tmp/letalist.el 
> ;; -*- lexical-binding: t; -*-
> (print
>  (let-alist '((outer . ((inner . value))))
>    (let-alist .outer .inner)))
>    
> $ emacs -Q -batch -f batch-byte-compile /tmp/letalist.el 
>
> In toplevel form:
> /tmp/letalist.el:2:1:Warning: Unused lexical variable ‘\.inner’
>
> This warning is incorrect because '.inner' is used in the inner
> let-alist form.

The byte compiler warning correct, the problem is in let-alist: both the
outer and inner let-alist calls let-bind '.inner'.  Here is the
macroexpansion:

(let
    ((#1=#:alist
      '((outer
         (inner . value)))))
  (let
      ((\.outer
        (cdr
         (assq 'outer #1#)))
       (\.inner ; <------------ this one is unused
        (cdr
         (assq 'inner #1#))))
    (let
        ((#2=#:alist \.outer))
      (let
          ((\.inner
            (cdr
             (assq 'inner #2#))))
        \.inner))))





  reply	other threads:[~2016-10-08 13:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-08 12:43 bug#24641: 26.0.50; let-alist: Incorrect byte-compile warning about unused lexical variable Philipp
2016-10-08 13:09 ` npostavs [this message]
2016-10-08 13:33 ` Philipp Stephani
2016-10-08 14:35   ` npostavs
2016-10-08 16:37     ` Philipp Stephani
2016-10-09 20:51       ` Mark Oteiza
2016-10-15 20:24         ` Philipp Stephani
2017-01-26 16:13           ` Mark Oteiza

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fuo7vvfj.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=24641@debbugs.gnu.org \
    --cc=p.stephani2@gmail.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).