Issue #18569 has been updated by Andrew Parker. Status changed from Unreviewed to Rejected
We definitely have a problem with "stupid programmer errors" throughout the codebase as shown by all of the bugs that you have linked this to. I don't see how a whiny nil would have made this any different. The bug reports show that users are reporting these problems to us, so they do know that there is an error in puppet. This is a much more general problem than just method calls on `nil`. Instead of trying to fix just this one point problem, I would prefer that we try to tackle the way that is suggested in #12856. ---------------------------------------- Refactor #18569: Implement "whiny nil" for Puppet, solve `Undefined method `blah' for nil:NilClass` problem more elegantly https://projects.puppetlabs.com/issues/18569#change-81135 Author: Daniel Pittman Status: Rejected Priority: Normal Assignee: Category: error reporting Target version: Affected Puppet version: Keywords: Branch: https://github.com/puppetlabs/puppet/pull/1389 For years we have had a plague of "Undefined method `blah' for nil:NilClass" reports through Puppet. Every single one of those is a nasty bug: one of the prices of Ruby is that you have to hand-write all your type checking by hand, everywhere that matters, because there isn't a compiler or any type annotation to do that for you. Fun times. This leads to the nasty bug this describes, in which you end up missing a check somewhere in the system and (most often) end up with a NULL pointer dereference equivalent. Sure, Ruby saves you by turning that into a polite exception, but the net effect is still the same: welcome to the hell of random failures made worse by missing type checking. We should fix this. At the very least we should give more guidance about what went wrong, and what the user should do. We probably should make this serious internal bug report a stack trace and push the user to submit it to our system, all the time. (Optimally, we would have this push into some sort of automated system that can correlate these and rank them by priority, but that is getting fancy. ;) The obvious solution is something like `whiney_nil`, which adds some smarts to `NilClass` and `nil`: implement `method_missing` and report more helpful diagnostics based on the call chain, method, etc. Carefully ensure that `respond_to?` still returns `false` for all those things, though, so that people doing duck-typing get effective responses, and only blind calls trigger your code. -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" 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-bugs?hl=en.
