cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: [C2/Patch] Selector Heaven :-)
Date Fri, 01 Dec 2000 14:00:10 GMT

Giacomo Pati a écrit :
> --- Marcus Crafter <> wrote:
> > Hi All,
> >
> >       Hope all is going well across the Cocoon globe!
> >
> >       Attached is a set of files to add initial support for the following
> >       selectors to Cocoon 2:
> >
> Yes I have :) Does it make sense to combine all Selectors above into
> one and use a syntax like
>   <map:when test="parameter.myparm eq "foo" and session.myvar gt 3"/>
> I mean can we prefix the context of the variable used to test (header,
> parameter, session, context so far).

Mmmmh... Marcus did a very nice job, but that remembers me of a
discussion in the thread "[C2]Action proposal (long)" at the beginning
of november where I was warning about the possible temptation of
defining yet another scripting language for the sitemap to handle
complex sites. Seems your proposal looks like the early stages of a
boolean expression language...

Two points against that :
- C2 was made with speed in mind, and the sitemap is the central
dispatch point of the web site. As such, it must be as quick as
possible, and parsing and interpreting a script expression at each and
every request seems to me a big waste of CPU.
- this is yet another language to learn.

So why not allow these expressions to be raw Java boolean expression
which the CodeFactory can include as is in the sitemap generated code,
thus avoiding interpretation overhead ?

Sitemap managers may not be fluent in Java (but I think they will very
likely know JavaScript), but Java boolean expressions are simple enough
to be learned as quickly as a new language.

> >
> >       I have lots of questions though! - Are there other
> >       operators/types people would like to use ? Are there any functions
> >       people would like to use ? (eg. I thought about being able to test
> > the
> >       length of a request parameter in a selector ?), etc. Do people want
> > to
> >       compare floating point numbers internationally (ie. 0.00 in
> > Australia,
> >       and 0,00 in Germany ?). Are the chosen english style operator
> >       names ok ? etc. What other kinds of selectors would be appropriate ?
> >       And then comes the subject of documentation ?? :-)
> >
> >       Ok, Well I'll leave it there for the moment. Look forward to
> > responses.
> >

Just express the conditions in Java, and all these question will have an
instant answer ;-)

Sylvain Wallez
Anyware Technologies

View raw message