You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Nathan Bubna (JIRA)" <de...@velocity.apache.org> on 2009/02/17 22:44:59 UTC

[jira] Commented: (VELOCITY-700) Add #foreach keyword to specify #break level

    [ https://issues.apache.org/jira/browse/VELOCITY-700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12674366#action_12674366 ] 

Nathan Bubna commented on VELOCITY-700:
---------------------------------------

-1  no labels.  keep VTL simple, please.  it's not java, nor should it be.  the ease of teaching it and reading it are important to me.   FYI, i'm also still considering vetoing the #foreach( $user in $users index $i ) syntax, since i think it is ugly, unclear, and unnecessary.  the more i look at it, the more i dislike it. having that syntax in combo with this one would make my eyes water.  (please bear with my grumpy bluntness; i like you, i'm just very concerned about syntax choices.)

if you really feel it is necessary to control the break level, there is always the LoopTool in velocity tools.  yes, that's not that pretty either, but that is part of the point of VelocityTools.  keep ugly, but sometimes desirable features out of the core.

if you really feel it is important to have some better break control in the core, let's discuss other ways.  like perhaps an optional integer argument for #break, to indicate how many levels to break out of.   Something like that would at least avoid "uglifying" the #foreach syntax, for an unnecessary feature.

> Add #foreach keyword to specify #break level
> --------------------------------------------
>
>                 Key: VELOCITY-700
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-700
>             Project: Velocity
>          Issue Type: New Feature
>          Components: Engine
>    Affects Versions: 2.0
>            Reporter: Byron Foster
>
> if the last argument to to the #foreach directive is a word, then that word serves as a label to indicate the break level for the #break directive. Par exemple:
> #foreach($user in $users outer)
>     #foreach($email in $user.emails)
>         #if($email.expired)
>             #break(outer)
>         #end
>     #end
> #end

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


Re: VTL simplicity - was: [jira] Commented: (VELOCITY-700) Add #foreach keyword to specify #break level

Posted by Nathan Bubna <nb...@gmail.com>.
Every additional directive, syntax, and configuration option
complicates VTL.  They all add to what someone needs to know to be
able to read someone else's template.  And each new directive means
one less valid macro name or schmoo string that may need changing or
escaping.  I would actually love to see a decrease in the number of
options and directives in 2.0, though this is not the direction things
have been heading.  These are my general concerns; i'll open new
threads to handle the specific issues...

On Wed, Feb 18, 2009 at 5:35 AM, Byron Foster <by...@base2.cc> wrote:
>
> On Feb 17, 2009, at 23:19 , Claude Brisson wrote:
>
>> On mar, 2009-02-17 at 20:56 -0700, Byron Foster wrote:
>>>
>>> I believe firmly in not compromising the simplicity of VTL at the
>>> expense of additional functionality, and I think it's great that non-
>>> programmers can be productive in it.  I believe that all the changes I
>>> have proposed or implemented are consistent with that.  However, there
>>> are also sophisticated users of Velocity, I hope, that can make use of
>>> the additional control, and with the additional control make VTL
>>> templates more readable and maintainable.  I think these two uses of
>>> Velocity can easily coexist.
>>
>> Sophisticated users always find a way.
>>
>> #foreach($foo in $outer)
>>  #foreach($bar in $inner)
>>   #if($goAway) #set($leave = true) #end
>>   #break
>>  #end
>>  #if($leave) #break
>> #end
>
> Yea,  I won't argue #break functionality, as stated in the issue I don't
> really think it is necessary either.  I would say something more specific
> like #return, or as referenced in the issue, the use of an 'index' keyword
> in #foreach.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
> For additional commands, e-mail: dev-help@velocity.apache.org
>
>

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


Re: VTL simplicity - was: [jira] Commented: (VELOCITY-700) Add #foreach keyword to specify #break level

Posted by Byron Foster <by...@base2.cc>.
On Feb 17, 2009, at 23:19 , Claude Brisson wrote:

> On mar, 2009-02-17 at 20:56 -0700, Byron Foster wrote:
>> I believe firmly in not compromising the simplicity of VTL at the
>> expense of additional functionality, and I think it's great that non-
>> programmers can be productive in it.  I believe that all the  
>> changes I
>> have proposed or implemented are consistent with that.  However,  
>> there
>> are also sophisticated users of Velocity, I hope, that can make use  
>> of
>> the additional control, and with the additional control make VTL
>> templates more readable and maintainable.  I think these two uses of
>> Velocity can easily coexist.
>
> Sophisticated users always find a way.
>
> #foreach($foo in $outer)
>  #foreach($bar in $inner)
>    #if($goAway) #set($leave = true) #end
>    #break
>  #end
>  #if($leave) #break
> #end

Yea,  I won't argue #break functionality, as stated in the issue I  
don't really think it is necessary either.  I would say something more  
specific like #return, or as referenced in the issue, the use of an  
'index' keyword in #foreach.

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


Re: VTL simplicity - was: [jira] Commented: (VELOCITY-700) Add #foreach keyword to specify #break level

Posted by Claude Brisson <cl...@renegat.net>.
On mar, 2009-02-17 at 20:56 -0700, Byron Foster wrote:
> I believe firmly in not compromising the simplicity of VTL at the  
> expense of additional functionality, and I think it's great that non- 
> programmers can be productive in it.  I believe that all the changes I  
> have proposed or implemented are consistent with that.  However, there  
> are also sophisticated users of Velocity, I hope, that can make use of  
> the additional control, and with the additional control make VTL  
> templates more readable and maintainable.  I think these two uses of  
> Velocity can easily coexist.

Sophisticated users always find a way.

#foreach($foo in $outer)
  #foreach($bar in $inner)
    #if($goAway) #set($leave = true) #end
    #break
  #end
  #if($leave) #break
#end


  Claude

> On Feb 17, 2009, at 15:16 , matthijs lambooy wrote:
> 
> > I agree with Nathan
> > The simplicity of the VTL syntax has major importance for us since  
> > non programmers can easily
> > understand the syntax. Please keep it as simple as possible.
> >
> > Matthijs
> >
> >
> > Nathan Bubna (JIRA) wrote:
> >>    [ https://issues.apache.org/jira/browse/VELOCITY-700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12674366 
> >> #action_12674366 ]
> >> Nathan Bubna commented on VELOCITY-700:
> >> ---------------------------------------
> >>
> >> -1  no labels.  keep VTL simple, please.  it's not java, nor should  
> >> it be.  the ease of teaching it and reading it are important to  
> >> me.   FYI, i'm also still considering vetoing the #foreach( $user  
> >> in $users index $i ) syntax, since i think it is ugly, unclear, and  
> >> unnecessary.  the more i look at it, the more i dislike it. having  
> >> that syntax in combo with this one would make my eyes water.   
> >> (please bear with my grumpy bluntness; i like you, i'm just very  
> >> concerned about syntax choices.)
> >>
> >> if you really feel it is necessary to control the break level,  
> >> there is always the LoopTool in velocity tools.  yes, that's not  
> >> that pretty either, but that is part of the point of  
> >> VelocityTools.  keep ugly, but sometimes desirable features out of  
> >> the core.
> >>
> >> if you really feel it is important to have some better break  
> >> control in the core, let's discuss other ways.  like perhaps an  
> >> optional integer argument for #break, to indicate how many levels  
> >> to break out of.   Something like that would at least avoid  
> >> "uglifying" the #foreach syntax, for an unnecessary feature.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
> For additional commands, e-mail: dev-help@velocity.apache.org
> 


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


Re: VTL simplicity - was: [jira] Commented: (VELOCITY-700) Add #foreach keyword to specify #break level

Posted by Byron Foster <by...@base2.cc>.
I believe firmly in not compromising the simplicity of VTL at the  
expense of additional functionality, and I think it's great that non- 
programmers can be productive in it.  I believe that all the changes I  
have proposed or implemented are consistent with that.  However, there  
are also sophisticated users of Velocity, I hope, that can make use of  
the additional control, and with the additional control make VTL  
templates more readable and maintainable.  I think these two uses of  
Velocity can easily coexist.

On Feb 17, 2009, at 15:16 , matthijs lambooy wrote:

> I agree with Nathan
> The simplicity of the VTL syntax has major importance for us since  
> non programmers can easily
> understand the syntax. Please keep it as simple as possible.
>
> Matthijs
>
>
> Nathan Bubna (JIRA) wrote:
>>    [ https://issues.apache.org/jira/browse/VELOCITY-700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12674366 
>> #action_12674366 ]
>> Nathan Bubna commented on VELOCITY-700:
>> ---------------------------------------
>>
>> -1  no labels.  keep VTL simple, please.  it's not java, nor should  
>> it be.  the ease of teaching it and reading it are important to  
>> me.   FYI, i'm also still considering vetoing the #foreach( $user  
>> in $users index $i ) syntax, since i think it is ugly, unclear, and  
>> unnecessary.  the more i look at it, the more i dislike it. having  
>> that syntax in combo with this one would make my eyes water.   
>> (please bear with my grumpy bluntness; i like you, i'm just very  
>> concerned about syntax choices.)
>>
>> if you really feel it is necessary to control the break level,  
>> there is always the LoopTool in velocity tools.  yes, that's not  
>> that pretty either, but that is part of the point of  
>> VelocityTools.  keep ugly, but sometimes desirable features out of  
>> the core.
>>
>> if you really feel it is important to have some better break  
>> control in the core, let's discuss other ways.  like perhaps an  
>> optional integer argument for #break, to indicate how many levels  
>> to break out of.   Something like that would at least avoid  
>> "uglifying" the #foreach syntax, for an unnecessary feature.

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


Re: [jira] Commented: (VELOCITY-700) Add #foreach keyword to specify #break level

Posted by matthijs lambooy <la...@crossmarx.nl>.
I agree with Nathan
The simplicity of the VTL syntax has major importance for us since non 
programmers can easily
understand the syntax. Please keep it as simple as possible.

Matthijs


Nathan Bubna (JIRA) wrote:
>     [ https://issues.apache.org/jira/browse/VELOCITY-700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12674366#action_12674366 ] 
>
> Nathan Bubna commented on VELOCITY-700:
> ---------------------------------------
>
> -1  no labels.  keep VTL simple, please.  it's not java, nor should it be.  the ease of teaching it and reading it are important to me.   FYI, i'm also still considering vetoing the #foreach( $user in $users index $i ) syntax, since i think it is ugly, unclear, and unnecessary.  the more i look at it, the more i dislike it. having that syntax in combo with this one would make my eyes water.  (please bear with my grumpy bluntness; i like you, i'm just very concerned about syntax choices.)
>
> if you really feel it is necessary to control the break level, there is always the LoopTool in velocity tools.  yes, that's not that pretty either, but that is part of the point of VelocityTools.  keep ugly, but sometimes desirable features out of the core.
>
> if you really feel it is important to have some better break control in the core, let's discuss other ways.  like perhaps an optional integer argument for #break, to indicate how many levels to break out of.   Something like that would at least avoid "uglifying" the #foreach syntax, for an unnecessary feature.
>
>   
>> Add #foreach keyword to specify #break level
>> --------------------------------------------
>>
>>                 Key: VELOCITY-700
>>                 URL: https://issues.apache.org/jira/browse/VELOCITY-700
>>             Project: Velocity
>>          Issue Type: New Feature
>>          Components: Engine
>>    Affects Versions: 2.0
>>            Reporter: Byron Foster
>>
>> if the last argument to to the #foreach directive is a word, then that word serves as a label to indicate the break level for the #break directive. Par exemple:
>> #foreach($user in $users outer)
>>     #foreach($email in $user.emails)
>>         #if($email.expired)
>>             #break(outer)
>>         #end
>>     #end
>> #end
>>     
>
>   


-- 
Matthijs Lambooy
CrossmarX BV, Amsterdam
http://www.crossmarx.com
+31654771926
skype callto://matthijslambooy
xmpp:matthijslambooy@jabber.crossmarx.nl

Winnaar RADRACE 2006,2007 en 2008: http://www.crossmarx.com/radrace 


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