Issue #8783 has been updated by Matt Robinson.
My initial reaction is that the current behavior (undefined method `<' for
:undef:Symbol) is correct regardless of what 0.25.x did. If you allow
comparison operations to be done on undef you have to start making weird
decions. Is undef < 0? Is undef < ""? Maybe it's equal to both.
Also, the behavior or erroring when comparing undef is consistent with most
programming languages I've worked with, and something I've heard more than a
few times is that people would prefer Puppet be more strict about undefs, much
like Perl's strict pragma. Ruby for example:
nil < 0
NoMethodError: undefined method `<' for nil:NilClass
nil < ''
NoMethodError: undefined method `<' for nil:NilClass
There are definitely cases in Puppet where we treat undef like something else.
#4692 for example we treat undef like empty string when we pass it to split.
I'll do some research on other places we treat undef differently in Puppet,
since in the long run I'd prefer we did something consistent, but the mean time
I'd be happy to hear arguments for why we should not error when comparing undef.
----------------------------------------
Bug #8783: Previously working equality operator case now fails on
':undef:Symbol'.
https://projects.puppetlabs.com/issues/8783
Author: Trevor Vaughan
Status: Accepted
Priority: High
Assignee: Matt Robinson
Category: parser
Target version:
Affected Puppet version: 2.6.0
Keywords:
Branch:
The following code worked on 0.24.X:
<pre>
# The variables are not defined purposefully
if $foo < $bar {
notify { "test": }
}
</pre>
In the 2.6 and 2.7 series, it throws the following error:
<pre>
undefined method `<' for :undef:Symbol
</pre>
Wrapping the variables in double quotes works but it not ideal for legacy code
migration.
--
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.