ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <pe...@apache.org>
Subject Re: [myrmidon] -ref vs ${}
Date Sun, 07 Apr 2002 10:47:49 GMT
On Sun, 7 Apr 2002 20:02, Jose Alberto Fernandez wrote:
> > I just wanted to get peoples opinion on something I been playing with.
> > Currently in myrmidon the followin attributes will get identical values
> >
> > myAttribute="${value}"
> > myAttribute-ref="value"
>
> To me it all depends on the meaning of "${value}". The way I see it
> "${value}" corresponds to the string representation of "value". I say this,
> because it should not matter whether I pass "${value}" or "${value} is a
> value" the ${} operator should behave the same.

${} resolves to a value. If that value is inside a string then it will be 
converted to a string otherwise it wont be. This is a side-effect of unified 
namespace for properties and datatypes. 

> With that in mind, then 'myAttribute="${value}"' implies converting 'value'
> into its string representation and then converting it back to the type
> specified for 'myAttribute'.

Thats the way it used to be but asking around led me to believe that it was 
not intuitive that ${} allways be resolved and then converted to a string 
especially when it would need to be converted back into original object form.

> You could try to optimize away such
> conversions, but it means that you cannot pass a subtype that way because
> by definition it should behave like the value is being reconstructed from
> its string representation into that of the type of the attribute.

does not compute.

> > My question is do we need to support the "-ref" version of attribute
> > evaluation or is the first sfficient for all our use cases?
>
> In sumary:
>
>     <sometype id='value' ....../>
>     <sometask myAttribute='${value}'/>
>
> should be indistinguisable from:
>
>     <sometype id='value' ....../>
>     <property name='prop' value='${value}'/>
>     <sometask myAttribute='${prop}'/>

This will be true of all types because we unify the proeprty/datatype 
namespace.


-- 
Cheers,

Pete

---------------------------------------------------
"Wise men don't need advice. Fools don't take it." 
                        -Benjamin Franklin 
---------------------------------------------------

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message