On Oct 16, 2009, at 4:09 PM, Markus Roberts wrote: > > I really take issue with comparing the Ruby parser to a grammer > checker. > > True, it's not really a fair comparison. English has a lot fewer > edge cases. :) > > And initializing the variables is often even uglier - tell the truth: > In choosing between this idiom or having a bunch of variables > initialized in initialize(), which do you hate more? :) > > Why would I object to initializing instance variables in > initialize()? That's what its for. If you want to use implicit > initialization, fine, use it. If you don't, use explicit > initialization. But as far as I can see rolling your own implicit > initialization just to thwart the warning system doesn't get you > anything but cluttered code. > > > 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 > > for subtle logic bugs. > > I'm not entirely convinced on that, but I can tell you that I have > found cases where those four states actually were all different and > that difference did matter. > > Those places should probably be found and refactored. At the very > least, the intent would be clearer by moving the information to a > Hash, where iteration over the keys, etc. would likely provide a > more readable interface. But if they are to remain, that's all the > more reason to clean up all the cases where it doesn't matter so the > few cases where it does will stand out in stark contrast.
Let me put it this way: Other than this one warning, I think ruby -w is useful, and I would prefer that our code not throw warnings. The reality is that the current ruby interpreter considers this a warning, so it shows up when you run -w. Most of the other things it warns about with -w are actually useful to know, and my only real concern is that we choose a path that makes -w itself completely useless, such that we start ignoring all of the other warnings, too. I *have* found bugs with -w, and I'd like to keep its utility. Is there a path that allows us to get rid of the idiom you hate but retains the usefulness of -w? -- "They called me mad, and I called them mad, and damn them, they outvoted me." -- Nathaniel Lee, on being consigned to a mental institution, circa 17th c. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
