On Wed, 2009-09-16 at 09:49 +0200, Brice Figureau wrote:
> On Tue, 2009-09-15 at 15:16 -0700, Luke Kanies wrote:
> > I can't think of a better solution, but I'm not real stoked about  
> > 'node_exists?' returning something other than a boolean.
> 
> Yes, I had the same question. But couldn't find a better name which
> didn't involve renaming all other call sites. I tried node_by_name or
> node_by_equality, but none where really satisfying either.

Rename any call sites that use the return value of 'node_exists?' as
anything other than a boolean.  If this is all of them, then the method
should be renamed.  If this is only some of them, then there are really
two methods, one of which (probably 'node_exists?') is a thin wrapper on
the other.

There's no reason a method like 'foo?' can't return any reasonable value
it likes, but you should only count on the boolean traits of the result
(if you want to force it to be a boolean you can always use the '!!foo?'
idiom).

I'm planning some code-quality sweeps, and this is one of the target
issues.

-- Markus


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to