Re: [Ql-Users] Stupid AND
Hi, FALSE AND ERROR is FALSE ? That cannot be ! I disagree. FALSE AND ... whatever is FALSE since whatever is never evaluated. FALSE AND ERROR has to be ERROR !!! Definitely not. The first condition (a<>0) is NOT met and so, in any other programming language I use, the second condition isn't even tested, as the result will be "false" anyway because of this. So you will ever get big BIG ERRORs... I'm not sure I understand. The above example makes sure that the error doesn't even happen which is the whole reason to write it like that. SBASIC is better ;-)) In this instance, not to my mind. :-( Wolfgang ___ QL-Users Mailing List
Re: [Ql-Users] Stupid AND
Am 19.09.17 um 21:27 schrieb Wolfgang Lenerz via Ql-Users As a=0 at line 30, there is an "ERROR IN EXPRESSION" in the "if" condition And there is no way to put this expression to "true" or "false" as there is a big BIG "ERROR" !!! > Hi all, > > Just a rant about the SBasic AND operator. > > Suppose this: > > 10 a=0 > 20 b=10 > 30 if (a<>0 AND b/a=5) > 40 do_something > 50 end if > > Run it and what happens? > > You get an "overflow" error at line 30. > You get this error because it is trying to evaluate the second condition > (b/a) and failing as a=0 and you can't divide by 0. > > BUT WHY IS IT TRYING TO EVALUATE THE SECOND CONDITION IN THE FIRST PLACE? Because there is no order for evaluating the first and the second condition in the AND operation, In any way both have to be without any errors. FALSE AND ERROR is FALSE ? That cannot be ! FALSE AND ERROR has to be ERROR !!! > The first condition (a<>0) is NOT met and so, in any other programming > language I use, the second condition isn't even tested, as the result > will be "false" anyway because of this. So you will ever get big BIG ERRORs... > Apparently though, Sbasic still also tests the second condition. > > G. > > Wolfgang > > > SBASIC is better ;-)) > > > ___ > QL-Users Mailing List ___ QL-Users Mailing List
Re: [Ql-Users] Stupid AND
That language definition (if it exists, I don't know) would only matter for functions - simple comparisons that have no side effect would be fine to simply omit. Tobias > Am 19.09.2017 um 23:42 schrieb Jan Bredenbeek via Ql-Users > : > > On 19 September 2017 at 23:36, Tobias Fröschle via Ql-Users < > ql-users@lists.q-v-d.com> wrote: > >> Neither Turbo nor QLiberator do short-circuit evaluation. >> C68 does. >> > > Because it's part of the language definition. > > Jan > -- > *Jan Bredenbeek* | Hilversum, NL | j...@bredenbeek.net > ___ > QL-Users Mailing List ___ QL-Users Mailing List
Re: [Ql-Users] Stupid AND
On 19 September 2017 at 23:36, Tobias Fröschle via Ql-Users < ql-users@lists.q-v-d.com> wrote: > Neither Turbo nor QLiberator do short-circuit evaluation. > C68 does. > Because it's part of the language definition. Jan -- *Jan Bredenbeek* | Hilversum, NL | j...@bredenbeek.net ___ QL-Users Mailing List
Re: [Ql-Users] Stupid AND
Neither Turbo nor QLiberator do short-circuit evaluation. C68 does. Tobias > Am 19.09.2017 um 23:25 schrieb Jan Bredenbeek via Ql-Users > : > > On 19 September 2017 at 21:27, Wolfgang Lenerz via Ql-Users < > ql-users@lists.q-v-d.com> wrote: > >> Hi all, >> >> Just a rant about the SBasic AND operator. >> >> Suppose this: >> >> 10 a=0 >> 20 b=10 >> 30 if (a<>0 AND b/a=5) >> 40 do_something >> 50 end if >> >> Run it and what happens? >> >> You get an "overflow" error at line 30. >> You get this error because it is trying to evaluate the second condition >> (b/a) and failing as a=0 and you can't divide by 0. >> >> BUT WHY IS IT TRYING TO EVALUATE THE SECOND CONDITION IN THE FIRST PLACE? > > > Because all BASICs do. And more languages like Pascal (but not C). > > Jan. > ___ > QL-Users Mailing List ___ QL-Users Mailing List
Re: [Ql-Users] Stupid AND
On 19 September 2017 at 21:27, Wolfgang Lenerz via Ql-Users < ql-users@lists.q-v-d.com> wrote: > Hi all, > > Just a rant about the SBasic AND operator. > > Suppose this: > > 10 a=0 > 20 b=10 > 30 if (a<>0 AND b/a=5) > 40 do_something > 50 end if > > Run it and what happens? > > You get an "overflow" error at line 30. > You get this error because it is trying to evaluate the second condition > (b/a) and failing as a=0 and you can't divide by 0. > > BUT WHY IS IT TRYING TO EVALUATE THE SECOND CONDITION IN THE FIRST PLACE? Because all BASICs do. And more languages like Pascal (but not C). Jan. ___ QL-Users Mailing List
Re: [Ql-Users] Stupid AND
30 if (a<>0 AND b/a=5) The first condition (a<>0) is NOT met and so, in any other programming language I use, the second condition isn't even tested, as the result will be "false" anyway because of this. Standard BASIC approach is to evaluate first expression, store the result somewhere (stack?), evaluate the second expression and store the result. And then evaluate the AND operand (with parameters already stored - on stack?) as the last. (Tiny Basic, ZX Spectrum Basic) Maybe SBasic does the same or similar. ___ QL-Users Mailing List
Re: [Ql-Users] Stupid AND
On 19/09/2017 22:02, Dilwyn Jones via Ql-Users wrote: I take it Dave means it fits in 48K, don't expect too much. What, I can't expect perfection in 48 K (and SMSQE is much larger)? grin Wolfgang ___ QL-Users Mailing List
Re: [Ql-Users] Stupid AND
Hi, I know it's been around for ages. It still irks. Sucking it up only helps for so long Wolfgang Yes, its dumb, but the problem has been there since the day day dot. So suck it up and work around :) Per On 19 September 2017 at 21:55, Wolfgang Lenerz via Ql-Users < ql-users@lists.q-v-d.com> wrote: On 19/09/2017 21:32, Dave Park via Ql-Users wrote: Your BASIC interpreter fits in 48K. With room to spare. And? (pun intended) Wolfgang On Tue, Sep 19, 2017 at 2:27 PM, Wolfgang Lenerz via Ql-Users < ql-users@lists.q-v-d.com> wrote: Hi all, Just a rant about the SBasic AND operator. Suppose this: 10 a=0 20 b=10 30 if (a<>0 AND b/a=5) 40 do_something 50 end if Run it and what happens? You get an "overflow" error at line 30. You get this error because it is trying to evaluate the second condition (b/a) and failing as a=0 and you can't divide by 0. BUT WHY IS IT TRYING TO EVALUATE THE SECOND CONDITION IN THE FIRST PLACE? The first condition (a<>0) is NOT met and so, in any other programming language I use, the second condition isn't even tested, as the result will be "false" anyway because of this. Apparently though, Sbasic still also tests the second condition. G. Wolfgang ___ QL-Users Mailing List ___ QL-Users Mailing List ___ QL-Users Mailing List ___ QL-Users Mailing List
Re: [Ql-Users] Stupid AND
Wolfgang Lenerz via Ql-Users wrote: > Just a rant about the SBasic AND operator. > > Suppose this: > > 10 a=0 > 20 b=10 > 30 if (a<>0 AND b/a=5) > 40 do_something > 50 end if > > Run it and what happens? > > You get an "overflow" error at line 30. > You get this error because it is trying to evaluate the second condition > (b/a) and failing as a=0 and you can't divide by 0. > > BUT WHY IS IT TRYING TO EVALUATE THE SECOND CONDITION IN THE FIRST PLACE? Maybe this wise language includes Chinese or Persian philosophy? > The first condition (a<>0) is NOT met and so, in any other programming > language I use, the second condition isn't even tested, as the result > will be "false" anyway because of this. IIRC other languages also do not _guarantee_ to stop evaluation after a lefthand AND condition failed. Peter ___ QL-Users Mailing List
Re: [Ql-Users] Stupid AND
Yes, its dumb, but the problem has been there since the day day dot. So suck it up and work around :) Per On 19 September 2017 at 21:55, Wolfgang Lenerz via Ql-Users < ql-users@lists.q-v-d.com> wrote: > On 19/09/2017 21:32, Dave Park via Ql-Users wrote: > >> Your BASIC interpreter fits in 48K. With room to spare. >> > > And? > > (pun intended) > > Wolfgang > >> On Tue, Sep 19, 2017 at 2:27 PM, Wolfgang Lenerz via Ql-Users < >> ql-users@lists.q-v-d.com> wrote: >> >> Hi all, >>> >>> Just a rant about the SBasic AND operator. >>> >>> Suppose this: >>> >>> 10 a=0 >>> 20 b=10 >>> 30 if (a<>0 AND b/a=5) >>> 40 do_something >>> 50 end if >>> >>> Run it and what happens? >>> >>> You get an "overflow" error at line 30. >>> You get this error because it is trying to evaluate the second condition >>> (b/a) and failing as a=0 and you can't divide by 0. >>> >>> BUT WHY IS IT TRYING TO EVALUATE THE SECOND CONDITION IN THE FIRST PLACE? >>> >>> The first condition (a<>0) is NOT met and so, in any other programming >>> language I use, the second condition isn't even tested, as the result >>> will >>> be "false" anyway because of this. >>> >>> Apparently though, Sbasic still also tests the second condition. >>> >>> G. >>> >>> Wolfgang >>> >>> >>> >>> >>> >>> >>> ___ >>> QL-Users Mailing List >>> >>> >> >> >> > ___ > QL-Users Mailing List > > > ___ QL-Users Mailing List
Re: [Ql-Users] Stupid AND
I take it Dave means it fits in 48K, don't expect too much. Dilwyn -Original Message- From: Wolfgang Lenerz via Ql-Users Sent: Tuesday, September 19, 2017 8:55 PM To: ql-us...@q-v-d.com Cc: Wolfgang Lenerz Subject: Re: [Ql-Users] Stupid AND On 19/09/2017 21:32, Dave Park via Ql-Users wrote: Your BASIC interpreter fits in 48K. With room to spare. And? (pun intended) . ___ QL-Users Mailing List
Re: [Ql-Users] Stupid AND
On 19/09/2017 21:32, Dave Park via Ql-Users wrote: Your BASIC interpreter fits in 48K. With room to spare. And? (pun intended) Wolfgang On Tue, Sep 19, 2017 at 2:27 PM, Wolfgang Lenerz via Ql-Users < ql-users@lists.q-v-d.com> wrote: Hi all, Just a rant about the SBasic AND operator. Suppose this: 10 a=0 20 b=10 30 if (a<>0 AND b/a=5) 40 do_something 50 end if Run it and what happens? You get an "overflow" error at line 30. You get this error because it is trying to evaluate the second condition (b/a) and failing as a=0 and you can't divide by 0. BUT WHY IS IT TRYING TO EVALUATE THE SECOND CONDITION IN THE FIRST PLACE? The first condition (a<>0) is NOT met and so, in any other programming language I use, the second condition isn't even tested, as the result will be "false" anyway because of this. Apparently though, Sbasic still also tests the second condition. G. Wolfgang ___ QL-Users Mailing List ___ QL-Users Mailing List
Re: [Ql-Users] Stupid AND
Your BASIC interpreter fits in 48K. With room to spare. On Tue, Sep 19, 2017 at 2:27 PM, Wolfgang Lenerz via Ql-Users < ql-users@lists.q-v-d.com> wrote: > Hi all, > > Just a rant about the SBasic AND operator. > > Suppose this: > > 10 a=0 > 20 b=10 > 30 if (a<>0 AND b/a=5) > 40 do_something > 50 end if > > Run it and what happens? > > You get an "overflow" error at line 30. > You get this error because it is trying to evaluate the second condition > (b/a) and failing as a=0 and you can't divide by 0. > > BUT WHY IS IT TRYING TO EVALUATE THE SECOND CONDITION IN THE FIRST PLACE? > > The first condition (a<>0) is NOT met and so, in any other programming > language I use, the second condition isn't even tested, as the result will > be "false" anyway because of this. > > Apparently though, Sbasic still also tests the second condition. > > G. > > Wolfgang > > > > > > > ___ > QL-Users Mailing List > -- Dave Park d...@sinclairql.com ___ QL-Users Mailing List