Issue #16286 has been updated by eric sorenson. Description updated Status changed from Unreviewed to Needs Decision Assignee set to Randall Hansen Keywords set to undef dsl
Seems reasonable, I agree the `||` operator seems like a good thing to have ; making it work relies on improving our handling of 'truthiness' of values. Marking this as needs decision for UX -- assigning to Randall for the nonce. ---------------------------------------- Feature #16286: add || operator https://projects.puppetlabs.com/issues/16286#change-70813 Author: Andrew McNaughton Status: Needs Decision Priority: Normal Assignee: Randall Hansen Category: Target version: Affected Puppet version: Keywords: undef dsl Branch: There's a pattern in common usage that goes like this: class foo ( $val = undef ) { $real_val = $val ? { undef => $name, default => $val, } resource bar {baz: val => $realval} } It's an ugly hack. It would be a lot simpler like so: class foo ( $val = undef ) { $real_val = $val || $name resource bar {baz: val => $realval} } Or, (where templates are not involved): class foo ( $val = undef ) { resource bar {baz: val => $val || $name} } The && and ||= operators common in other languages might also be useful at times, and their meanings from other languages are well known and unambiguous. However, || is the one I'm feeling the strongest need for. The common need for $real_val as above grates a bit too. I imagine it would be a more complex change to implement, but what if the values passed as parameters could be overridden once in the same way as ones from an inherited class? Presumably the externally provided parameters would get their own namespace. -- 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.
