Issue #5648 has been updated by Randall Hansen.

Assignee set to Randall Hansen


----------------------------------------
Feature #5648: Puppet should emit a warning when literal string "true" or 
"false" is used in a boolean context
https://projects.puppetlabs.com/issues/5648

Author: Daniel Pittman
Status: Accepted
Priority: Low
Assignee: Randall Hansen
Category: compiler
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


In the puppet universe the strings "true" and "false" are "boolean true",
which means that there are some cases where it will be highly unintuitive.

It would be nice if puppet would emit a warning in this case:

    if "false" { ... } else { ... }
    => "warning: the string 'false' evaluates as true, did you mean false 
instead?"

However, this should not emit a warning, I strongly suspect:

    $foo = "false"
    if $foo { ... } else { ... }

That should make this detectable, but wrong, code let people know that it
won't do what they expected.  The "string literal" case is pretty much
unambiguously expecting the wrong thing, I expect, or at least super-confusing
to someone else reading it later. :)



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

Reply via email to