A few thoughts:

1) The sensibilities of perl programmers and ruby programmers differ on
this, but that doesn't make it not a code smell to rubyists; the common
reaction to such things in the ruby world is "it smells like perl" (said
with a wrinkled nose).

2) The reason it's considered a code smell is that it takes a worst of all
worlds approach.  If you embrace ruby's semantics (a most do) and expect
nil-initialization as your birth right, you simply ignore the warnings that
would be generated as irrelevant, the same way a good writer ignores the ham
handed grammar checking of a word processor.  If you want to take the
warnings seriously, then the correct solution is to eliminate them *by
initializing the variables* since that's what you are being warned about.

To clutter the code with a meta programming / introspection construct like
"defined?" for no other reason than to reimplement the extant semantics of
the language in a way that thwarts detection by the warning system is just
silly.  Worse, since it often creates the possibility of a tri- (or even
quad) state for booleanesque values (giving you now <undefined> in addition
to nil, false, and everything else) it is just begging for subtle logic
bugs.

--~--~---------~--~----~------------~-------~--~----~
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