On Feb 3, 2011, at 1:57 PM, Ian Ward Comfort wrote:

> On 3 Feb 2011, at 1:38 PM, Luke Kanies wrote:
>> On Feb 3, 2011, at 12:12 PM, Ian Ward Comfort wrote:
>>> On 3 Feb 2011, at 9:59 AM, Luke Kanies wrote:
>>>> On Feb 3, 2011, at 1:40 AM, Thomas Bellman wrote:
>>>>> What about the already existing syntax:
>>>>> 
>>>>> class foo inherits bar {
>>>>>    require boo, blah
>>>>>    ...
>>>>> }
>>>>> 
>>>>> 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?
>>> 
>>> The require function also includes the named classes without parameters, 
>>> correct?
>> 
>> I don't think I understand your question; can you elaborate?
> 
> My understanding (still theoretical, since we're 0.25 here) is that "require 
> foo" is just like "include foo", with an additional dependency between the 
> enclosing class and the foo class.  You only get the functionality of 
> "include"; you can't give parameters to foo if it is a parameterized class 
> ("class foo { param => value }").

That is correct.

> To my mind, that's the advantage of Dan's proposed "Self" keyword -- you can 
> use it to just set up the dependency, so you can declare the other class or 
> resource elsewhere with whatever parameters you like.  (You can also put it 
> on the LHS of the -> operator, whereas "require" or "requires" can only put 
> the class you're defining on the RHS, so to speak.)

That's just as true here - the dependency would have to have been declared 
elsewhere for my proposal to work.

Ideally, though, you'd use an ENC that declared all of these classes, and it 
would be smart enough to use the ResourceType REST API to query Puppet and ask 
what parameters are needed and what dependences exist for a given class. :)

> I'm sympathetic to the concerns voiced so far, though.  "Self" seems like 
> just syntactic sugar, since you can already do stuff like Dan's first snippet 
> in #5824.  I'm not sure if that's a point for or against, though. :)

I think it's unnecessarily complex at this point, especially since there are 
better syntaxes that provide a lot more function.


-- 
Good judgment comes from experience, and experience comes from bad
judgment.     --Barry LePatner
---------------------------------------------------------------------
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