Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : CMM2: V5.05.03 Bug Reports
Page 1 of 4 | |||||
Author | Message | ||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8579 |
Please report any bugs in the release version of 5.05.03 here. Current issues: TBC: This bug or something like it was recently fixed - awaiting more info before investigating |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3841 |
Sorry Peter, but is the issue with a program "RUNning" itself resolved? I didn't see anything in the 5.05.03 release notes that seemed to correspond. Thanks for resolving the other issues I reported. Regards, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8579 |
It is not something I can look at unless someone can demonstrate it in a simple enough program to investigate. I read your release notes on zmim to mean it was no longer an issue. |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3841 |
You obviously missed it in the kerfuffle over SD cards, it's on p15 of the previous thread: Function exec(a) As Float Local s$ Do Line Input "Run again [y|n] ", s$ s$ = LCase$(s$) Loop Until s$ = "y" Or s$ = "n" If s$ = "y" Then Run exec = 1 End Function Sub main() Cls a = exec(1) End Sub main() Run and answer "y" followed by "n" to get this error: [17] Error: Nothing to return to It's not the same error message, but it has the same "feel" of the interpreter having lost context so I suspect it's the same issue. Yes, I worked around it, but I thought it might still be an issue that should be resolved for the future. Regards, Tom Edited 2020-06-22 22:10 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8579 |
Yes - missed it. Just checked and it is in the MM2 as well so I'll pass it over to Geoff UPDATE The problem is fixed by putting an END statement after main(). Please try the same on zmim V1. I don't have a copy. Edited 2020-06-22 23:54 by matherp |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3165 |
the issue with a program "RUNning" itself What a contrived case! I can guess as to what is causing this and will add it to the todo list. In the meantime don't run a program from within a sub. Geoff Geoff Graham - http://geoffg.net |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8579 |
New bug GPS function not working at the command line but will work in a program |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3841 |
That doesn't fix it for the real code. My guess is that in the "contrived example" whatever bad state the interpreter/firmware ends up in has by luck come across that END statement which allows it to end "gracefully", whereas in the real code it hits something that it can't deal with, i.e. [execute.inc:24] Error: EXEC is not declared where it looks like it is trying to assign to the EXEC function which it no longer knows about in its bad state. Perhaps it also matters how deep the call stack is when END is called. Regards, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3841 |
Damned if I do and damned if I don't . The real case isn't contrived but it is hundreds of lines long. Best wishes, Tom Edited 2020-06-23 06:17 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3841 |
Ignore me I'm talking twaddle. Ensuring that RUNned program actually invokes the END command instead of just "running off the end of the code" does fix the problem. Thanks, Tom Edited 2020-06-23 06:58 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3841 |
Possible BUG? conditionals don't perform short-circuit evaluation Try this: Function always_true() Print "always true" always_true = 1 End Function Function always_false() Print "always_false" always_false = 0 End Function Cls Print always_true() Or always_false() Print always_false() And always_true() The output is: always true always_false 1 always_false always true 0 I would have expected: always true 1 always_false 0 My expectation comes from the fact that if the first operand of an OR is true, or the first operand of an AND is false then the code does not need to evaluate the second operand. As it stands you can't do this: If tk_char = -1 Or Chr$(tk_char) = " " Then ... Because Chr$() will report an error when tk_char = -1 I know there are ways to workaround it, but (in a more complex case than this) they are more verbose. Best regards, Tom Edited 2020-06-23 22:51 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8579 |
Everything to do with the core MMBasic language is for Geoff and not me and will probably be common across all V5 MM and possibly V4.5 For this sort of issue can I request that you also test on a MM2 and only post on this thread if you see a difference in behaviour (meaning I've done something stupid). If the behaviour is the same it is probably better to raise the issue on a separate thread for Geoff to comment. I will keep the CMM2 up-to-date with any of Geoff's changes to core MMBasic but won't be making any changes that cause behaviour to deviate from other versions. |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3841 |
OK, but Geoff isn't so foolhardy as to have a BUG reporting thread It would be my pleasure if you'd like to send me one in the meantime perhaps someone else will oblige. Ack. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1593 |
The FILES command is an exception? Bill Keep safe. Live long and prosper. |
||||
CircuitGizmos Guru Joined: 08/09/2011 Location: United StatesPosts: 1421 |
The output is: always true always_false 1 always_false always true 0 This is what I expect. Given that the functions need to run in order to return either a 0 or a 1, anything inside the function has to be executed. Micromites and Maximites! - Beginning Maximite |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3841 |
Thanks for confirming. That's not actually the case for the programming languages I'm familiar with which would not evaluate the second operand when its value cannot change the result. However looking at VB.NET in the table at Short-circuit evaluation it looks like this is not a bug for BASIC, but we are "missing" the AndAlso and OrElse operators. Regards, Tom Edited 2020-06-24 01:08 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8579 |
Files in not part of "core" MMBasic - it doesn't even exist on a MM2m, I'm talking about the main language elements. In general commands that can only be run at the command line are not "core" |
||||
CircuitGizmos Guru Joined: 08/09/2011 Location: United StatesPosts: 1421 |
If you are talking a compiled language, then that would be optimized out. MMBasic is interpreted and cannot act another way. Micromites and Maximites! - Beginning Maximite |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3841 |
I don't think you are correct, consider: a = fun1() AND fun2() When the interpreter reads fun1() it evaluates it and stores the value, it then reads AND, if the stored value is 0 then it would be permissable for the interpreter to read but not evaluate the second operand since it knows the result of the evaluation cannot change the result of the expression. Case in point Python only has short-circuit boolean operators yet it is generally called interpreted (though you could argue that it is neither fish nor fowl). However I have accepted that BASIC apparently doesn't work this way, I never knew. Regards, Tom Edited 2020-06-24 10:10 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1593 |
It IS part of MMBasic for the original Mono Maximite, the Colour Maximite, the Micromite plus, DOS(Windows) MMBasic and probably other ported versions. It's part of Microsoft GWBASIC and QuickBASIC as well. Sorry but I just think it's an unnecessary deviation from the well trodden path. Bill Keep safe. Live long and prosper. |
||||
Page 1 of 4 |
Print this page |