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

Byron Foster commented on VELOCITY-680:
---------------------------------------

<qoute>
Yes, that would throw an exception, but that wasn't my example. I created a 
value for $map first. I don't see the relevance. 
</qoute>

Sorry, I misunderstood your comment before.  You are saying that your tried it 
with this patch applied. Yes, it doesn't work with strict mode now, but when 
this patch is applied I'll add strict mode to it.

<qoute>
As for whether #local or #global is more useful, i see your point, but the fact 
remains that velocimacro.context.localscope defaults to false, and i would bet 
money that a significant majority of users leave it that way (myself included).
</qoute>

Sure, with the current situation of not having any global scope control the 
current default setting is the one of more utility for the reasons above.  In 
my personal use I also run Velocity in the default mode precisely for this 
reason.  But as soon as there is a #global directive I will change.

Anyway, that's why we have properties so people can bend Velocity to there will 
:)  I'm +1 for this patch, and +1 for the name #local.



> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to