Issue #15329 has been updated by Henrik Lindberg.

Andrew  Parker wrote:
> I don't really like the idea of heading down the path that creates the 
> incredible confusion in Javascript with null vs. undefined 
> (<http://saladwithsteve.com/2008/02/javascript-undefined-vs-null.html>). 
> 
I have been thinking more about this too - especially after looking at the 
Scala way; although very precise, it is also completely confusing and overkill. 
Having one value that is both antimatter and classic nil, does not work, but 
having two is at the same time is both one too many, and not enough.
 
In fact, I really hate "undef" as an antimatter value that can be passed 
around, and would prefer to get rid of that meaning completely in favor of a 
straight forward classic "nil" sense. Big problem is that there is no 
conditional fat comma. You are not allowed to do something like:

<pre>
file { 'title': if ($foo != undef) { mode => $foo}, owner => root }
</pre>
Not would it be possible to easily support such syntax - it is just an example.

In all other cases, the syntax already allows passing a reasonable value, or no 
value at all (i.e. function calls).

A conditional fat comma could be introduced with the meaning, "set to 'nil' 
(which we can continue to call 'undef') - it could look like this:
<pre>
file { 'title' : mode =<?> $foo, owner => root }
</pre>
or some other clever way to express the operator. Oh, it could be done like 
this:
<pre>
file { 'title' : (mode => $foo), owner => root }
</pre>

The big advantage with this scheme is that it is totally clear where an undef 
becomes antimatter / is a noop. User can decide to pass the undef as a value, 
or use it to "not set", and there is no confusion with two separate 
"nothingness" values.

----------------------------------------
Bug #15329: Puppet lacks a proper "undefined" value
https://projects.puppetlabs.com/issues/15329#change-74450

Author: Pieter van de Bruggen
Status: Accepted
Priority: Normal
Assignee: Henrik Lindberg
Category: 
Target version: 
Affected Puppet version: 
Keywords: backlog
Branch: 


    $y = undef
    notice($y == "")  # true
    notice($x == $y)  # true
    notice($x == "")  # true

Recent changes in the Puppet DSL made equality commutative (good!), but in 
doing so broke work-arounds for actually testing for the difference between an 
undefined and "empty" value.  The most logical fix would be to equate Puppet's 
`undef` with Ruby's `nil`.


-- 
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 puppet-bugs@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-bugs+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to