List Info

Thread: Re: Warning: `mapcar' called for effect; use `mapc' or `dolist'




Re: Warning: `mapcar' called for effect; use `mapc' or `dolist'
country flaguser name
Germany
2007-10-22 15:55:29
On Mon, Oct 22 2007, Dan Nicolaescu wrote:

> Reiner Steib <reinersteib+gmaneimap.cc> writes:
>   > On Mon, Oct 22 2007, Katsumi Yamaoka wrote:
>   > > For instance, `mapcar' used in
`gnus-group-highlight-line'
>   > > cannot be replaced with `mapc' even if the
compiler warns it.
>   > 
>   > Could the byte-compiler be improved not to warn
about such cases?
>   > Here's the relevant code:
>   > 
>   > (defun gnus-group-highlight-line ()
>   >   "Highlight the current line according to
`gnus-group-highlight'."
[...]
> It seems that `mailp' is not used in that function. 

`mailp' is used implicitly through the variable
`gnus-group-highlight'
which is let-bound to `list'.  `list' is used in the body of
the
let-form.

> Adding a use for it makes the warning go away...

Hm, I can't reproduce the warning using
`emacs-lisp-byte-compile' with
GNU Emacs 23.0.50.6 (i686-pc-linux-gnu, GTK+ Version 2.10.6)
of 2007-10-20.
Too old?

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages
.de/


_______________________________________________
Emacs-devel mailing list
Emacs-develgnu.org
htt
p://lists.gnu.org/mailman/listinfo/emacs-devel

Re: Warning: `mapcar' called for effect; use `mapc' or `dolist'
country flaguser name
United States
2007-10-22 16:04:38
Reiner Steib <reinersteib+gmaneimap.cc> writes:

  > On Mon, Oct 22 2007, Dan Nicolaescu wrote:
  > 
  > > Reiner Steib <reinersteib+gmaneimap.cc> writes:
  > >   > On Mon, Oct 22 2007, Katsumi Yamaoka
wrote:
  > >   > > For instance, `mapcar' used in
`gnus-group-highlight-line'
  > >   > > cannot be replaced with `mapc' even
if the compiler warns it.
  > >   > 
  > >   > Could the byte-compiler be improved not
to warn about such cases?
  > >   > Here's the relevant code:
  > >   > 
  > >   > (defun gnus-group-highlight-line ()
  > >   >   "Highlight the current line
according to `gnus-group-highlight'."
  > [...]
  > > It seems that `mailp' is not used in that
function. 
  > 
  > `mailp' is used implicitly through the variable
`gnus-group-highlight'
  > which is let-bound to `list'.  `list' is used in the
body of the
  > let-form.
  > 
  > > Adding a use for it makes the warning go
away...
  > 
  > Hm, I can't reproduce the warning using
`emacs-lisp-byte-compile' with
  > GNU Emacs 23.0.50.6 (i686-pc-linux-gnu, GTK+ Version
2.10.6) of 2007-10-20.
  > Too old?

I can't either. I thought that adding a use for mailp fixed
the
warning for me, I didn't try it before that.


_______________________________________________
Emacs-devel mailing list
Emacs-develgnu.org
htt
p://lists.gnu.org/mailman/listinfo/emacs-devel

Re: Warning: `mapcar' called for effect; use `mapc' or `dolist'
user name
2007-10-22 20:01:48
Reiner Steib <reinersteib+gmaneimap.cc> writes:
>> It seems that `mailp' is not used in that function.

>
> `mailp' is used implicitly through the variable
`gnus-group-highlight'
> which is let-bound to `list'.  `list' is used in the
body of the
> let-form.

Ugh.... that's awful.

You should `defvar' mailp then.

-miles
-- 
Everywhere is walking distance if you have the time.  --
Steven Wright


_______________________________________________
Emacs-devel mailing list
Emacs-develgnu.org
htt
p://lists.gnu.org/mailman/listinfo/emacs-devel

Re: Warning: `mapcar' called for effect; use `mapc' or `dolist'
country flaguser name
United States
2007-10-23 05:39:12
    >   > (defun gnus-group-highlight-line ()
    >   >   "Highlight the current line according
to `gnus-group-highlight'."
    [...]
    > It seems that `mailp' is not used in that function.


    `mailp' is used implicitly through the variable
`gnus-group-highlight'
    which is let-bound to `list'.  `list' is used in the
body of the
    let-form.

    > Adding a use for it makes the warning go away...

If the byte compiler warns about that case, it is being too
ambitious.
Thus, if the value of an expression is stored into a
variable, the
compiler should consider the value "used".

So if this warning really happens, it is a bug.
Can it be reproduced?



_______________________________________________
Emacs-devel mailing list
Emacs-develgnu.org
htt
p://lists.gnu.org/mailman/listinfo/emacs-devel

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )