You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Jason van Zyl <jv...@periapt.com> on 2000/08/28 19:44:25 UTC
WebMacro Methods
Hey,
I was just looking through the WM code. Can someone
tell me if this is the case? Can WM only do methods
of the following form:
$order.getCustomer("Fred").getName().Last
Where methods can only have single parameters?
Can you do something like:
$order.getThis("param1", $param2, $foo.Order, $bar.get("this", "that",
$theOther))
Can WM handle methods themselves as parameters, and can
the methods have multiple parameters.
Recursively parsing methods is something I started adding
to Velocity, but was having problems with the grammar.
That's what I would like eventually, but for now I
would like to take the method evaluation code out
of WM, until I implement recursive method parsing.
It doesn't look like WM implements it. As far as
web design the use of nest methods would be rare,
if at all. But as a general utility used by programmers
it would probably be useful.
Justin, are you there? I would really like your ok
before I use your WM code as a matter of courtesy.
And I would like to put you on the contributors'
list as well.
jvz.
--
Jason van Zyl
jvanzyl@periapt.com
Re: WebMacro Methods
Posted by Jon Stevens <jo...@latchkey.com>.
on 8/28/2000 10:51 AM, "Jason van Zyl" <jv...@periapt.com> wrote:
> so I would just like
> to use the WM method stuff right now so we can get
> some compatibility going.
+1
-jon
--
http://scarab.tigris.org/ | http://noodle.tigris.org/
http://java.apache.org/ | http://java.apache.org/turbine/
http://www.working-dogs.com/ | http://jakarta.apache.org/velocity/
http://www.collab.net/ | http://www.sourcexchange.com/
Re: WebMacro Methods
Posted by "Daniel L. Rall" <dl...@finemaltcoding.com>.
bob wrote:
>
> Yah, WM handles that Just Fine. Things of the form
>
> $foo.bar($arg)
>
> should be handled by the parser rule, and won't need extra
> interpretation.
>
> $foo.bar("$arg is nice")
>
> will need an additional round on interpretation on the String,
> since the parser/lexer should be treating quoting strings as
> fairly opaque when used as an argument to a function.
>
> Also, WM can, I think, do magic with
>
> $foo.ByFirstName.bob
>
> turning it into
>
> foo.getByFirstName("bob")
>
> Another wacky thing iSpock can do
>
> $foo.($use.this).bar
>
> It'll resolve the parenthetical portion, and use the result
> in the actual walking of the objects, maybe resulting in
>
> $foo.goober.bar
I'd really like to limit the number of wacky things that the parser
can/will do. Let's attempt to provide only one way to do things--this
will greatly simplify the life of the template developer, and thus
simplify our lives as well (less ways to screw up, less internal tech
support and debugging questions).
--
Daniel Rall <dl...@finemaltcoding.com>
Re: WebMacro Methods
Posted by Jon Stevens <jo...@latchkey.com>.
on 8/28/2000 11:14 AM, "bob" <bo...@accurev.com> wrote:
> $foo.($use.this).bar
>
> It'll resolve the parenthetical portion, and use the result
> in the actual walking of the objects, maybe resulting in
>
> $foo.goober.bar
very cool. dynamic method invocation. :-) although this is a bit scary as it
isn't web designer friendly at all. they aren't going to understand what
this does at all.
-jon
--
http://scarab.tigris.org/ | http://noodle.tigris.org/
http://java.apache.org/ | http://java.apache.org/turbine/
http://www.working-dogs.com/ | http://jakarta.apache.org/velocity/
http://www.collab.net/ | http://www.sourcexchange.com/
Re: WebMacro Methods
Posted by bob <bo...@accurev.com>.
Yah, WM handles that Just Fine. Things of the form
$foo.bar($arg)
should be handled by the parser rule, and won't need extra
interpretation.
$foo.bar("$arg is nice")
will need an additional round on interpretation on the String,
since the parser/lexer should be treating quoting strings as
fairly opaque when used as an argument to a function.
Also, WM can, I think, do magic with
$foo.ByFirstName.bob
turning it into
foo.getByFirstName("bob")
Another wacky thing iSpock can do
$foo.($use.this).bar
It'll resolve the parenthetical portion, and use the result
in the actual walking of the objects, maybe resulting in
$foo.goober.bar
> Let me explain a bit further. Velocity can
> actually parse anything like this:
>
> $object.getThis("this", $that, $foo.Bar, $foo.getBar($voo.Doo("to", $you,
> $too))
>
> But right now I grab it as entire token. And Velocity can't
> really do much with it right now because of that fact. I didn't
> want to write a little parser to deal with because all the
> parameters to the methods should end up as nodes that
> I can recursively evaluate so any arbitrary nesting will
> work. I've had problems doing this, so I would just like
> to use the WM method stuff right now so we can get
> some compatibility going.
Re: WebMacro Methods
Posted by Jason van Zyl <jv...@periapt.com>.
Hi,
Let me explain a bit further. Velocity can
actually parse anything like this:
$object.getThis("this", $that, $foo.Bar, $foo.getBar($voo.Doo("to", $you,
$too))
But right now I grab it as entire token. And Velocity can't
really do much with it right now because of that fact. I didn't
want to write a little parser to deal with because all the
parameters to the methods should end up as nodes that
I can recursively evaluate so any arbitrary nesting will
work. I've had problems doing this, so I would just like
to use the WM method stuff right now so we can get
some compatibility going.
jvz.
On Mon, 28 Aug 2000, Jason van Zyl wrote:
> Hey,
>
> I was just looking through the WM code. Can someone
> tell me if this is the case? Can WM only do methods
> of the following form:
>
> $order.getCustomer("Fred").getName().Last
>
> Where methods can only have single parameters?
>
> Can you do something like:
>
> $order.getThis("param1", $param2, $foo.Order, $bar.get("this", "that",
> $theOther))
>
> Can WM handle methods themselves as parameters, and can
> the methods have multiple parameters.
>
> Recursively parsing methods is something I started adding
> to Velocity, but was having problems with the grammar.
> That's what I would like eventually, but for now I
> would like to take the method evaluation code out
> of WM, until I implement recursive method parsing.
>
> It doesn't look like WM implements it. As far as
> web design the use of nest methods would be rare,
> if at all. But as a general utility used by programmers
> it would probably be useful.
>
> Justin, are you there? I would really like your ok
> before I use your WM code as a matter of courtesy.
> And I would like to put you on the contributors'
> list as well.
>
> jvz.
>
>
--
Jason van Zyl
jvanzyl@periapt.com