I was browsing through stdlib and I noticed that there's quite a few things in there that make me itch, from a little to a lot very much. Most of them are workarounds for features missing in the Puppet language and though I understand why they exist a few are a bit iffy.
To take an example, file_line is one of those things I consider dangerous. Though useful in the absence of better augeas integration or changes to ParsedFile it's something that can be very easily used to accidentally screw up a system. I'm also extremely weary of loadyaml, parsejson and parseyaml. Loadyaml imho shouldn't have to exist, just use Hiera for that. I'm also not entirely sure what the use case for parseyaml would be as YAML is hardly a nice format to pass in as a parameter to a class. Parsejson I can understand in the absence of structured facts and until stringify_facts starts defaulting to false. Then there's the fact that stdlib has a concat function and that there are at least 3 concat modules out there that do something completely different which can be confusing. All in all, what I'm getting at is that perhaps a few of these things should be moved out of stdlib into something like stdlib-dangerzone and hopefully in time just entirely go away. On Friday, 24 January 2014 14:12:05 UTC+1, henrik lindberg wrote: > > 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/33bc8a4e-e1e4-46f2-b6c1-b9edabf757e2%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
