On Tue, Feb 1, 2011 at 10:47 PM, Luke Kanies <l...@puppetlabs.com> 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 {...}



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



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



>  --
> Should I say "I believe in physics", or "I know that physics is true"?
>                 -- Ludwig Wittgenstein, On Certainty, 602.
> ---------------------------------------------------------------------
>
> 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 puppet-dev@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-dev+unsubscr...@googlegroups.com<puppet-dev%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-dev?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to