On 2011-02-03 18:59, Luke Kanies wrote:
> On Feb 3, 2011, at 1:40 AM, Thomas Bellman wrote:
>> Is the require() function that unloved?
> The problem with it is that it's compile time, not parse time - meaning
> that you couldn't do static class dependency analysis without compiling
> all of the classes, and even then you wouldn't know if a given class
> always has that list of dependencies, or only for that one host.
> That make sense?
Well, I understand where you're coming from, but I disagree. :-) To
do such an analysis statically, you have three things against you:
1. The require() function can be replaced/overridden with a user-
defined function.
2. The arguments to require() are not necessarily constant strings.
3. The call to require() can be inside a conditional.
You can easily detect the latter two points, and provide the static
analysis when they are not the case. Anyone doing dynamic require:s
would be unable to use your syntax and would be forced to use the
require() function anyway, so you won't lose any cases there.
The first point is more difficult, although an analyzer could simply
*assume* that the standard definition of require() is used, and you
would overdetect dependencies in those very few cases where someone
has another require() function.
So, it just becomes a tiny bit more difficult to do such an analysis,
but it shouldn't be very much.
Adding another syntax for specifying relationships, one that can't do
anything the already existing syntaxes can do, seems to me to not give
any real added value. It just makes the language larger and more
unweildly and difficult to learn.
/Bellman
--
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.