all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: Glenn Morris <rgm@gnu.org>
Cc: 28107@debbugs.gnu.org, Tino Calancha <tino.calancha@gmail.com>
Subject: bug#28107: 26.0.50; Byte compilation shows an unused var warning for an used variable
Date: Fri, 18 Aug 2017 02:32:59 +0900 (JST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1708180229001.28891@calancha-pc> (raw)
In-Reply-To: <fv1soa6tcx.fsf@fencepost.gnu.org>



On Thu, 17 Aug 2017, Glenn Morris wrote:

> Tino Calancha wrote:
>
>> ;; Warning: value returned from (cdr x) is unused
>> (defun test2 ()
>>   (let ((alist (list (cons "foo" 1) (cons "bar" 2))))
>>     (dolist (x alist)
>>     (when (cdr x)
>>       (equal (cdr x) (alist-get (car x) alist))))))
>
> Isn't this function a no-op?
> Eg dolist does not return the last value from the body.
> So a smaller example of the same thing is:
>
> (dolist (x '(1))
>  (equal (+ x 2) 3))
>
> which returns nil.
Even without the dolist we get such warning:
$> cat /tmp/test.el
;; -*- lexical-binding: t; -*-
(let ((x 1))
   (and (equal (+ x 2) 3)))

M-x byte-compile-file RET /tmp/test RET
Compiling file /tmp/test.el at Fri Aug 18 02:30:59 2017
test.el:2:1:Warning: value returned from (+ x 2) is unused
test.el:2:1:Warning: value returned from (+ x 2) is unused

I used (+ x 2) as 1st argument for `equal'.  What more should i do to
use it? Maybe invite (+ x 2) to the cinema?
I hope (+ x 2) will pay, cinema it's too expensive here.





  parent reply	other threads:[~2017-08-17 17:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-16  6:11 bug#28107: 26.0.50; Byte compilation shows an unused var warning for an used variable Tino Calancha
2017-08-17 16:39 ` Glenn Morris
2017-08-17 16:45   ` Glenn Morris
2017-08-17 17:32   ` Tino Calancha [this message]
2017-08-18  1:42     ` Glenn Morris
2019-06-12 15:03       ` Lars Ingebrigtsen

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=alpine.DEB.2.20.1708180229001.28891@calancha-pc \
    --to=tino.calancha@gmail.com \
    --cc=28107@debbugs.gnu.org \
    --cc=rgm@gnu.org \
    /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.