----- Original Message -----
> From: "Andrew Parker" <a...@puppetlabs.com>
> To: puppet-dev@googlegroups.com
> Sent: Thursday, April 19, 2012 5:30:29 PM
> Subject: Re: [Puppet-dev] Changes to variable scoping in Telly
> 
> 
> On Apr 19, 2012, at 1:21 AM, Ken Barber wrote:
> 
> >> If I want a top-level variable, I'll ask for one. If I want a
> >> node-level
> >> variable, I'd like to be able to ask for one (which I can't today
> >> afaik). I
> >> never want either of them unless I ask for them by name.
> >> 
> >> Yes, I do. Or an option to enable that at least. I realize that
> >> many people
> >> love a big swash of global variables, so I'm going against the
> >> stream. In
> >> fact, I would appear to be going against the grain of ruby itself.
> >> But
> >> sometime after your module repository breaks 20k lines of code you
> >> really
> >> want to strangle something every time you get a variable collision
> >> you never
> >> intended inside what should be a tight a lexical scope.
> > 
> > This is a very good point Jo, debug-ability is certainly important.
> > 
> 
> Absolutely. Debugging is always made fiendishly difficult when there
> is "action at a distance" stuff going on. Limiting that kind of
> interaction is why globals are frowned upon in most programming. Is
> there a lot of use of globals (topscope) other than facts (and enc
> parameters, I guess) in puppet?
> 

Today there is a lot of it going around.  The bulk of modules would be 
written with something like:

class foo::install {
   if $foo_version { $version = $foo_version } else { $version = "present"}

   package{"foo": ensure => $version}
}

and then people will "configure" these modules either in site.pp with
globals or in a node with node scope variables.

node "blah" { 
   $foo_version = "1.2.3"

   include foo::install
}

This is very common, it used to be the only real option outside of using
extlookup and hiera.  And there are vast amounts of code out in the real
world and on the forge built around this pattern.  

worse, you also had:

class someother {
   $foo_version = "1.2.4"

   include foo::install
}

and so depending on the parse order of the actual include lines the outcome
might be different in the end, this being at the whim of the autoloader and
such it was a bit tricksy.

All of this code either needs big refactors or just doesnt work with 2.7.

Until there is wide adoption of param classes or some data system this
will unfortunately still be the way.

The proposed hash like syntax will make for much lighter refactoring apart
from all the other gains expressed in that ticket.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to