Forum: Cfengine Help
Subject: Re: defining inline bodies
Author: sauer
Link to topic: https://cfengine.com/forum/read.php?3,21859,21939#msg-21939

Seva Gluschenko Wrote:
-------------------------------------------------------
> Sauer,
> 
> since your proposal makes parsing more
> complicated, I doubt seriously that it would be
> accepted by developers. As for me, I'd rather like
> to see ability to specify containing body
> parameters as ordinary ones, like:
> 
> commands:
>   "$(command)"
>     useshell => "false",
>     umask => "002";
> 
> but I doubt it would be accepted, too.

I'd suggest that this would be impossible, as it pollutes the namespace of the 
command oject with potentially conflicting attributes of different objects 
(contain, etc).

The use of inlined bodies would be analogous to anonymous references, such as 
are used heavily in perl.  I don't see it being a huge parsing complexity; the 
RHS of an attribute is a value of an expected type, and if the first character 
of that value is an opening brace, you just find the closing brace (following 
the same rules which are already used to define blocks) and assign the inline 
body a unique name using .

The main argument is probably more along the lines of lost modularity and the 
potential for marginally more complex code.  But in the case where I just want 
to define something like one or two attributes of a compound body, I'd make the 
argument that this enhanced syntax would potentially lead to the ability to be 
more expressive.  Rather than having to search for the compound body 
definition, which could well be in another file, one can just look directly at 
the body definition which is inline.

But anyway - the point was to ask if there is currently a syntax for this or 
not.  Having not seen a "yes, here's how:," I'll presume the answer is no.  The 
debate over its merits and issues would probably be just as well done in the 
bug tracker in a feature request. :)

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

Reply via email to