cfengine-develop
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Cfengine-develop] Re: Homework


From: Andrews, Martin
Subject: RE: [Cfengine-develop] Re: Homework
Date: Thu, 6 Mar 2003 06:59:29 -0500

Andrew,

I expected you meant this sort of mechanics for multiple interpolation - I
just think it is really dangerous and wanted to see an example use case. If
we did go with such a feature how about very explicit function-like wrappers
for it like:

        this = ( "that" )
        exactly = literal( "do not substitute $(this)")
        doubly = substitute( "$(exactly)" )

giving

this="that"
exactly="do not substitute $(this)"
double="do not substitute that"

Martin
----
Martin Andrews
address@hidden 

> -----Original Message-----
> From: Andrew Stribblehill [mailto:address@hidden
> Sent: Thursday, March 06, 2003 5:35 AM
> To: address@hidden
> Subject: Re: [Cfengine-develop] Re: Homework
> 
> 
> Quoting Andrews, Martin <address@hidden> 
> (2003-03-05 10:42:07 GMT):
> > Not sure where you are going with multiple interpolation - 
> how would you use
> > that. The current method to avoid single interpolation by 
> escaping the
> > refence as "echo $(DOLLAR)(myvar)" has worked for me so far.
> 
> Mmm, that's a lot of typing to stop it doing something you could
> argue it shouldn't do anyway. Oh, and "echo not_a_function()" seems
> to currently upset cfengine, causing it to complain that
> not_a_function isn't a builtin function. Even when I replace () with
> $(leftparen)$(rightparen), appropriately defined.
> 
> Multiple interpolation works like this:
> 
> control:
>   foo = ( '$(bar)' ) # Not interpolated
>   bar = ( "Baz" )
> 
> alerts:
>   geese:: "There is a goose called '$(foo)' in the building." \
>     with default with default
> 
> The last line tells it to interpolate using the variables in the
> default namespace twice. First interpolation turns $(foo) into the
> literal $(bar).  Second one works on the newly-created string and
> turns $(bar) into 3.
> 
> It's a big culture shock to change a language from implicit
> interpolation to explicit, however.
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]