Issue #18942 has been updated by Henrik Lindberg.

I understood that the purpose of adding xor was mainly for checking exclusivity 
among parameters. 
One idea is to write a function instead. Unfortunately, none of the standard 
lib functions have a perfect fit for this (does not improve anything over 
writing the logic with and/or/not), but a count function would be helpful, or 
perhaps even better, write some asserter functions. and make it a module of its 
own.
<pre>
count([$a,$b,$c]) # count non nil/undef by default
count([$a,$b,$c], 42) # count number of entries == 42
</pre>

or write an asserter function
<pre>
assert_exactly_one($a, $b, $c, "Only one of the parameters a, b, c can be set")
</pre>


----------------------------------------
Feature #18942: Puppet should have a xor operator
https://projects.puppetlabs.com/issues/18942#change-82201

Author: Erik Dalén
Status: Needs More Information
Priority: Normal
Assignee: Erik Dalén
Category: parser
Target version: 3.2.0
Affected Puppet version: 
Keywords: xor parser
Branch: https://github.com/puppetlabs/puppet/pull/1436


There should be a 'xor' operator in puppet to complement and & or.


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to