this unambiguously? The usage could be even worse, something like:

  let direction = (a:0>1?a:2:a:1)


Personally, I never leave these sorts of matters to the whims of the parser designer (no offense, Bram :) and always specify just as I would with something as ambiguous as

        a and b or c

which could be parsed as

        (a and b) or c

or

        a and (b or c)

not trusting in the compiler, or my own ability to come back later and understand which condition it should be.

Similarly, I always force a ternary operator with

        let direction = (a:0>1)?(a:2):(a:1)

to ensure that it parses exactly as I want/expect.

I know it's not an ideal solution as it sounds like you can solve your problem with a few extra spaces...however, it might be a habit worth developing to prevent ambiguity in code...both for the parser, and for you 6 months down the line. :)

Just my $2.0e-2

-tkc



Reply via email to