cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: FlowScript Parameters, Re: How to access sitemap parameter within JavaFlow?
Date Fri, 05 Nov 2004 21:50:28 GMT
Vadim Gritsenko wrote:

> Sylvain Wallez wrote:
>
>> Michael Gerzabek wrote:
>>
>>> Of course you can do. When you declare a sitemap flow function call 
>>> like above your flow method must be declared like
>>>
>>> function myJavaFlowMethod( foo ) {
>>> }
>>>
>>> and a "print( foo );" within this method should show "bar" in your 
>>> Console.
>>
>>
>>
>> I strongly suggest you *do not use it this way*, as it is highly 
>> misleading: <map:parameter> are name/value associations whereas JS 
>> function parameters are only positional, which means the "foo" you 
>> write in the function declaration has absolutely no relation with the 
>> "foo" in <map:parameter>.
>
>
> ...
>
>> I've been wanting to remove forbid this for a long time, but didn't 
>> knew how to identify JS functions with parameters, in order to issue 
>> a proper error message if this buggy construct is used. Looking a bit 
>> closer to Rhino, I now found it: NativeFunction has a getArity() 
>> method which is the number of parameters. We could then raise an 
>> error if getArity() != 0.
>>
>> What do people think?
>
>
> IMHO, write ERROR in the log in 2.1.6, throw exception in 2.1.7, 
> remove any traces of this in 2.2. Too draconian? :)


Oh no, sounds very good!

Should we start a vote on this?

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Mime
View raw message