beanshell
beanshell copied to clipboard
Property expressions name{"prop"} what to do with these?
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
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...
{} are so in-natural.
Using curly braces for accessors are odd, glad you agree.