Hey all.. has anyone come across this before? It s...
# lucee
c
Hey all.. has anyone come across this before? It seems one cannot use the Elvis operator with the return value (struct) of a function.
v = foo()["bar"] ?: "xxx";
v = foo().bar ?: "xxx";
https://trycf.com/gist/b7f329f163d1cb6389394516275fb816/lucee5?theme=monokai
a
Bug in Lucee. Works how one would expect in CF.
Or indeed the much earlier https://luceeserver.atlassian.net/browse/LDEV-368, raised by me in 2015.
c
Thanks Adam, it’s well covered then.. VERY annoying having to set an interim variable after calling a getter..
a
Also annoying it's been sitting around since 2015...
(cue: someone to say "you can always do a pull request if you don't like it")
s
idk, I kind of prefer to dramatically sigh about such things until Zack stumbles on it and fixes it, the end result seems to be better than if I try to patch Lucee myself
😇 1
but this possibly does not make me a good member of the open source community
a
There are more ways to contribute to an OSS project than doing pull reqs. And the whole "you can do a pull req" is just unnecessary passive aggressive patronisation of ppl already trying to help with things.
z
but if you can contribute pull reqs @sknowlton , you'd make me very very very happy, so far our attempts at cloning me haven't worked
there's only so much i can do
⭐ 2
i
@chapmandu You can do this though...[v = foo()?.bar ?: "xxx";] https://trycf.com/gist/b8dea3ffef361fe4763aba1c6c88e972/lucee5?theme=monokai
c
@ian.hickey Thanks, I didn't know this was available in Lucee.. not a terrible workaround..