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/09/09 23:02:28 UTC
Arithmetic
Hey,
Can we add arithmetic to the template specification.
Arithmetic is parsing fine, so I'd like to add
the functionality to the visitor. Actually I
would have to add the functionality to the
visitor anyway to deal with arithmetic that
happened in conditional expressions like:
#if (($a + $b) > $c)
And I propose to use the #set like this:
#set $foo = 1
#set $foo = $foo + 1
#set $foo = ($a - $b) + $c
jvz.
--
Jason van Zyl
jvanzyl@periapt.com
Re: Arithmetic
Posted by Jason van Zyl <jv...@periapt.com>.
On Thu, 14 Sep 2000, Daniel L. Rall wrote:
> Jason van Zyl wrote:
> >
> > Hey,
> >
> > Can we add arithmetic to the template specification.
> > Arithmetic is parsing fine, so I'd like to add
> > the functionality to the visitor. Actually I
> > would have to add the functionality to the
> > visitor anyway to deal with arithmetic that
> > happened in conditional expressions like:
> >
> > #if (($a + $b) > $c)
> >
> > And I propose to use the #set like this:
> >
> > #set $foo = 1
> > #set $foo = $foo + 1
> > #set $foo = ($a - $b) + $c
>
> Yay, +1!
> (sorry for the delayed response)
Not a problem, have my head down in an overhaul
anyway :)
jvz.
--
Jason van Zyl
jvanzyl@periapt.com
Re: Arithmetic
Posted by "Daniel L. Rall" <dl...@collab.net>.
Jason van Zyl wrote:
>
> Hey,
>
> Can we add arithmetic to the template specification.
> Arithmetic is parsing fine, so I'd like to add
> the functionality to the visitor. Actually I
> would have to add the functionality to the
> visitor anyway to deal with arithmetic that
> happened in conditional expressions like:
>
> #if (($a + $b) > $c)
>
> And I propose to use the #set like this:
>
> #set $foo = 1
> #set $foo = $foo + 1
> #set $foo = ($a - $b) + $c
Yay, +1!
(sorry for the delayed response)
--
Daniel Rall <dl...@collab.net>
http://collab.net/ | open source | do the right thing
Re: Arithmetic
Posted by Frank Conradie <fr...@opticode.co.za>.
----- Original Message -----
From: "Daniel L. Rall" <dl...@collab.net>
To: <ve...@jakarta.apache.org>
Sent: Friday, September 15, 2000 3:39 AM
Subject: Re: Arithmetic
> bob wrote:
> > [snip]
> > > As unbelievable as it may seem, I've found that even graphic designers
> > > are capable of simple arithmatic. ;)
> >
> > Oh sure, I'm not disputing that at all.
> >
> > My point is that if you choose WebMacro/Velocity for it's
> > benefits of MVC separation, and then add back arithmetic, you
> > possibly have taken a step back from the whole point of the MVC
> > stuff. Arithmetic tends to lead to logic, and we don't want
> > to encourage logic in the templates, necessarily.
>
> My first hand experience--from having to write and use helper object for
> WebMacro--leads me to believe that the arithmetic used in templates
> doesn't constitute business logic. It is generally presentation
> related. I understand your concern about MVC separation (I'm all about
> that), and was not trying to make light of it (just of the arithmetic
> part ;). I just have a different opinion about how and why template
> designers use arithematic. =)
I have to agree with Daniel here - I had a look through a lot of our
templates, and the need for arithmetic almost always has something to do
with presentational logic.
Frank
Re: Arithmetic
Posted by "Daniel L. Rall" <dl...@collab.net>.
bob wrote:
> [snip]
> > As unbelievable as it may seem, I've found that even graphic designers
> > are capable of simple arithmatic. ;)
>
> Oh sure, I'm not disputing that at all.
>
> My point is that if you choose WebMacro/Velocity for it's
> benefits of MVC separation, and then add back arithmetic, you
> possibly have taken a step back from the whole point of the MVC
> stuff. Arithmetic tends to lead to logic, and we don't want
> to encourage logic in the templates, necessarily.
My first hand experience--from having to write and use helper object for
WebMacro--leads me to believe that the arithmetic used in templates
doesn't constitute business logic. It is generally presentation
related. I understand your concern about MVC separation (I'm all about
that), and was not trying to make light of it (just of the arithmetic
part ;). I just have a different opinion about how and why template
designers use arithematic. =)
--
Daniel Rall <dl...@collab.net>
http://collab.net/ | open source | do the right thing
Re: Arithmetic
Posted by bob <bo...@accurev.com>.
> > Jason says that folks have requested this.
> >
> > I'm fundamentally opposed (but won't veto it).
> >
> > But, I'd like to collect use-cases from folks, as to
> > why they think they need arithmetic in a template.
> >
> > I think we can find Better Solutions than putting
> > math in HTML by a graphic-designer.
>
> As unbelievable as it may seem, I've found that even graphic designers
> are capable of simple arithmatic. ;)
Oh sure, I'm not disputing that at all.
My point is that if you choose WebMacro/Velocity for it's
benefits of MVC separation, and then add back arithmetic, you
possibly have taken a step back from the whole point of the MVC
stuff. Arithmetic tends to lead to logic, and we don't want
to encourage logic in the templates, necessarily.
-bob
Re: Arithmetic
Posted by "Daniel L. Rall" <dl...@collab.net>.
bob wrote:
>
> Jason says that folks have requested this.
>
> I'm fundamentally opposed (but won't veto it).
>
> But, I'd like to collect use-cases from folks, as to
> why they think they need arithmetic in a template.
>
> I think we can find Better Solutions than putting
> math in HTML by a graphic-designer.
As unbelievable as it may seem, I've found that even graphic designers
are capable of simple arithmatic. ;)
--
Daniel Rall <dl...@collab.net>
http://collab.net/ | open source | do the right thing
Re: Arithmetic
Posted by Travis Low <tl...@iitedge.com>.
Oh, then my apologies. I misunderstood.
As for the Better Solution, it should syntactically resemble other
Good Solutions. I believe the exact syntax doesn't matter. It's more
important to not require designers to use a syntax that they don't
already use. So if designers are accustomed to the ersatz-method
invocation syntax, then that would be fine. Otherwise, I'd go with
the #set syntax that Jason proposed on the velocity-users list.
As for being "heavily promoted", I wouldn't do that. I'd just
document it with the rest of the core velocity template language. I
do believe that arithmetic operations should be in the core, since
arithmetic is a core function of graphic design, especially of web
design.
Travis
Jason van Zyl wrote:
>
> On Mon, 11 Sep 2000, Travis Low wrote:
>
> > As a graphic artist (turned developer) with 5 years of production art
> > experience, and 20 years freelance experience, I'd rather you
> > explained why I DON'T need arithmetic. Or show me a graphics shop
> > where there are no rulers or calculators. Or show me a popular
> > graphics program that doesn't have little rulers around the display
> > area. :-)
> >
> > Artists have used simple arithmetic since art was invented.
> >
> > I did post some use cases to the velocity-users list, btw.
>
> Bob wasn't implying that graphic designers don't use
> arithmetic. I think he was saying that if there is
> a need, there might be a better way to have it present
> in templates.
>
> Maybe through a series of helper methods:
>
> $tool.add(...)
> $tool.substract(...)
>
> I'm not exactly sure what all the helper methods would
> look like, but we might even be able to have helper
> methods for logical and relational operations.
>
> I myself would like to have arithmetic be possible,
> but it might not necessarily be something
> that's heavily promoted. Arithmetic may be
> allowed, but we could also provide a set of
> helper methods that can be used for arithmetic
> for possibly easier to understand templates.
>
> jvz.
>
> > bob wrote:
> > >
> > > Jason says that folks have requested this.
> > >
> > > I'm fundamentally opposed (but won't veto it).
> > >
> > > But, I'd like to collect use-cases from folks, as to
> > > why they think they need arithmetic in a template.
> > >
> > > I think we can find Better Solutions than putting
> > > math in HTML by a graphic-designer.
> > >
> > > -bob
> > >
> > > On Sat, 9 Sep 2000, Jason van Zyl wrote:
> > >
> > > > Hey,
> > > >
> > > > Can we add arithmetic to the template specification.
> > > > Arithmetic is parsing fine, so I'd like to add
> > > > the functionality to the visitor. Actually I
> > > > would have to add the functionality to the
> > > > visitor anyway to deal with arithmetic that
> > > > happened in conditional expressions like:
> > > >
> > > > #if (($a + $b) > $c)
> > > >
> > > > And I propose to use the #set like this:
> > > >
> > > > #set $foo = 1
> > > > #set $foo = $foo + 1
> > > > #set $foo = ($a - $b) + $c
> > > >
> > > > jvz.
> > > >
> > > > --
> > > >
> > > > Jason van Zyl
> > > > jvanzyl@periapt.com
> > > >
Re: Arithmetic
Posted by Jason van Zyl <jv...@periapt.com>.
On Mon, 11 Sep 2000, Travis Low wrote:
> As a graphic artist (turned developer) with 5 years of production art
> experience, and 20 years freelance experience, I'd rather you
> explained why I DON'T need arithmetic. Or show me a graphics shop
> where there are no rulers or calculators. Or show me a popular
> graphics program that doesn't have little rulers around the display
> area. :-)
>
> Artists have used simple arithmetic since art was invented.
>
> I did post some use cases to the velocity-users list, btw.
Bob wasn't implying that graphic designers don't use
arithmetic. I think he was saying that if there is
a need, there might be a better way to have it present
in templates.
Maybe through a series of helper methods:
$tool.add(...)
$tool.substract(...)
I'm not exactly sure what all the helper methods would
look like, but we might even be able to have helper
methods for logical and relational operations.
I myself would like to have arithmetic be possible,
but it might not necessarily be something
that's heavily promoted. Arithmetic may be
allowed, but we could also provide a set of
helper methods that can be used for arithmetic
for possibly easier to understand templates.
jvz.
> bob wrote:
> >
> > Jason says that folks have requested this.
> >
> > I'm fundamentally opposed (but won't veto it).
> >
> > But, I'd like to collect use-cases from folks, as to
> > why they think they need arithmetic in a template.
> >
> > I think we can find Better Solutions than putting
> > math in HTML by a graphic-designer.
> >
> > -bob
> >
> > On Sat, 9 Sep 2000, Jason van Zyl wrote:
> >
> > > Hey,
> > >
> > > Can we add arithmetic to the template specification.
> > > Arithmetic is parsing fine, so I'd like to add
> > > the functionality to the visitor. Actually I
> > > would have to add the functionality to the
> > > visitor anyway to deal with arithmetic that
> > > happened in conditional expressions like:
> > >
> > > #if (($a + $b) > $c)
> > >
> > > And I propose to use the #set like this:
> > >
> > > #set $foo = 1
> > > #set $foo = $foo + 1
> > > #set $foo = ($a - $b) + $c
> > >
> > > jvz.
> > >
> > > --
> > >
> > > Jason van Zyl
> > > jvanzyl@periapt.com
> > >
>
> -- Travis Low
> tlow@iitedge.com
> 1-301-592-6305 (direct)
>
--
Jason van Zyl
jvanzyl@periapt.com
Re: Arithmetic
Posted by Travis Low <tl...@iitedge.com>.
As a graphic artist (turned developer) with 5 years of production art
experience, and 20 years freelance experience, I'd rather you
explained why I DON'T need arithmetic. Or show me a graphics shop
where there are no rulers or calculators. Or show me a popular
graphics program that doesn't have little rulers around the display
area. :-)
Artists have used simple arithmetic since art was invented.
I did post some use cases to the velocity-users list, btw.
Travis
bob wrote:
>
> Jason says that folks have requested this.
>
> I'm fundamentally opposed (but won't veto it).
>
> But, I'd like to collect use-cases from folks, as to
> why they think they need arithmetic in a template.
>
> I think we can find Better Solutions than putting
> math in HTML by a graphic-designer.
>
> -bob
>
> On Sat, 9 Sep 2000, Jason van Zyl wrote:
>
> > Hey,
> >
> > Can we add arithmetic to the template specification.
> > Arithmetic is parsing fine, so I'd like to add
> > the functionality to the visitor. Actually I
> > would have to add the functionality to the
> > visitor anyway to deal with arithmetic that
> > happened in conditional expressions like:
> >
> > #if (($a + $b) > $c)
> >
> > And I propose to use the #set like this:
> >
> > #set $foo = 1
> > #set $foo = $foo + 1
> > #set $foo = ($a - $b) + $c
> >
> > jvz.
> >
> > --
> >
> > Jason van Zyl
> > jvanzyl@periapt.com
> >
-- Travis Low
tlow@iitedge.com
1-301-592-6305 (direct)
Re: Arithmetic
Posted by bob <bo...@accurev.com>.
Jason says that folks have requested this.
I'm fundamentally opposed (but won't veto it).
But, I'd like to collect use-cases from folks, as to
why they think they need arithmetic in a template.
I think we can find Better Solutions than putting
math in HTML by a graphic-designer.
-bob
On Sat, 9 Sep 2000, Jason van Zyl wrote:
> Hey,
>
> Can we add arithmetic to the template specification.
> Arithmetic is parsing fine, so I'd like to add
> the functionality to the visitor. Actually I
> would have to add the functionality to the
> visitor anyway to deal with arithmetic that
> happened in conditional expressions like:
>
> #if (($a + $b) > $c)
>
> And I propose to use the #set like this:
>
> #set $foo = 1
> #set $foo = $foo + 1
> #set $foo = ($a - $b) + $c
>
> jvz.
>
> --
>
> Jason van Zyl
> jvanzyl@periapt.com
>