On 2019-01-08 15:16, jcbollinger wrote:


On Monday, January 7, 2019 at 3:37:46 PM UTC-6, Matt Zagrabelny wrote:



    On Mon, Jan 7, 2019 at 3:31 PM Matt Zagrabelny <mzag...@d.umn.edu
    <javascript:>> wrote:

        Greetings puppet-users!

        For many years I have been using the following convention for
        including my classes:

        class foo() {
             include ::profile::bar
        }

        I know I don't need the leading double colon for including
        profile::bar, but at one point in time I thought it may have
        been a best practice or it would help prevent some sort of
        future pain point.

        Is that still true? Was I ever correct?

    Needed to spend 30 more seconds reading before hitting send. Sorry
    for the noise!

    https://github.com/voxpupuli/puppet-lint-absolute_classname-check/issues/3
    <https://github.com/voxpupuli/puppet-lint-absolute_classname-check/issues/3>

    Thanks for any additional feedback!


I observe that the voxpupuli thread slightly downlplays the scope of the issue as it affected Puppet 3.  Puppet's (long since removed) relative name resolution scheme looked not just at the namespace in which the name was used, as the voxpupuli discussion seems to suggest, but also at every ancestor namespace, in order, until ultimately reaching top scope.  I'm not sure where to find P3 docs any longer, but this behavior is summarized in the description of PUP-121 <https://tickets.puppetlabs.com/browse/PUP-121>, the issue for removing that behavior.

That only rarely bit people, but it bit enough people, often enough, that for a time it was considered best practice to always use fully-qualified names (which is effectively what the `::` prefix produces).  But Puppet, Inc. decided that the negatives of relative name resolution outweighed the positives, including the positive of minimizing breaking changes, so relative name resolution was removed in Puppet 4.  Nowadays, the :: prefix is accepted for backwards compatibility, but it conveys no additional meaning.


Adding to what John said above:

There is no additional meaning for class names when it starts with '::', it does however make a difference when referencing variables. If a variable contains '::' (anywhere) it is always taken as an absolute reference starting from topscope. Thus something like '$::x' is the topscope $x, a '$x' is a local, inherited or topscope variable 'x', and '$x::y' and '$::x::y' are exactly the same thing.

- Henrik

John

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com <mailto:puppet-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/325d0f92-98a4-462c-9378-ae189a22be5c%40googlegroups.com <https://groups.google.com/d/msgid/puppet-users/325d0f92-98a4-462c-9378-ae189a22be5c%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/q12hcf%246fs%241%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to