beanshell icon indicating copy to clipboard operation
beanshell copied to clipboard

Property expressions name{"prop"} what to do with these?

Open nickl- opened this issue 6 years ago • 2 comments

When I implemented the array short hand and then the map expressions allowing access to map entries via the square bracket notation seemed like a natural evolution and logical approach. But now we also have these expressions using the curls braces which just seems odd, braces are not for accessors man.

What do you think?

map = {"key1"=1, "key2"=2, "key3"=3};
one = map["key1"];
map["key3"] = 6;

vs

map = {"key1"=1, "key2"=2, "key3"=3};
one = map{"key1"};
map{"key3"} = 6;

So cool it does been accessors too but I can port that to the square bracket syntax where we can apply strict java uniformly. This just feels odd to me do we need both syntaxes? If all you need to do is change the curlies to square and your existing code remains working, will that be acceptable?

I've been normalising properties even more and now we have 3 different syntax for basically accomplishing very much the same. Do I go with my gut and drop this curly fiasco?

Edit: both these are now legal tender btw

nickl- avatar Aug 06 '18 20:08 nickl-

I am using {} accessors in some of my recent scripts, but I would be more than happy to use the new notation... {} are so in-natural.

my two microcents...

stefanofornari avatar Aug 08 '18 16:08 stefanofornari

{} are so in-natural.

Using curly braces for accessors are odd, glad you agree.

nickl- avatar Aug 08 '18 19:08 nickl-