[ 
https://issues.apache.org/jira/browse/JEXL-398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Henri Biestro updated JEXL-398:
-------------------------------
    Description: 
Allowing trailing commas in structured literals (array, set, map) as a 
convenient syntactic leniency. :)
{code:java}
let m = { "foo": 1, "bar": 2, };
let a = [ 1, 2, ];
let s = (1, 2, );{code}
Using a trailing ellipsis (...) to alter the concrete class materialized as a 
convenient semantic shortcut.
{code:java}
let m = { "foo": 1, "bar": 2, ... }; // LinkedHashMap
let a = [ 1, 2, ...]; // ArrayList
let s = (1, 2, ...); // LinkedHashSet{code}
 

  was:
For example, 

 
{code:java}
let m = {
  "foo": 1,
  "bar": 2,
}{code}
It fails because there is a comma after last entry `"bar": 2`,  do we have any 
plan to support it?

Thanks!

 

        Summary: Allow 'trailing commas' or ellipsis while defining array, map 
and set literals  (was: Allow 'trailing commas' while defining array, map and 
set literals)

> Allow 'trailing commas' or ellipsis while defining array, map and set literals
> ------------------------------------------------------------------------------
>
>                 Key: JEXL-398
>                 URL: https://issues.apache.org/jira/browse/JEXL-398
>             Project: Commons JEXL
>          Issue Type: New Feature
>    Affects Versions: 3.3
>            Reporter: Xu Pengcheng
>            Assignee: Henri Biestro
>            Priority: Minor
>
> Allowing trailing commas in structured literals (array, set, map) as a 
> convenient syntactic leniency. :)
> {code:java}
> let m = { "foo": 1, "bar": 2, };
> let a = [ 1, 2, ];
> let s = (1, 2, );{code}
> Using a trailing ellipsis (...) to alter the concrete class materialized as a 
> convenient semantic shortcut.
> {code:java}
> let m = { "foo": 1, "bar": 2, ... }; // LinkedHashMap
> let a = [ 1, 2, ...]; // ArrayList
> let s = (1, 2, ...); // LinkedHashSet{code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to