velocity-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marinó A. Jónsson" <mari...@centrum.is>
Subject RE: integer division issue
Date Mon, 05 Jan 2004 01:06:00 GMT
I absolutely agree with Peter :)

+1 for #1 (with reservations about introducing an integer division operator
- I'm not wholeheartedly against it - but I think it belongs in a math
tool).

cheers,
Marinó

> -----Original Message-----
> From: Peter Romianowski [mailto:antarapero@gmx.de] 
> Sent: 4. janúar 2004 22:24
> To: Velocity Developers List
> Subject: Re: integer division issue
> 
> 
> Hi,
> 
> first - thanks to Will for adding a lot of "conclusion 
> oriented" thinking to this discussion. That does not mean 
> that the others would not do that! It's easier to decide 
> between 3 points clearly written down ;)
> 
> > (1) Make the / operator mean a floating point division, and add a 
> > integer division operator (perhaps \  or //)
> >         5 / 2 => 2.5
> >         5 / 2.5 => 2.0
> >         5 // 2 => 2
> > 
> > PROS:
> >   * most intuitive to non programmers (who may not understand the 
> > subtle difference between 2 and 2.0)
> > 
> > CONS:
> >    * breaks backwards compatibility (anyone have a sense of how 
> > frequently this is used?).
> 
> I'd *definetly* go for this option. One of the main goals of 
> velocity is to shield the template designer from all the 
> confusing programming stuff. That point I read quite often as 
> an argument in the discussions when someone comes around and 
> wants to add more programming capabilities to velocity. And 
> that point is really a BIG advantage of a template language! 
> So we keep the template designer away from things like "Hey, 
> is this a List, an Iterator or even an Array?" or "Am I 
> within a for-loop or am I going through a List?" or "Did I 
> declare that variable as a String or what before?". But when 
> it comes to math we say things
> like:
> 
> - 5 / 2 = 2
> - You can't do:
>    #set ($myvalue = 2.5)
> - You can't even do:
>    #if ($myvalue > 5) where $myvalue is anything but an Integer
> 
> So with these points in mind, I could say that the 
> velocity-math stuff was broken from the beginning. In sense 
> of "pure MVC" (often a point against FP) absolutely *no* 
> math-stuff should have been there in the first place. But by 
> adding it for convenience (I really appreciate that since I 
> don't follow the "pure MVC" movement :) it should have been 
> complete including FP. So the question could be
> 
> "Should we remove all the number/math stuff or make intuitive 
> number-handling the default".
> 
> And both would break backwards compatibility, by the way ;)
> 
> On the other hand I really understand Geir's problems with 
> all the backwards compatibility. He is the one in charge to 
> not distract the people from velocity. I already used some OS 
> software where the api changed within minor version numbers. 
> And that really sucks! On the other hand there are enough 
> arguments to break backwards compatibility in that (and 
> other) point(s). IIRC, Geir agreed to possibly break B.C. in 
> a 1.5 / 2.0 version (eons ago). Doing so would allow a lot of 
> improvements (including FP) and redesigns. Please don't let 
> the integer-only arithmetic be our A20-Gate!
> 
> And for the "I want/need integer division"-argument I'd say: 
> Use A Tool(tm) :) Seriously. I heard that argument a dozen 
> times and sometimes it is even meaningful. If you need 
> integer-division throw in a MathTool that contains a floor() 
> method. The Velocity-Tools-MathTools contains a div-method 
> which could be deprectated in favour of a floor() method ;)
> 
> > Are there other options?  My impression was that after extensive 
> > discussion this summer, there was a pretty good consensus 
> on option #1 
> > (e.g. the benefit was worth breaking b.c.)  Of course, 
> consensus can 
> > and does change over time.  How shall we proceed?
> 
> I had the same feeling about the consensus so I was a little 
> surprised by the raised discussion about 5 / 2 = 2.5 But of 
> course I agree - this issue has to be settled by the 
> community (finally).
> 
> Regards
> Peter
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


Mime
View raw message