I also use the undef to un-set parameters in various code segments. If
this is made real, it will impact my code.

Thanks,

Trevor

On Fri, Sep 14, 2012 at 6:39 PM, Stefan Schulte
<[email protected]> wrote:
> On Fri, Sep 14, 2012 at 11:31:08AM -0700, Eric Sorenson wrote:
>> Hi, there's an issue that came up recently in the 3.0RCs -- Big thanks to 
>> Erik Dalén for reporting it in #16221 -- that involves a behaviour change to 
>> part of the DSL. In a nutshell, this code:
>>
> [..]>
>>     class toplevel (
>>        $maybe = false,
>>        $optional = undef ) {
>>        if ($maybe) {
>>           class { toplevel::secondlevel: optional => undef }
>>        }
>>     }
>>
>> In order to make use of the default for the `optional` parameter in 
>> toplevel::secondlevel, you'd now need to either test in `toplevel` whether 
>> `$optional` was passed into it, or have toplevel::secondlevel use an 
>> `$optional_real` value inside it, similar to what's commonly done to append 
>> to defaults that are array values.
>>
> [...]
>>
>> So, I'm trying to determine whether this is a widespread pattern or an 
>> edge-case. Do you expect 'param=>undef' to be the same as not specifying 
>> param at all, or for the receiver to "see" the undef?
>>
>> Eric Sorenson - [email protected]
>> PuppetConf'12 - 27-28 Sep in SF - http://bit.ly/pcsig12
>>
>
> I use this a lot to be able to have an optional parameter in a parent
> class that is passed to an included class and the included class
> determines the default value. Like:
>
>     class basic($puppet_cron = undef) {
>       class { 'puppet::client':
>         cron => $puppet_cron,
>       }
>     }
>
> -Stefan
>
> --
> 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.
>



-- 
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699
[email protected]

-- This account not approved for unencrypted proprietary information --

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" 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-users?hl=en.

Reply via email to