Closed danielo515 closed 6 years ago
Yeaaah so... That was made for the match
feature, which is to this day still undocumented.
Oh, so it is intentional... I think it is a bit weird and very away from the usual JS semantics. It may be a about personal preference but I don't see an scenario where the actual behavior is better than the expected behavior. Anyway, the only possible workaround that I see is to assign the result to a variable and then call that variable, which is a pity because I tend to avoid all unnecessary variables.
Regards
LS has a few tricks for avoiding variables (at least in the source code), if you find any of these appealing:
(if actions[\something] then that else defaultAction) msg
msg |> if actions[\something] then that else defaultAction
or
with actions[\something] or defaultAction then .. msg
This last one works like a charm. Thanks @rhendric
Hello,
Today I found a weird behavior on livescript that involves the or operator and function execution. Here is a piece of code to demonstrate it:
This should compile to
But instead it compiles to
Is this a bug ? Can you suggest a workaround ?
Thanks and regards