Thanks John for lots of good feedback, and I realize I should clarify
some things... comments inline below...
Mostly agree - guess we have to arrange an "Puppet Stdlib Idol" where
people can phone in and vote or something. For now --- just noting
what everyone feels about what is there.
> * How do we keep stdlib in sync with the Puppet version?
>
>
>
> Is it necessary to do so? Few of its functions seem dependent on Puppet
> internals, and none of those are among the ones that I think clearly
> belong as part of the core product. Most of those dependent on Puppet
> internals are in the group "dangerous_hacks" group. Yank those out, I
> say, and make them somebody else's problem.
>
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).
> * How should module authors deal with their dependency on stdlib?
>
>
>
> What sort of "dealing" are you asking about? Modules themselves can't
> really do much "deal"ing; if they try to call functions that don't exist
> then they will just break. If there were a reliable fallback then
> that's what the module would (should) use in the first place.
>
> The only other kind of dealing I can think of involves module metadata
> and the puppet module tool, but it's not clear to me what kinds of
> problems you suppose module authors need to deal with in that area.
>
> * How should we handle future, breaking changes?
> * A function is corrected/modified and is thus not backwards
> compatible (it is not deprecated, just changed behavior).
>
>
>
> Alternative 1: don't do that; create a new function instead. This is a
> tried and true strategy.
>
> Alternative 2: continue applying semantic versioning to stdlib, and
> refer back to "How should module authors deal with their dependency on
> stdlib?"
>
> * A function changes signature (it is called with a different set
> of arguments).
>
I am thinking about a combination of namespaced functions (their
identity is unique), but that they may have the same last part. A module
could then use unqualified function names. A mechanism of resolving the
module's dependencies would wire the module so it finds
the correct version of the function. This way, the puppet logic would
still contain a call to "foo(3)", and the function may come from any of
the referenced modules (say a "stdlib_compat_3" module).
I am also thinking about dependency ranges, and that I suspect that
module authors probably only use a lower version range, thus exposing
the module to potential future breakage.
What I really would like to see it work in the reverse - i.e. that
modules can *provide* an API as well as implement it, and that modules
that depend on other modules declare their dependency on those API
versions - not on the implementation of the API.
In order to achieve this, it may be required to provide modules that
are only there to specify a configuration of other modules. (This in
turn requires a lot more sophistication in the puppet module ecosystem).
In any case, what I want to avoid is that all modules have to be updated
in lock step sync and that module authors can adopt new functionality
faster without sacrificing also supporting the majority of users who are
several steps behind the bleeding edge.
>
>
> See above.
>
> * Should we have "backwards compatibility" as a separate module for
> those that want to use older modules on a newer Puppet? (e.g.
> stdlib-puppet3compat).
>
> That would be a reasonable approach for functions removed from stdlib
> and not otherwise moved anywhere else. It would be sure to cause a
> tremendous mess if done for stdlib functions that were modified.
>
Yes, a mess, for sure :-) unless there is a way to "route" things to an
implementation that has the "old" / expected behavior.
> * Do we have to namespace functions (to allow multiple versions
> of the
> same function for different modules?)
>
>
>
> "Have to"? No. I think it's a good idea, however.
>
> * Do we have to use a scheme such as adding a number after a
> function/type
>
> You mean when new behavior or signature is desired for an existing
> function? Yes, I think the best approach is my alternative 1, which is
> typically implemented by giving the new function a name derived from the
> old one's.
>
> * Do we need to implement module specific loading (allow multiple
> versions of a function).
>
>
>
> I think namespacing functions is a better strategy.
>
See comment above - I was thinking about a combination of namespace and
resolution of dependencies (to define visibility). Using a fully
qualified name could be allowed (it would be an absolute pointer), if
using only the last part, it would resolve to the visible version of
that function. (If ambiguous, user would have to use fully qualified name).
> * What about types and providers? Since they all have to
> co-exist in
> the same catalog it is not really possible to support multiple
> versions. How should we deal with types and providers?
>
>
>
> I think the only significant issue there that is not analogous to the
> situation with functions is third-party providers for existing types.
> That's a thorny issue that I'm not prepared to address at the moment.
>
We can probably leave that out from the discussion around stdlib.
Regards
- henrik