commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitri Blinov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JEXL-262) Inline object property initialization construct
Date Mon, 20 Aug 2018 08:42:00 GMT

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

Dmitri Blinov commented on JEXL-262:
------------------------------------

Created separate PR for this [https://github.com/apache/commons-jexl/pull/7]

> Inline object property initialization construct
> -----------------------------------------------
>
>                 Key: JEXL-262
>                 URL: https://issues.apache.org/jira/browse/JEXL-262
>             Project: Commons JEXL
>          Issue Type: New Feature
>    Affects Versions: 3.1
>            Reporter: Dmitri Blinov
>            Assignee: Henri Biestro
>            Priority: Minor
>             Fix For: 3.1
>
>
> I wonder is it possible (not difficult) to implement in Jexl a construct that would allow
us to initialize object properties in one statement, so that it would be possible to replace
the code like
> {code}
> var i = Address;
> i.City = 'NY';
> i.Street = '1st Avenue';
> i.House = '22';
> return i;
> {code}
> with something like
> {code}
> Address {City : 'NY', Street : '1st Avenue', House : '22'}
> {code}
> May be we could also consider a variant for array-style accessors, like
> {code}
> var i = Address;
> i["City"] = 'NY';
> i["Street"] = '1st Avenue';
> i["House"] = '22';
> return i
> {code}
> would be identical to
> {code}
> Address {"City" : 'NY', "Street" : '1st Avenue', "House" : '22'}
> {code}
> I think this is somewhat similar to inline map initialization syntax, which is proved
to be very useful and productive, so it would be nice to have such a feature for common objects
too



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

Mime
View raw message