On Jul 20, 2008, at 3:59 AM, Daniel Pittman wrote:
>
> Luke Kanies <[EMAIL PROTECTED]> writes:
>> Why don't you try the recursive setting of instance variables and see
>> how it performs? It might be sufficient.
>
> So, as expected this had the side-effect of making it impossible to
> detect when an undefined variable was used in a template. This was
> quite a loss, in my opinion, and something I would rather not give up.
Why would that be the case? Ruby has a builtin 'defined?' method:
if defined?(@myinstancevar)
... do stuff ...
end
Right?
>
> So, I spent some more time investigating this and came up with the
> patch
> just sent to the list: it manually hides the Kernel methods, which are
> the only ones (as far as I can determine) that cause us this grief.
>
>
> This is a bit ugly, because it hard-codes the Kernel module, and
> because
> it still risks shadows from other sources -- but it is, I think, the
> best that can be done within the crippled meta-object protocol
> available
> in Ruby.
>
> I think it is preferable to the earlier version for two key reasons,
> which justify the ugly nature of the code:
>
> * it retains the ability to signal a fatal error when an undefined
> puppet variable is used in a template
>
> * it retains the performance characteristics of O(n) searches where
> n is the number of variables used, not the number visible.
>
>
> The patch includes a test that verifies that a range of otherwise
> risky
> kernel variables are safe to include and evaluate within the template
I'll make any comments I have on the patch itself.
--
Dawkins's Law of Adversarial Debate:
When two incompatible beliefs are advocated with equal intensity,
the truth does not lie half way between them.
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---