Re: [Puppet Users] Variable Scoping: What do you want?

R.I.Pienaar
2010-06-30T09:13:18Z

----- "Luke Kanies" <luke@puppetlabs.com> wrote:

> Hi all,
>
> Given the number of threads on variable scoping recently, it''s
pretty
> clear we need to change how it works.  Markus has a lot of this redone
> in his futures branch, and I''m asking him to fully describe what
the
> results will be when that''s merged, but my guess is that there are
> different expectations for what people want to see.
>
> So, my question is, what behaviour changes would you like to see in
> how variable scoping works?  How would you like the edge cases that
> are currently hurting you to behave?

Apart the strangeness in variables in node inheritance, I think the variable
scoping in Puppet is spot on.

Once we have parametrized classes, I think:

class foo {
   $bar = 1

   include meh
}

class meh {
   notice($bar)
}

should not produce the results it does today.

It''s a very handy side effect but mostly it''s not going to
give you
deterministic behavior in a order independent language and one where
the same class can be included many times into many parent classes.

Any and all order dependence should go, things like defined() should work
as you''d expect, this is probably not a scope issue though.