On 2014-24-01 11:29, Erik Dalén wrote:
Well, there is one big problem that we would like to solve, and that
is how functions are called. The ambition is to deal with this in
Puppet 4 timeframe. The problem with the current calling convention
is (among other things) that undef gets translated to an empty
string - we would like to stop transforming values that way. The
idea is that a function can opt in to the 4x calling convention.
There may not be any functions in stdlib that will benefit from the
calling convention change though (have not reviewed for that yet).
count, min & max would definitely benefit from that. They all make some
ugly workarounds for it now.
In the case of min & max it is mostly the conversion of numbers to
strings (which only happens sometimes in puppet 3.x) they have to
workaround. Will this also change in the 4.x function API, so numbers
are numbers?
Currently (i) In 4x numbers are numbers, but strings are also
automatically coerced to a number when a number is required. The reverse
is not done. The result of a numeric operation (+,- etc) is always numeric.
(i) I say currently (3.5. future evaluator), because no final decision
has been made regarding automatic coercion string -> numeric. i.e.
should we drop this and require explicit string to numeric coercion?
It is questionable how far automatic coercion should go; if declared
type is Array[Integer], and there are strings in the given Array, should
a new array be produced, etc.
The intention is to make the 4x Function API include typed signature
support, and thus if a String is given where a Numeric is required will
automatically coerce the given String to numeric. We have some design
left to do on this, for simple functions it is trivial, but for
functions with several overloaded signatures it may get a bit messy.
- henrik
--
You received this message because you are subscribed to the Google Groups "Puppet
Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-dev/lbtoqo%24m1a%241%40ger.gmane.org.
For more options, visit https://groups.google.com/groups/opt_out.