[Please note that I am way behind on my ruby-talk reading. If you need a quick response, email me directly.]

In the thread on return values from assertions, I have seen a couple of people express that they prefer functions/methods without meaningful return values to return nil. Given that Ruby is a dynamically typed, expression-oriented language, this makes no sense to me.

Even if the return value of a method is meaningless and not guaranteed to be something useful (a documentation matter, IMO), that doesn't mean that it doesn't provide value. In particular, since nil is a Boolean false value, returning nil from these methods means that the method cannot be used in a test, as it is always "false".

-a
-- 
austin ziegler
Sent from my Treo

-----Original Message-----
From:  Gavin Sinclair 
Date:  03.2.5 22.53
To:  ruby-talk / ruby-lang.org (ruby-talk ML)
Subj:  Re: Return values from assertions


On Thursday, February 6, 2003, 2:42:16 PM, nathaniel wrote:

> <to the list> Is there a good rule of thumb for what methods should do
> when they don't have a useful value to return? I can't remember seeing
> any code that was careful to always return nil, but that could just be
> my limited reading.

I don't know about rule of thumb, but I would prefer to see nil
returned.  We rely on documentation to specify APIs in Ruby, since no
type declarations do that for us, and keeping things uniform and
documented would serve Test::Unit well.

Gavin