[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: change between es-0.84 and es-0.9-alpha1



Loren James Rittle wrote
> ; p = a || echo y
> only prints 'y' under es-0.9-alpha1.
> 
> ; {p = a; true} || echo y
> is the workaround that works the same under both versions of es.

Yes.

> CHANGES from es-0.9-alpha1 said that 'pp = <={p = a}' now assigns a to
> pp rather than 0.  I suspect that this change is what is affecting my
> usage.

Yes.  It's that old ``0 is true, anything else is false'' rule of Unix
shells.  It's (imho) the wrong thing, but it's a fact of life.

> Of course, I didn't use something as simple as 'p = a || echo y' in es
> programs.  I did use:
> {~ $a test1 &&
>   p = big_nasty_expression} ||
> {~ $a test2 &&
>   p = another_big_nasty_expression} ||
> {~ $a test3 &&
>   p = another_big_nasty_expression} ||
> {default_big_nasty_expression}
> 
> as an idiom for a C-style switch statement.  Yes, I now know this thinking
> was stylistically bad, thus I converted to a lisp-style 'if' form:
> if {~ $a test1} \
>      {p = big_nasty_expression} \
>    {~ $a test2} \
>      {p = another_big_nasty_expression} \
>    {~ $a test3} \
>      {p = another_big_nasty_expression} \
>   {default_big_nasty_expression}

Seems much cleaner to me.