Hello Corey,
> on elif
> if misplaced elif
> misplaced elif error
> else
> eval expression
> => possible eval error
> set new status if eval fine
Currently it is really:
switch (state) { case NONE: case ELSE_TRUE: case ELSE_FALSE: success = false; show some error default: }
if (success) { success = evaluate_expression(...); if (success) { switch (state) { case ...:
default: } } }
Which I do not find so neat. The previous one with nested switch-if-switch
looked as bad.
> The issue at hand being the benefit to the user vs code complexity.
Hmmm.
One of my point is that I do not really see the user benefit... for me the
issue is to have no user benefit and code complexity.
The case we are discussing is for the user who decides to write code with
*two* errors on the same line:
\if good-condition \else \elif bad-condition \endif
with an added complexity to show the elif bad position error first. Why
should we care so much for such a special case?
Maybe an alternative could be to write simpler code anyway, somehow like
it was before:
// on "elif" switch (peek(state)) { case NONE: error; case ELSE_TRUE: error; case ELSE_FALSE: error; case
IGNORED: break; case TRUE: poke IGNORED; case FALSE: success = evaluate(&is_true)
if (!success) error; else if (is_true) poke TRUE
default: error; }
The only difference is that the evaluation is not done when it is not
needed (what a draw back) but ISTM that it is significantly easier to
understand and maintain.
Now if you want to require committer opinion on this one, fine with me.
--
Fabien.