ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject Re: How about ${fromRefId:some-reference}?
Date Fri, 04 Sep 2009 14:18:01 GMT
On Fri, Sep 4, 2009 at 6:25 AM, <> wrote:
>>I suggest to add another core PropertyEvaluator that works like the one
>>for toString but doesn't invoke toString() on the reference (but leaves
>>that to IntrospectionHelper if necessary).
>>The ${ref:} and ${refid:} ideas look prettier but are more likely to
>>collide with existing property names.
> Because you referencing an id I would prefer ${refid:*}.

Tasks in the past had to explicitly support this by adding a separate
attribute which typically (by convention) uses a "ref" suffix (classpath="...",
classpathref="..."), so having the following two notations
(classpathref="my_cp", classpath="${ref:my_cp}" equivalent leans
towards using ref:.

OTOH, for addFoo() (i.e. nested elements), we use <classpath refid="my_cp"/>,
so that points towards refid:.

Either way is fine with me. classpath="${refid:my_cp}" reads well.

> There can be collisions as this is possible
>  <project>
>    <property name="x:foo" value="bar"/>
>    <echoproperties prefix="x"/>
>  </project>
>  [echoproperties] x\:foo=bar
> but I think the ':' as seperation character is not a common use case.
> But in conclusion that would be a note in the "could break existing
> builds" section.

We could avoid ambiguity by not using a ${} notation...

I'm not sure I like the fact that ${} would start returning something
else than a String. Then there's classpath="foo${refid:my_cp}bar"...
When you mix literals and a reference, what happens?

I've always considered that expanding references should be
something part of the core, especially when writing all those
xyzref attributes in my own tasks.

Since references are introduced by using an id="abc" attribute,
and that such attributes in HTML are fragment which are accessed
using #abc in URLs, I'd prefer we introduce this notation to expand
references, rather than overloading ${}. #abc or #{abc}, the latter
being more consistent with our existing ${} and @{} notations.

BTW, we already have ${} and @{} which interact in interesting ways,
allowing to do ${foo@{bar}} inside a macro. How would #{} (or ${refid:})
interact here?

Sorry to raise concerns again... I'm just trying to see whether
reference expansion shouldn't be something built-in rather than
tacked on via PropertyHelper. --DD

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message