Details
-
New Feature
-
Status: Closed
-
Minor
-
Resolution: Won't Do
-
3.1
-
None
Description
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
var i = Address; i.City = 'NY'; i.Street = '1st Avenue'; i.House = '22'; return i;
with something like
Address {City : 'NY', Street : '1st Avenue', House : '22'}
May be we could also consider a variant for array-style accessors, like
var i = Address; i["City"] = 'NY'; i["Street"] = '1st Avenue'; i["House"] = '22'; return i
would be identical to
Address {"City" : 'NY', "Street" : '1st Avenue', "House" : '22'}
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