roxen.lists.roxen.general

Subject Author Date
Re: incompatibility between 4.5 and 5.0? Martin Stjernholm <mast[at]roxen[dot]com> 23-01-2009
"Stephen R. van den Berg" <<srb[at]cuci.nl>> wrote:

> <set variable="var.tmp" />
>
> which I use a lot to actually set the variable to RXML.empty, behaves
> differently in conjunction with <append /> in 5.0.
>
> Following the above set with:
>
> <append variable="var.tmp" value="hello" />
>
> Results in 4.5:   &var.tmp; == "hello"
> Results in 5.0:	  &var.tmp; == ({RXML.empty, "hello"})

Even disregarding the compat issue, I think the 4.5 behavior makes
more sense since RXML.empty should adapt itself to a suitable type for
the context, and the context here is defined by the second operand,
i.e. the string "hello". Thus it should behave as if "hello" is
appended to "".

> David Hunter wrote:
>>Would &var.tmp; == ({RXML.empty, "hello"})  be expect if <append
>>type='array'> in 5.0 ?
>
> Good question.  I'd expect a mere (), I think, since
> conceptually I'd consider:
> <set variable="var.tmp" type=array />
> to be equivalent to var.tmp = ({})
> and therefore, <append variable="var.tmp" value="hello" />
> would become var.tmp = ({}) + () = ()

I agree. That also follows from the reasoning that RXML.empty adapts
its type according to the context.

Fixed now, thanks for bringing it up.