RE: Small feature request for future EU versions
- Posted by Chris Bensler <bensler at nt.net> Oct 17, 2004
- 537 views
Pete Lomax wrote: > > > On Sun, 17 Oct 2004 00:24:23 -0700, rudy toews > <guest at RapidEuphoria.com> wrote: > > >> Derek Parnell wrote: > >> > Yes, this is going to be survival-of-the-fitest game, with lots > >> > of variants vying for attention. > >please don't go off in different directions like pieces of a bomb. > >communicate with each other > FWIW, new operators are not actually needed, it is quite easy to > greatly improve the language using the current ones. > > Taking the if <expr> then example, the interpreter should realise that > <expr> must deliver a boolean result (or crash), in other words map > > e1<e2 to compare(e1,e2)=-1 > e1<=e2 to compare(e1,e2)!=1 > e1=e2 to equal(e1,e2), > e1!=e2 to not equal(e1,e2), > e1>=e2 to compare(e1,e2)!=-1 > e1>e2 to compare(e1,e2)=1 > > Of course, it does not need to do this if e1 and e2 are both atoms. > > Taking this a step further "if <e1> and <e2> then" must also deliver a > boolean result, which means the "need" for a boolean result must be > propagated into e1 and e2. The same is true for all the other > operators (not, unary minus, +, -, *, /, or, xor), and the same logic > applies to while, for, subscript, and slice expressions, but not to > assignments, constants, or parameters. If this all sounds horribly > complicated, don't worry, in practice it's not. I already have this > working in Posetf ) > > Regards, > Pete > The reason Euphoria crashes when you pass a sequence as a condition, is because it assumes you made a mistake, rather than assuming what you wanted to do, it plays dumb. I prefer it to behave exactly as I tell it to. If it crashes, then I just have to fix it. If it assumes what I meant, there is a good possibility, that is really is a mistake, and eu will keep going, with perfectly valid execution, eventhough it may be wrong, making it that much harder to find and fix. Chris Bensler Code is Alchemy