On Wed, Nov 17, 2010 at 4:27 AM, Nick Moffitt <n...@zork.net> wrote:

> Let me start by saying that I am a fan of lexical scoping as a way of
> increasing confidence in your execution models.  I am hoping to move
> from the now thoroughly debunked "wackyscope" model that used to plague
> many programming languages over to proper lexical scoping in my puppet
> configs.  I'm just having trouble finding documentation of how this
> works for puppet.
>
> I understand that a lexically-scoped puppet config would need to use
> parameterized classes.  What I'm not clear on is how facts would be
> scoped.  Are they some top-level that needs to be passed into nodes?
> Are they present in a node's scope?  What if it inherits?  Do I need to
> pass these facts in as parameters as well? (I hope so).
>
> The only documentation I can find at all for lexical scoping in puppet
> is in puppet.conf(5):
>
>       lexical +++++++
>
>       Whether to use lexical scoping (vs. dynamic).
>
>       ยท   Default: false
>
> That's a bit thin.  I assume this is only needed on the master, of
> course.
>

This doesn't actually do anything... yet. With the addition of parametrized
classes, however, lexical scoping should be possible in the future. Although
dynamic scoping does exist, its possible to not take advantage of it by
passing all variables through parametrized classes, or specifically
referring to variables at top scope with the fully qualified namespace
$::operatingsystem. Resource defaults, unfortunately, do not allow a way to
work around dynamic scoping though...


>
> --
> "These people program the way Victorians dress.
> It takes two hours and three assistants to put on
> your clothes, and you have to change before dinner.
> But everything is modular."    -- Miles Nordin, on PAM
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com<puppet-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>

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

Reply via email to