Re: [pro] (values) for for-effect functions

2010-12-07 Thread Pascal Costanza
Yes. On 7 Dec 2010, at 19:36, Peter Seibel wrote: > You mean PCL the CLOS implementation, right? > > -Peter > > On Tue, Dec 7, 2010 at 10:20 AM, Pascal Costanza wrote: >> >> On 3 Dec 2010, at 13:34, Martin Simmons wrote: >> >>> I think it is confusing to use (values) for that purpose, becaus

Re: [pro] (values) for for-effect functions

2010-12-07 Thread Peter Seibel
You mean PCL the CLOS implementation, right? -Peter On Tue, Dec 7, 2010 at 10:20 AM, Pascal Costanza wrote: > > On 3 Dec 2010, at 13:34, Martin Simmons wrote: > >> I think it is confusing to use (values) for that purpose, because "no values" >> is also a valid return value (e.g. for reader macro

Re: [pro] (values) for for-effect functions

2010-12-07 Thread Pascal Costanza
On 3 Dec 2010, at 13:34, Martin Simmons wrote: > I think it is confusing to use (values) for that purpose, because "no values" > is also a valid return value (e.g. for reader macro functions > http://www.lispworks.com/documentation/HyperSpec/Body/02_add.htm). > > I would make it a macro, called

Re: [pro] (values) for for-effect functions

2010-12-06 Thread Daniel Weinreb
It looks like we do not have a concensus. Thanks to everybody for contributing! -- Dan ___ pro mailing list pro@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/pro

Re: [pro] (values) for for-effect functions

2010-12-04 Thread Attila Lendvai
> I can certainly see the argument that this information primarily belongs in > the doc string, and the use of (values) must not become a substitute for > specifying it there. i feel the need to counter this: i think it's bad practice to put anything in an informal documentation that could be for

Re: [pro] (values) for for-effect functions

2010-12-03 Thread Martin Simmons
I think it is confusing to use (values) for that purpose, because "no values" is also a valid return value (e.g. for reader macro functions http://www.lispworks.com/documentation/HyperSpec/Body/02_add.htm). I would make it a macro, called something like void. OTOH, use of (values) or (void) will

Re: [pro] (values) for for-effect functions

2010-12-03 Thread Didier Verna
Daniel Weinreb wrote: > I'd like to write in our programming standards either that they should > be used, or that they should not be used. I think it's suboptimal for > them to be used in some places and not others, since the inconsistency > could lead a reader of the code to draw wrong conclusion

Re: [pro] (values) for for-effect functions

2010-12-03 Thread Peter Herth
On Fri, Dec 3, 2010 at 12:30 AM, David Owen wrote: > On the other hand, I agree with Peter that it can be somewhat ugly. > Maybe some alternatives, based on (values)? > > (defun f () >   (for-effect >     (setq *foo* 'bar))) > Actually your example hints to a case where I *do* want a for-effect f

Re: [pro] (values) for for-effect functions

2010-12-02 Thread Paul Tarvydas
At least in LW, (values) returned to the REPL stops the repl from printing anything. I've used it when the value otherwise returned would print something big (and long). I would expect to see it in (a) functions called at the top level and (b) in places where "nothing" returned vs. "something"

Re: [pro] (values) for for-effect functions

2010-12-02 Thread Ben Hyde
On Dec 2, 2010, at 6:00 PM, Daniel Weinreb wrote: > In case these terms are too old for anyone to know > them, we used to use the phrase "for effect" to > mean a function that was called for the sake > of its side-effects, ... > In some code I have seen, the author of the code > has written (valu

Re: [pro] (values) for for-effect functions

2010-12-02 Thread Nikodemus Siivola
On 3 December 2010 01:00, Daniel Weinreb wrote: > The question is, is it good style?  That is, ought > we consider it something to be recommended? CMUCL (and by extension SBCL) code does this quite a lot. I've never been a huge fan -- partially because the style subtly encourages side-effects wh

Re: [pro] (values) for for-effect functions

2010-12-02 Thread Scott L. Burson
On Thu, Dec 2, 2010 at 3:20 PM, Peter Seibel wrote: > My taste tells me that's an over-clever idiom and should not be used. > If it's not clear that a function is for-effect without (values) > you've already lost. > I can certainly see the argument that this information primarily belongs in the

Re: [pro] (values) for for-effect functions

2010-12-02 Thread David Owen
On Thu, 2 Dec 2010, Peter Seibel wrote: > My taste tells me that's an over-clever idiom and should not be > used. If it's not clear that a function is for-effect without > (values) you've already lost. I confess that I have used (values) before, not only to indicate that a function was for effec

Re: [pro] (values) for for-effect functions

2010-12-02 Thread Scott L. Burson
On Thu, Dec 2, 2010 at 3:00 PM, Daniel Weinreb wrote: > > From a purely emotional/historical point of > view, I am not used to seeing these (values) > forms, and they seem somewhat ugly and > verbose. But that's just based on my own > experience and should not carry much weight. > > I'd like to

Re: [pro] (values) for for-effect functions

2010-12-02 Thread Peter Seibel
My taste tells me that's an over-clever idiom and should not be used. If it's not clear that a function is for-effect without (values) you've already lost. -Peter On Thu, Dec 2, 2010 at 3:00 PM, Daniel Weinreb wrote: > In case these terms are too old for anyone to know > them, we used to use the

[pro] (values) for for-effect functions

2010-12-02 Thread Daniel Weinreb
In case these terms are too old for anyone to know them, we used to use the phrase "for effect" to mean a function that was called for the sake of its side-effects, versus "for value" when it was called for the sake of its returned value. (Actually I'm not sure I remember what we called a function