On 14/12/2011 09:45, no-re...@cfengine.com wrote:
> 3) Why is there a difference between global and local classes? In many cases 
> I would prefer to have my local classes to be global. On the other hand I 
> didn't see a case yet where I wanted a global class to be local. If you're 
> afraid of name collisions, you could always apply the "ifvarclass" trick and 
> put a variable in the class name. Now it's just confusing that ifvarclass 
> does generate global classes inside a "local" bundle, while regular class 
> defintions don't.
>
>
I find the difference between local and global classes to be very 
useful. I tend to reuse class name a lot, between bundles (on bundle 
defines classes as the outcome of a promise, another one uses it), or 
use same name and know there won't be any name collision (the example 
given with the ifvarclass won't help, i reuse my variable name a lot, 
like "isfile_1" and file[1])
> 4) While talking about ifvarclass: this function is very useful, but it also 
> feels a bit unnatural and makes the code hard to read, as you have to look at 
> two places for class restrictions. It would be much nicer if you could just 
> put it all in front, like this:
>
> commands:
>    restart_$(service)::
>
> I realize it might violate the syntax rules because there are no quotes 
> around the class, but it would feel so much more natural...
>
That would ease some writing for sure, but is it really feasible ?

Regards
Nicolas
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to