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 }").
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.)
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. :)
--
Ian Ward Comfort <[email protected]>
Systems Team Lead, Academic Computing Services, Stanford University
--
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.