On Feb 4, 2011, at 7:40 AM, Thomas Bellman wrote:

> 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.

How about we split down the middle - you add the analysis to the current system 
to rely on require, and I'll merge it. :)

You do make good points, and you could have a reasonable analysis done on the 
current state, but it would always get complicated.  E.g, the analysis would 
need to know about nested classes and conditionals.  Also, it wouldn't work for 
classes written using the ruby DSL (although we could add a separate syntax 
there).

And, generally, I far prefer the model where things like this are just 
statically declared if at all possible.  I could quite possibly be wrong on 
this, but it's my instincts are pushing strongly for static declaration.

-- 
A conservative is a man who believes that nothing should be done for
the first time.        --Alfred E. Wiggam
---------------------------------------------------------------------
Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199




-- 
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.

Reply via email to