velocity-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna (JIRA)" <...@velocity.apache.org>
Subject [jira] Commented: (VELOCITY-680) RFC: New #local directive that behaves like #set but puts things into local context in macro rendering
Date Fri, 20 Feb 2009 00:34:01 GMT

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

Nathan Bubna commented on VELOCITY-680:
---------------------------------------

Why?  That looks much harder to implement, requires parser changes, and lacks both the flexibility
and extensibility of Claude's full idea.  Yeah, i agree it looks a bit nicer than:

#set( $parse.x = "foo" )

But not enough nicer to be worth the extra work and reduced rewards.  And seriously, i've
been working on VELOCITY-704 for just a couple hours.  Rough as it is, it's working great
so far, to the point where i'm more pleased with the idea than i was when i began.  I see
a lot of potential here.  And the real kicker is that i'm completely able to do this in the
trunk, no sweat, no radical changes.   This means we could deprecate the things it replaces
now and clean them out in 2.0.

> RFC: New #local directive that behaves like #set but puts things into local context in
macro rendering
> ------------------------------------------------------------------------------------------------------
>
>                 Key: VELOCITY-680
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-680
>             Project: Velocity
>          Issue Type: New Feature
>    Affects Versions: 1.7
>            Reporter: Jarkko Viinamäki
>         Attachments: velocity-local-directive-1.1.patch, velocity-local-directive.patch
>
>
> It would be very useful to be able to set variables that are in local macro scope. That
is, they do not overwrite "global" variables and are thrown away after macro rendering. This
would allow people to build macro libraries that do not clash so easily with each other.
> There is some implementation of a "LocalDirective" in experimental/localdirective but
I didn't quite get it and it doesn't follow the same syntax as #set. I used a few minutes
to hack together this alternative implementation which behaves exactly like #set but it puts
things in local context only.
> There's only one test case since this is Request-for-Comments type of patch.

-- 
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


Mime
View raw message