Console Mode editions updated to version 0.48

New releases of BB4W and BBCSDL, and other updates, will be announced here
Richard Russell
Posts: 272
Joined: Tue 18 Jun 2024, 09:32

Console Mode editions updated to version 0.48

Post by Richard Russell »

I have updated the BBC BASIC Console Mode editions (BBCTTY) to version 0.48: The main changes in this version are:
  1. Support for array slicing has been added, using the syntax array(first TO last) or array(row, first TO last).

  2. Compound assignment and array arithmetic can now both use the exponentiation operator ^.

  3. In the default *HEX32 mode, PRINT~ and STR$~ report an error if the value cannot be expressed as 32-bit hex.

  4. Added median.bbc as a demonstration of array slicing (it implements the Quickselect algorithm).
The new version can be downloaded from the usual place.
Richard Russell
Posts: 272
Joined: Tue 18 Jun 2024, 09:32

Re: Console Mode editions updated to version 0.48

Post by Richard Russell »

Richard Russell wrote: Sun 02 Mar 2025, 16:34 I have updated the BBC BASIC Console Mode editions (BBCTTY)...
Please do some testing and provide feedback, so that I can update BBCSDL and BB4W with confidence that I have not broken anything.
Richard Russell
Posts: 272
Joined: Tue 18 Jun 2024, 09:32

Re: Console Mode editions updated to version 0.48

Post by Richard Russell »

Richard Russell wrote: Mon 03 Mar 2025, 10:22 Please do some testing and provide feedback, so that I can update BBCSDL and BB4W with confidence that I have not broken anything.
It turns out that there is a bug in the array slicing, and just the sort of stupid, indefensible, bug that I was afraid of - and that I would not have made before my illness. :cry:

What's worse, my own testing didn't find it, despite needing only half-a-dozen lines of code. It just didn't occur to me to do that test, demonstrating just how vital third-party testing is. :oops:

It shows that my instinct not to make any more changes to BBC BASIC was the right one, and that despite the undoubted value of array slicing I shouldn't have risked adding it.
User avatar
hellomike
Posts: 184
Joined: Sat 09 Jun 2018, 09:47
Location: Amsterdam

Re: Console Mode editions updated to version 0.48

Post by hellomike »

Sorry to hear that.
But isn't this exactly the reason why you released a test(!) Console Mode version first, ie. to iron out potential bugs?

And isn't fixing bugs part of everyone's developing process? Even the embarrassing ones.
Richard Russell
Posts: 272
Joined: Tue 18 Jun 2024, 09:32

Re: Console Mode editions updated to version 0.48

Post by Richard Russell »

hellomike wrote: Sun 09 Mar 2025, 10:27 But isn't this exactly the reason why you released a test(!) Console Mode version first, ie. to iron out potential bugs?
Yes, but that's not how the bug was found (and, realistically, it was never likely that anybody else would do the sort of testing required to find it). :(

I knew that array slicing would likely be a 'minority interest'; anybody familiar with the similar functionality in JavaScript or Python would appreciate it, but how many BBC BASIC users are? How many even use the other extensions I have added? ;)

Having said that, string slicing (LEFT$, MID$, RIGHT$) is widely recognised as useful so it shouldn't be too big a stretch to see the value. :)

On the remote chance that you, or anybody else, might try the array slicing in BBCTTY v0.48 here is an example of something that doesn't work because of the bug: :shock:

Code: Select all

      DEF FNsum(a())
      IF DIM(a(),1) = 0 THEN = a(0) ELSE = a(0) + FNsum(a(1 TO))
Of course you wouldn't sum an array that way, there's the built-in SUM function for that, but it jolly well ought to work, with small arrays anyway (with large arrays the recursion limit might be reached, causing BBC BASIC to crash).
User avatar
hellomike
Posts: 184
Joined: Sat 09 Jun 2018, 09:47
Location: Amsterdam

Re: Console Mode editions updated to version 0.48

Post by hellomike »

I understand what you say. Yes, it ought to work, yet in the version history of your BASIC versions (BB4W, BBCSDL, Console) several times I see bug fixes included.
So what's different this time, i.e. when you fix the bug then it is an exbug like the others.

And yes, I even can understand that for you - now more than ever - with each mistake it confronts you with the illness Richard.

Will this setback make you abandon the project?
Richard Russell
Posts: 272
Joined: Tue 18 Jun 2024, 09:32

Re: Console Mode editions updated to version 0.48

Post by Richard Russell »

hellomike wrote: Sun 09 Mar 2025, 19:15 Will this setback make you abandon the project?
As you know, I had already 'abandoned' any further developments of my BASIC interpreters quite some time ago. The only reason I was tempted to break that commitment recently was because of what I judged to be exceptional circumstances:
  • DeepSeek wrote some BBC BASIC code in which it 'hallucinated' that array slicing was already implemented.
  • Extending the arraylib library made me realise that I actually could implement array slicing natively.
  • The small amount of code necessary (only 128 bytes) convinced me that I could do it with a very low risk.
Of course as it turned out the last of those was wildly optimistic, and despite the tiny amount of code I managed to introduce a bug and fail to spot it in testing. :oops:

The only good thing to have come out of this mess is that it has driven home that I was right to distrust my ability to make changes safely. Hopefully I won't again be tempted to repeat the mistake.

Anyway, the reaction I have had to the addition of array slicing has been disheartening. At the RISC OS forum they are treating it as a joke; the author of Matrix Brandy (who happens also to be the admin of this forum) doesn't seem to want to engage with the topic at all; and users of my BASICs seemingly couldn't care less. :cry: