cfengine-develop
[Top][All Lists]
Advanced

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

Re: [Cfengine-develop] Re: Homework


From: Andrew Stribblehill
Subject: Re: [Cfengine-develop] Re: Homework
Date: Thu, 6 Mar 2003 10:34:57 +0000
User-agent: Mutt/1.5.3i

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.

-- 
SOUTHEAST ICELAND
CYCLONIC BECOMING NORTHEAST 5 TO 7, PERHAPS GALE 8 LATER. OCCASIONAL
RAIN. MODERATE OR GOOD




reply via email to

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