[ 
https://issues.apache.org/jira/browse/JEXL-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16569893#comment-16569893
 ] 

Dmitri Blinov edited comment on JEXL-264 at 8/6/18 8:58 AM:
------------------------------------------------------------

For this exact purpose I am using pseudo-variable "this" which is resolved to 
current context to allow script-writer to access context variables by using 
array syntax like this
{code}
this["My Variable"]
{code}

This is also useful when one wants to explicitly address context variable and 
avoid possible name clashing with any local variable.

More relaxed syntax to name a variable is great but there ara other use-cases, 
like national character set names, names starting with digits etc which are 
prohibited by current syntax rules. Maybe we should have some unified solution 
for this?


was (Author: dmitri_blinov):
For this exact purpose I am using pseudo-variable "this" which is resolved to 
current context to allow script-writer to access context variables by using 
array syntax like this
{code}
this["My Variable"]
{code}

This is also useful when one wants to explicitly address context variable and 
avoid possible name clashing with any local variable

> Allow space, quote & double-quote in identifiers
> ------------------------------------------------
>
>                 Key: JEXL-264
>                 URL: https://issues.apache.org/jira/browse/JEXL-264
>             Project: Commons JEXL
>          Issue Type: Improvement
>    Affects Versions: 3.1
>            Reporter: Henri Biestro
>            Assignee: Henri Biestro
>            Priority: Minor
>             Fix For: 3.2
>
>
> Since a Jexl context may be backed by a map that is not under Jexl's control, 
> it may happen that keys in such a map contains spaces (quotes, backquotes).
> Scripting these top-level variables is then not very easy; adding an escaping 
> mechanism in the syntax for top-level identifiers is provably convenient in 
> this case.
> For example:In a script, {code}My\ Variable = 3{code} sets the top level 
> variable keyed with the string "My Variable" with the value 3.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to