OK. I sort of see what's happening there, but the original
example is much
more surprising (and incorrect, to my eyes). When you do:
> DEFAULT = e f ;
> VAR = ;
> echo xxx-$(VAR:E=$(DEFAULT)) ;
You're getting two elements in the output list because VAR
is empty, so it
resolves to the contents of DEFAULT, which contains two
items. Those get
multiplied by the prefix, producing the expected output.
In the original case:
> DEFAULT = e f ;
> VAR = a b c ;
> echo $(VAR:E=$(DEFAULT)) ;
> >jam
> a b c a b c
I don't see what's happening here. Because DEFAULT
contains two items, the
:E modifier doubles the length of the list?! Why? The
semantics of
$(VAR:E=$(DEFAULT)) should be: "If VAR is not empty,
give me the contents of
VAR. If VAR is empty, give me the contents of
DEFAULT". Instead, it seems to
be ... no nevermind, I can't come up with an explanation
that makes any
sense. ( "If VAR is empty, give me DEFAULT. If VAR is
not empty, then for
each element of DEFAULT, give me another copy of VAR?"
)
Am I missing something here?
-Brian
----- Original Message -----
From: "Christopher Seiwald" <seiwald perforce.com>
To: <cjamallsop gmail.com>; <jamming perforce.com>
Sent: Wednesday, September 06, 2006 12:45 PM
Subject: Re: [jamming] Expansion Problem?
>| Using jam 2.5 - is this normal?
> |
> | DEFAULT = e f ;
> | VAR = a b c ;
> | echo $(VAR:E=$(DEFAULT)) ;
> |
> | >jam
> | a b c a b c
> | ...found 7 target(s)...
> |
> | The E modifier should only use it's value if the
variable is unset?
>
> It's consistent with the rest of the productizing
variable expansion.
>
> Just as if you said:
>
> DEFAULT = e f ;
> VAR = ;
> echo xxx-$(VAR:E=$(DEFAULT)) ;
>
> You'd get
>
> % jam
> xxx-e xxx-f
>
> That's not to say it is useful or not surprising, but
it is the way the
> rest of it works.
>
> Christopher
> _______________________________________________
> jamming mailing list - jamming perforce.com
> http://maillist.perforce.com/mailman/listinfo/jamming
>
>
_______________________________________________
jamming mailing list - jamming perforce.com
http://maillist.perforce.com/mailman/listinfo/jamming
|