cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Gawron <lgaw...@mobilebox.pl>
Subject Re: cocoon-template incompatible change
Date Mon, 27 Aug 2007 09:23:22 GMT
Grzegorz Kossakowski wrote:
> Leszek Gawron pisze:
>> I may be biased but I would expect exactly the first case. I made a
>> mistake in previous mail proposing jx:if to be scoped. Please mind that
>> jx:set always puts a variable in current scope so you are not able to
>> change variable value:
>>
>> <jx:set var="foo" value="bar"/>
>> <jx:if test="true">
>>   <jx:set var="foo" value="bazzz"/>
>> </jx:if>
>> <test>${foo}</test>
>> </root>
>>
>> should result in <test>bazzz</test> otherwise people will get very
>> confused. A common user won't find the case much different from:
>>
>> <jx:set var="foo" value="bar"/>
>> <jx:set var="foo" value="bazzz"/>
>> <test>${foo}</test>
>>
>> which in turn works as expected.
>>
>> Long time ago we have already discussed about introducing jx:declare
>> along with jx:set. I cannot recall if any consensus was met.
> 
> I remember that I have read that discussion and I agree that there was no clear consensus.
> 
> I also remember that there were several folks expressing their opinion that jx should
as far from
> imperative programming language as possible. I second that opinion so I'm quite concerned
with your
> example. It is a programming language.
> XSLT lives without such constructs so could you give us a use case for this one?

I never used one like this :) Still the problem remains as not every 
cocoon user knows xslt and the example I gave would feel natural for him.

> Nevertheless, we need to fix scoping now so we really need to gather some consensus when
new local
> context should be established.

My proposal is:

No new scope for:
- any plain xml element (namespaced or not). by plain I mean not macro 
invocation.
- jx:import without context set
- formatting instructions (jx:formatDate, jx:formatNumber)

New strict scope for (strict scope - no inheritance, still all cocoon.* 
should be available):
- jx:call (same for <macroName/> invocation)
- jx:import context="${bean}"
- jx:macro

New inherited scope for:
- jx:forEach
- jx:if ??
- jx:choose/jx:when/jx:otherwise ??

last two (jx:if, jx:choose) are currently NOT scoped.

-- 
Leszek Gawron                         http://www.mobilebox.pl/krs.html
CTO at MobileBox Ltd.


Mime
View raw message