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.
William Leue Guru Joined: 03/07/2020 Location: United StatesPosts: 405
Posted: 08:32pm 28 Dec 2020
Copy link to clipboard
Print this post
A program that ran fine on 5.06.RC15 now gives me
Error: Duplicate Name
when I try to start it, and quits. Nothing else, no clue as to what might be duplicated. I know this was a bug in a previous release candidate, but I thought that was fixed. Shouldn't the error at least mention the name that is being duplicated?
-Bill
William Leue Guru Joined: 03/07/2020 Location: United StatesPosts: 405
Posted: 08:38pm 28 Dec 2020
Copy link to clipboard
Print this post
Found it! I had two copies of a subroutine named 'Beep'. Got rid of the dupe and it all runs fine.
But...why doesn't the Error handler give me a clue as to what is duplicated?
-Bill
toml_12953 Guru Joined: 13/02/2015 Location: United StatesPosts: 479
Posted: 10:34pm 28 Dec 2020
Copy link to clipboard
Print this post
Was Beep defined multiple times when you ran the program under 5.05? If so, I wonder why it wasn't caught back then.
RetroJoe Senior Member Joined: 06/08/2020 Location: CanadaPosts: 290
Posted: 12:39pm 29 Dec 2020
Copy link to clipboard
Print this post
It would be nice if MMBasic was a little more verbose in error messages, but the “normal” process is to enter the editor (i.e. by typing “EDIT” at the command prompt) immediately after an error is displayed, in which case the cursor should be on the offending line of code. Was that not happening in your case?
It is curious why this error was not detected in RC15, or how your program ran successfully. AFAIK, the no dupe SUB names rule was always in effect, but maybe earlier versions just used the first occurrence of the SUB and ignored any others with that same name ? I’ll have to reread the 5.06 release notes...
Also remember that a subroutine or function name cannot be the same as a declared variable, nor the same as a built-in MMBasic command or function. Don’t believe that’s the problem here, but I figured a reminder was apropos :) Edited 2020-12-29 22:40 by RetroJoeEnjoy Every Sandwich / Joe P.
William Leue Guru Joined: 03/07/2020 Location: United StatesPosts: 405
Posted: 03:00pm 29 Dec 2020
Copy link to clipboard
Print this post
What is interesting is that the duplicate routine name, in addition to generating the non-helpful error message, also gets the firmware confused a little. So after getting the error, if I type "edit" at the prompt, it responds with "Nothing to Edit".
Oh well, it's a very minor wart. -Bill
toml_12953 Guru Joined: 13/02/2015 Location: United StatesPosts: 479
Posted: 03:05pm 29 Dec 2020
Copy link to clipboard
Print this post
How about posting the program so we can see if it affects our system?
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10590
Posted: 03:08pm 29 Dec 2020
Copy link to clipboard
Print this post
It isn't affecting anything. The program fails parsing so isn't loaded into memory. Therefore there is nothing to edit
William Leue Guru Joined: 03/07/2020 Location: United StatesPosts: 405
Posted: 03:51pm 29 Dec 2020
Copy link to clipboard
Print this post
Ah, thanks for the explanation, Peter! All is clear now. -Bill