On Feb 2, 2011, at 12:05 AM, Dan Bode wrote:
>
>
> On Tue, Feb 1, 2011 at 10:47 PM, Luke Kanies <[email protected]> wrote:
> On Feb 1, 2011, at 2:02 PM, Dan Bode wrote:
>
>> Hi all,
>>
>> I wanted to open the feature request
>> http://projects.puppetlabs.com/issues/5824 for discussion.
>>
>> I like to specify all dependencies not defined within the enclosed scope
>> using the new relationship syntax.
>>
>> This leads to nice clean error messages if the required resources have not
>> been declared.
>>
>> class foo (
>> $bar => 'baz'
>> ) {
>> Class['foo']->Class['super-ninja-app']
>> .. resources and what-not
>> }
>>
>> I often use this syntax to specify external dependencies of the class
>> itself. I am starting to use this pattern *a lot*
>>
>> Having to specify
>>
>> Class['foo']-> within class foo { }
>>
>> in less than optimal for two reasons:
>> 1. more characters
>> 2. if the name of the class changes, then the reference to the class also
>> needs to change
>>
>> I would like to introduce the 'self' keyword to be used in this situation.
>
> I think a far better solution is to support static declaration of class
> dependencies:
>
> class foo requires otherclass {...}
>
> or
>
> class foo requires Yay[boo] {...}
>
> that seems like it could be messy with inheritance as well.
>
> class foo requires Yay[boo], Yah[blah] inherits bar {...}
It could certainly get messy, but I don't think this is that bad, especially if
we stick to just requiring classes:
class foo requires [boo, blah] inherits bar {...}
> Although I expect it would be an antipattern for classes to require things
> other than classes and thus maybe shouldn't be supported.
>
> I would rather follow the basic principal of being flexible as we can. I am
> starting to get suspicious anytime anyone uses the word anti-pattern.
Heh. :)
Well, one of the points of the DSL is to be painfully simple.
> This would get you what you want, plus make it really easy to build a graph
> of classes and their relationships. Mmmm, graphs.
>
> If that were added, would you still want the 'self' keyword?
>
> that would suffice.
Great.
--
Consistency requires you to be as ignorant today as you were a year
ago. -- Bernard Berenson
---------------------------------------------------------------------
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.