[pro] (values) for for-effect functions

Nikodemus Siivola nikodemus at random-state.net
Thu Dec 2 23:34:38 UTC 2010


On 3 December 2010 01:00, Daniel Weinreb <dlw at itasoftware.com> 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 where function approach would work, and partly because it
tends to make debugging harder.

Most of the time there's thing you can sensibly return -- which makes
output from TRACE more useful, even if 90% of the callers end up
discarding it.

If there is no sensible return value beyond (VALUES) or NIL, then I do
find (VALUES) a good obvious signal that the function is being used
for effect only, and occasionally it _does_ make debugging easier by
killing tail-calls.

So, a mixed bag for me.

Cheers,

 -- Nikodemus




More information about the pro mailing list