DIM structure

Discussions about the BBC BASIC language, with particular reference to BB4W and BBCSDL
kirkkaf13@gmail.com
Posts: 9
Joined: Fri 23 Aug 2024, 21:37

DIM structure

Post by kirkkaf13@gmail.com »

Hello,

Why does a structure have to be defined on a single line? This is an issue when it comes to structures with large amount of fields.
Richard Russell
Posts: 366
Joined: Tue 18 Jun 2024, 09:32

Re: DIM structure

Post by Richard Russell »

kirkkaf13@gmail.com wrote: Thu 03 Apr 2025, 15:18 Why does a structure have to be defined on a single line?
It doesn't! Here's an example of a multi-line structure declaration, taken from the BBC BASIC for Windows manual:

Code: Select all

DIM osvi{Size%,     \ Size of structure
\        Major%,    \ Major version number
\        Minor%,    \ Minor Version number
\        Build%,    \ Build number
\        Platform%, \ Platform ID
\        SP&(127)   \ Service Pack string
\       }
Requiring a structure declaration to be on one line would be ridiculous, it would make it impossible to comment what each member means, and with some large structures it might not even fit (given the maximum line length of 251 bytes).
kirkkaf13@gmail.com
Posts: 9
Joined: Fri 23 Aug 2024, 21:37

Re: DIM structure

Post by kirkkaf13@gmail.com »

Thank you for pointing me in the right direction.

I would say it's not very clear from the manual since all the examples in the obvious places such as DIM and Structures only show single line examples and don't introduce this \ line continuation character.
Richard Russell
Posts: 366
Joined: Tue 18 Jun 2024, 09:32

Re: DIM structure

Post by Richard Russell »

kirkkaf13@gmail.com wrote: Thu 03 Apr 2025, 16:52 I would say it's not very clear from the manual since all the examples in the obvious places such as DIM and Structures only show single line examples
The line-continuation character is documented here, where it states that it may be used "almost anywhere that a space would be allowed". I don't think it would be feasible or desirable to try to modify the many places in the rest of the manual where a line-continuation character could be used so that one is in fact used.

Would you argue that the DIM statement is a special case, and is more deserving of having multi-line examples included in the documentation than other statements? To see what other BASICs do I've looked at the Liberty BASIC manual and the documentation of the DIM statement there does not include any examples of it being split into multiple lines, even though it can be.

And if it is your view that DIM is special, what about other examples of lists which can sometimes be usefully split into multiple lines, such as initialising arrays? Can you suggest specific places in the manual where you think multi-line examples should be added?