A case for the BASIC CASE statement
Rick Murray (539) 13851 posts |
It doesn’t?! How, just out of interest, does it cope with GOTO, RESTORE, and other stuff with line references? I know Edit usually strips line numbers, but keeps them if a reference is detected. I know, I could fire up StrongEd and try it, but I’m in the kitchen attending to a lemon cake because I decided at about half past four that what I really wanted for dinner was a proper honest to god cake, and not that mass produced wet sponge and fake cream rubbish you’d get from the supermarket or half a dozen local bakers. Ask me to name three things I miss from the UK, easy: tea1, beans2, and a decent Victoria sponge…4 1 Amazon to the rescue3. Okay, it might cost over €20 for a catering pack of 1100 (Tetley FTW!) for something that retails for about six quid in N&P, but hey it turned up three days later delivered by a cute girl in a brown uniform. Yup, they UPS’d it! 2 Several supermarkets in the area stock it for around €1 a can3. If you go eeek at that, I’ll let you know the with-cheese and with-sausages incarnations cost twice that. I’ll add my own fake sausages, thanks. 3 Do not ask what happens after Brexit, especially as the imbéciles in charge seem to think that threatening a no-deal-exit is a negotiating tactic. It really isn’t, it just makes the leadership look completely insane. 4 While on the topic of baked goods, a loaf of Hovis wouldn’t go amiss either. A baguette or pain has a limited lifespan (measured in hours) and the “Harry’s” brand long life bread… I’m not sure what the heck that is, suffice to say a pack is forgotten about for two and a half months looked the same as it did when I bought it. Damn. Old bread is supposed to go mouldy. Something that doesn’t… Ought to ring alarm bells. Cake nearing ready, I’ll shut up now. :-) |
Clive Semmens (2335) 3276 posts |
…it just makes it even makes it even more glaringly obvious that the leadership is completely insane. There. Fixed that for you. |
Steve Pampling (1551) 8172 posts |
I was curious enough to take a random BASIC file and drop it into !Edit and then alongside into !StrongED both, with the settings I have, display the line numbers incrementing by 10 on the file I, randomly, selected. Maybe StrongED likes me, but it seems to do what I’m expecting. Mind you I have the mode set to the default of not showing the physical line numbers and the non-default to not strip the tokenised line numbers. I suspect the behaviour overall is a pain if you want to use GOTO but that’s a habit I never developed. |
Clive Semmens (2335) 3276 posts |
Coming from Sorcerer BASIC, where GOTO was essential, BBC BASIC was a breath of fresh air… Line numbers? Handy to find where your program’s errors are, or to refer to specific lines when talking about their program with a student. |
Steve Pampling (1551) 8172 posts |
You do know that it’s possible to buy Hovis flour and that bread making is not only therapeutic but fresh from the oven and barely cooled it only takes a small amount of butter to create a small slice of heaven…
I believe the phrase “vulnerable adults by reason of diminished mental capacity” is the proper term. |
Steve Pampling (1551) 8172 posts |
That, I think, summarises my use of line numbers. |
Rick Murray (539) 13851 posts |
Over here? :-) That said, my oven is one of those two element electric things. I do have a bread maker, but that seemed to create bread flavoured bricks. I think my cake-fu is way stronger than my bread-fu.
I think you’ll find that’s us. They won’t be vulnerable, and unless Brexit turns into a full scale riot or civil war, they’ll quietly shuffle off to some phoney directorships after ruining everything… As for responsibility, heh, they can just sit back and say “they’re only doing the will of the people”.
I have / used to have some of those Osborne computer books, plus some others. I cut my baby teeth on BBC BASIC and growing up with PROC and such, plus spending many a night reading the enormous user guide when the other kids in the dormitory were pratting around to “Like A Virgin” for like the billionth time (okay guys, Madonna said the word “virgin”, get over it!), it absolutely horrified me how much they had to destroy any hope of decent programming style in order to get something that would be capable of running on the generic eighties home computer. So a machine that could do some elegant things was saddled with a mess of GOTO and GOSUB. It broke my heart to read that. I made a point never to use a computer with such a horrible BASIC inside it.
Ditto. Line numbers exist purely to aid debugging. It’s not that I’m anti GOTO or anything, it’s that a language with PROC and FN and two different loop styles FOR…NEXT and REPEAT…UNTIL (add WHILE…ENDWHILE for RISC OS) should have no need for such a thing as GOTO. PS: Cake absolutely brilliant. |
David Feugey (2125) 2709 posts |
Error line number 12390. |
David Pitt (3386) 1248 posts |
Exactly! |
Steve Drain (222) 1620 posts |
First, ensure that the BASIC program has been saved from StrongED (sic) with the default numbering of step 1 from line 1. Then press F5 and enter the line number to place the caret at the start of the line. You will also see that line number displayed at the bottom left of the window. Even better, use Throwback. The simplest way is to use Reporter and Otherwise you could configure SE to display line numbers and go from there. |
Steve Pampling (1551) 8172 posts |
More accurately “File opened in StrongED with display line numbers turned off” and wondering “why can’t I see any line numbers”. To paraphrase a well known PC error “faulty user, replace and try again” :) Steve Drain has been kind enough to identify three different methods that could used. |
David Feugey (2125) 2709 posts |
On the other hand, if you don’t know that this option exists… IMHO, default behaviour could (should?) be to print them. Other options: since Basic gives logical line numbers and not physical line numbers, perhaps that an option “goto Basic line x” in the StrongEd search box could be helpful. This, and a simple option (icon) to switch between physical line numbers and basic line numbers. There are always possibilities of improvements. To paraphrase a well known devops mantra, ergonomist’ work is finished when the users don’t need to read the doc any more for obvious functionalities. StrongEd is near perfection :) |
Clive Semmens (2335) 3276 posts |
It probably is. While I didn’t have a working copy of Zap, I coped okay with StrongED. Getting Zap back was a relief, though – but that’s quite possibly just that it’s like putting a familiar old pair of shoes back on. Even if they have been to the menders and don’t feel quite the same as they used to. |
David Feugey (2125) 2709 posts |
StrongEd makes some very clever design choices. |
Clive Semmens (2335) 3276 posts |
Not sure about that. If I was doing more of the kind of thing they’re for, perhaps. As it is, I use Zap on the Pi, mostly to write/edit BASIC, and occasionally to examine data files of various sorts, or to write Help files and the like; Atom on the Mac to write/edit HTML and PHP; LibreOffice on the Mac to write/edit text & format books. Each of these apps seems to do the job very well. Do I need to learn additional apps to do the same jobs? |
David Pitt (3386) 1248 posts |
I like that, it is a good comparison of the two applications BASIC handling and a good conclusion. |
Steve Fryatt (216) 2105 posts |
Line numbers? Sorry… you’ve got me there. What are they again? |
Rick Murray (539) 13851 posts |
A shame we can’t munge BASIC to be able to GOTO a label (à la VB) and then line numbers can be but an anachronism. |
Clive Semmens (2335) 3276 posts |
Unless you label every line, that doesn’t help with discussing a program with a student. And “Error at line XXXX” is a perfectly good way of finding where an error is. The computer should never need to know what line numbers are, but they’re damn useful for humans. |
Rick Murray (539) 13851 posts |
… Missing ENDCASE in line 17 of PROCdo_something_useful ? After all, how do all those languages that aren’t (necessarily) compiled manage without line numbers? ;-) |
David Feugey (2125) 2709 posts |
We can with “GOTO labels” from Steve Drain. |
Clive Semmens (2335) 3276 posts |
They’re not a universal panacea, but that’s not to say they’re not damn useful.
Differently! (And not always very well…) |
Steve Drain (222) 1620 posts |
For me, ‘munge’ = ‘translate’, the process of taking a BASIC program that cannot run directly, but contains extra features, and producing a runnable BASIC program that executes them. Basalt is the ultimate ‘munger’. ;-)
But it is not in the released version of Basalt. It does a jump to the label (or ‘tag’), rather than search the program for a line number, so it is much quicker than standard BASIC and can also jump into libraries. I have written a much simpler version into my developing Crunchie, but that only works in the crunched program; ie afer it has been ‘munged’. |
Steve Pampling (1551) 8172 posts |
Stuff you use to identify a point in the code when you don’t use throwback or you’ve been daft enough to use GOTO ?
Ever seen the effect of calling a library code block where there’s an error? |
Steve Drain (222) 1620 posts |
BASIC reports errors with the library name and both Reporter and Basalt throwback will land you in the right file at the right line if you wish. Nothing to see here. |