Gnus development mailing list
 help / color / mirror / Atom feed
* format called for effect
@ 2003-01-05 19:38 Kai Großjohann
  2003-01-06  2:20 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Kai Großjohann @ 2003-01-05 19:38 UTC (permalink / raw)


When byte-compiling Gnus, I see the message from subject.  It comes
from gnus-msg.el, line 1497 or so, if I'm not mistaken.  I can't
reproduce the message by compiling the following simple file.  What's
the story?

(defun foo ()
  (condition-case ()
      (+ 3 4)
    (error (format "(setq foo %04d)\n" 42))))
-- 
Ambibibentists unite!



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: format called for effect
  2003-01-05 19:38 format called for effect Kai Großjohann
@ 2003-01-06  2:20 ` Lars Magne Ingebrigtsen
  2003-01-07  7:25   ` Kai Großjohann
  2003-01-07 17:02   ` Raja R Harinath
  0 siblings, 2 replies; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 2003-01-06  2:20 UTC (permalink / raw)


kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:

> When byte-compiling Gnus, I see the message from subject.  It comes
> from gnus-msg.el, line 1497 or so, if I'm not mistaken. 

This code:

	  (condition-case ()
	      (pp `(setq ,(car olist)
			 ,(if (or (consp (setq sym (symbol-value (car olist))))
				  (and (symbolp sym)
				       (not (or (eq sym nil)
						(eq sym t)))))
			      (list 'quote (symbol-value (car olist)))
			    (symbol-value (car olist))))
		  (current-buffer))
	    (error
	     (format "(setq %s 'whatever)\n" (car olist))))

First of all -- I have no idea why that `condition-case' is the way
it is.  I didn't know that `format' had any effect?  Does it?  And if
it doesn't, why is that code that way?  If nobody has an explanation,
I'll just remove the `format'.
             
-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: format called for effect
  2003-01-06  2:20 ` Lars Magne Ingebrigtsen
@ 2003-01-07  7:25   ` Kai Großjohann
  2003-01-08  3:52     ` Lars Magne Ingebrigtsen
  2003-01-07 17:02   ` Raja R Harinath
  1 sibling, 1 reply; 9+ messages in thread
From: Kai Großjohann @ 2003-01-07  7:25 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:
>
>> When byte-compiling Gnus, I see the message from subject.  It comes
>> from gnus-msg.el, line 1497 or so, if I'm not mistaken. 
>
> This code:
>
> 	  (condition-case ()
> 	      (pp `(setq ,(car olist)
> 			 ,(if (or (consp (setq sym (symbol-value (car olist))))
> 				  (and (symbolp sym)
> 				       (not (or (eq sym nil)
> 						(eq sym t)))))
> 			      (list 'quote (symbol-value (car olist)))
> 			    (symbol-value (car olist))))
> 		  (current-buffer))
> 	    (error
> 	     (format "(setq %s 'whatever)\n" (car olist))))
>
> First of all -- I have no idea why that `condition-case' is the way
> it is.  I didn't know that `format' had any effect?  Does it?  And if
> it doesn't, why is that code that way?  If nobody has an explanation,
> I'll just remove the `format'.

Thinking some more about it, maybe what was intended was to try to
insert one setq statement, and to insert another setq statement in
the case of an error.

So maybe the condition-case should be around the if and return
`whatever' in case of error?
-- 
Ambibibentists unite!



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: format called for effect
  2003-01-06  2:20 ` Lars Magne Ingebrigtsen
  2003-01-07  7:25   ` Kai Großjohann
@ 2003-01-07 17:02   ` Raja R Harinath
  2003-01-08  3:53     ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 9+ messages in thread
From: Raja R Harinath @ 2003-01-07 17:02 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:
>
>> When byte-compiling Gnus, I see the message from subject.  It comes
>> from gnus-msg.el, line 1497 or so, if I'm not mistaken. 
>
> This code:
>
> 	  (condition-case ()
> 	      (pp `(setq ,(car olist)
> 			 ,(if (or (consp (setq sym (symbol-value (car olist))))
> 				  (and (symbolp sym)
> 				       (not (or (eq sym nil)
> 						(eq sym t)))))
> 			      (list 'quote (symbol-value (car olist)))
> 			    (symbol-value (car olist))))
> 		  (current-buffer))
> 	    (error
> 	     (format "(setq %s 'whatever)\n" (car olist))))
>
> First of all -- I have no idea why that `condition-case' is the way
> it is.  I didn't know that `format' had any effect?  Does it?  

It doesn't.  And that seems to be the point of the overly cleverly
worded warning.  It think the warning says

  "you want a side-effect there, but 'format' ain't gonna do it for you"

- Hari
-- 
Raja R Harinath ------------------------------ harinath@cs.umn.edu



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: format called for effect
  2003-01-07  7:25   ` Kai Großjohann
@ 2003-01-08  3:52     ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 2003-01-08  3:52 UTC (permalink / raw)


kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:

> Thinking some more about it, maybe what was intended was to try to
> insert one setq statement, and to insert another setq statement in
> the case of an error.

Probably.  That's very, very old code, I think...

I've just removed the `error' bit and used `ignore-errors'.  It
doesn't make much sense to insert the `whenever' bits.

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: format called for effect
  2003-01-07 17:02   ` Raja R Harinath
@ 2003-01-08  3:53     ` Lars Magne Ingebrigtsen
  2003-01-08  5:12       ` Raja R Harinath
  2003-01-08  6:12       ` Kai Großjohann
  0 siblings, 2 replies; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 2003-01-08  3:53 UTC (permalink / raw)


Raja R Harinath <harinath@cs.umn.edu> writes:

> It doesn't.  And that seems to be the point of the overly cleverly
> worded warning.  It think the warning says
>
>   "you want a side-effect there, but 'format' ain't gonna do it for you"

Yeah, probably.  It's a kinda strange thing to warn about -- did
anyone ever think that doing a `format' would have a side effect?

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: format called for effect
  2003-01-08  3:53     ` Lars Magne Ingebrigtsen
@ 2003-01-08  5:12       ` Raja R Harinath
  2003-01-08  6:12       ` Kai Großjohann
  1 sibling, 0 replies; 9+ messages in thread
From: Raja R Harinath @ 2003-01-08  5:12 UTC (permalink / raw)


Hi,

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Raja R Harinath <harinath@cs.umn.edu> writes:
>
>> It doesn't.  And that seems to be the point of the overly cleverly
>> worded warning.  It think the warning says
>>
>>   "you want a side-effect there, but 'format' ain't gonna do it for you"
>
> Yeah, probably.  It's a kinda strange thing to warn about -- did
> anyone ever think that doing a `format' would have a side effect?

It makes sense to warn in the case where you call to a pure (no
side-effects) function, and then discard the value.  Apparently, the
compiler figured out that the call to 'format' would be an expensive
no-op in that context, and that's why it complained.

It is just that the wording of the warning is wierd enough that you
put the blame on the callee (by worrying about 'format' in this case),
rather than the call site, where the problem actually is.

- Hari
-- 
Raja R Harinath ------------------------------ harinath@cs.umn.edu



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: format called for effect
  2003-01-08  3:53     ` Lars Magne Ingebrigtsen
  2003-01-08  5:12       ` Raja R Harinath
@ 2003-01-08  6:12       ` Kai Großjohann
  2003-01-08  9:19         ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 9+ messages in thread
From: Kai Großjohann @ 2003-01-08  6:12 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Yeah, probably.  It's a kinda strange thing to warn about -- did
> anyone ever think that doing a `format' would have a side effect?

Well...  But the byte-compiler *did* find a problem, didn't it?  So
the warning was actually a Good Thing, no?
-- 
Ambibibentists unite!



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: format called for effect
  2003-01-08  6:12       ` Kai Großjohann
@ 2003-01-08  9:19         ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 2003-01-08  9:19 UTC (permalink / raw)


kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:

> Well...  But the byte-compiler *did* find a problem, didn't it?  So
> the warning was actually a Good Thing, no?

Yup.  But, as noted, the error message could have been clearer.  Or,
perhaps, less clear, since what it said was 100% right, but perhaps a
bit too much to the point.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-01-08  9:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-05 19:38 format called for effect Kai Großjohann
2003-01-06  2:20 ` Lars Magne Ingebrigtsen
2003-01-07  7:25   ` Kai Großjohann
2003-01-08  3:52     ` Lars Magne Ingebrigtsen
2003-01-07 17:02   ` Raja R Harinath
2003-01-08  3:53     ` Lars Magne Ingebrigtsen
2003-01-08  5:12       ` Raja R Harinath
2003-01-08  6:12       ` Kai Großjohann
2003-01-08  9:19         ` Lars Magne Ingebrigtsen

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 NNTP newsgroup(s).