A case for the BASIC CASE statement
Martin Avison (27) 1494 posts |
Remember there are cases where Throwback cannot work … eg where a user receives an error which is reported to a developer. It is essential that the BASIC line number at the time of any user error can be easily made available to the developer, so they have a reference to the line in error. This is why I spent ages working out how to change BASIC safely so that the correct ERL was available even after a data abort in external code, instead of the (useless) last line number of the program. This cannot assume that the BASIC line numbers are the same as the physical line numbers. |
Rick Murray (539) 13851 posts |
I don’t remember now, but it must have been traumatic as the first thing I would do with library code is copy-paste it to the end of the program boilerplate, and remove all references to the library (as it is now included). I vaguely remember odd behaviour if something in the library matches something in the program proper, but, you know, I think I last used LIBRARY back in ’89 or so… |
Clive Semmens (2335) 3276 posts |
I have to admit to having forgotten that BBC BASIC even had LIBRARY. I’ve never, ever used it. It rang a vague bell, but I had to look it up. |
Dave Higton (1515) 3534 posts |
Yes. The error message tells you the name of the library and the line number within the library.
I use LIBRARY for two things: to use a small library of network-related functions, and to split up large programmes into more readable and manageable chunks. I commend the approach to you. |
Rick Murray (539) 13851 posts |
I do that for big programs… in C. I don’t write big programs in BASIC any more. |
Chris Hall (132) 3559 posts |
It is essential that the BASIC line number at the time of any user error can be easily made available to the developer, so they have a reference to the line in error. This is why I automatically added an extra line l%=12345 between every line in a BASIC programme before compiling it with ABC so that I could report the line number giving the error. RISCBasic just reported the error line number but ABC could not do this. |
Clive Semmens (2335) 3276 posts |
I prefer everything in one file, personally. One of the things I hate about C is having to look at dozens of different files to figure anything out. I can have several separate views into the same file on screen in Zap (probably in StrongED too, I don’t know) which gives you the advantages of “readable chunks” without the disadvantages. On the other hand, I can see advantages in sharing code between apps without duplication – but a few hundred lines of code is barely worth the effort in memory saving terms these days. It might be in shared maintenance, but that’s not an issue that’s hit me. I’m not that frequently engaged in programming. |
Fred Graute (114) 645 posts |
@Chris
You can set the width and initial opening position of a LoF window as follows:
@Rick
StrongED, like Edit, will not strip line numbers when a program contains line references. |