Jump to content

Photo

Skipping commands in multi-statement lines?


3 replies to this topic

#1 ramidavis OFFLINE  

ramidavis

    Star Raider

  • 66 posts

Posted Sun Nov 12, 2017 2:23 PM

I wish there was a way to use GOTO to jump to a specific part of a line.
What i mean is, instead of starting with the first command on a line, i wish i could jump past the first (or second, or third etc.) '::'.
For instance,
100 COMMAND#1::COMMAND#2::COMMAND#3::COMMAND#4
Lets say i wanted to jump line 100, but did not want COMMAND#1 to execute.
I would have to write the line as multiple lines, moving COMMAND#1 to a different line.

But lets just suppose there was a way to do what i want.
I imagine it looking something like this:
GOTO ;1 100
The ; and number following it indicate how far into the target line to jump.
Omit it to use GOTO / GOSUB as normal, or specify the number of '::' to be skipped in the target line using ;# syntax (;# could also be a variable like "GOTO ;X 100" where X=2).
Perhaps a future version of RXB could implement something like this?



#2 mizapf OFFLINE  

mizapf

    River Patroller

  • 2,587 posts
  • Location:Germany

Posted Sun Nov 12, 2017 3:14 PM

Has anybody done a performance review of multiple BASIC statements per line? When I read some of my old BASIC programs, I always wonder why I tried to squeeze that many commands in a single line. Maybe just because I could do it. But it was almost never good for readability.

 

(I admit this is the typical overbearing response in forums, asking whether you actually want that. :-) )



#3 ramidavis OFFLINE  

ramidavis

    Star Raider

  • Topic Starter
  • 66 posts

Posted Sun Nov 12, 2017 6:06 PM

I don't see how this could be anymore of a problem then QBasic's goto labels.

So yes, i actually do want this. (That or someone to port QBasic to TI.)


Edited by ramidavis, Sun Nov 12, 2017 6:12 PM.


#4 RXB OFFLINE  

RXB

    River Patroller

  • 2,809 posts
  • Location:Vancouver, Washington, USA

Posted Mon Nov 13, 2017 12:17 AM

This is just really asking for BAD PROGRAMMING on purpose.

 

The main argument against spaghetti code is the GOTO and JUMP in Assembly or JMP in GPL.

 

This is the reason for XB use of GOSUB and CALL NAMEHERE so this creates more efficient and better designed code. 

 

Which is why GPL has BL or CALL and Assembly has BL and BLWP in the first place.

 

Now agreed line numbers in Basic and XB are a pain but labels in general are no that much better as sequence is much harder to follow with labels vs line numbers.

 

Labels are more convenient to remember then line numbers which is why they are prefered but for human programmers, but  at the computers point of view is totally non binary.

 

This is especially true for labels like DSBGYT as only the original programmer know what this stands for, vs 17845 as a line number. (Both are hard to remember)

 

As for multiple code in a XB line you are not forced to use them and could be taken apart so each command or a few command can be on a line.

 

The reason to abandon spaghetti code by programmers started shortly after ADA language was invented, going back would be a really bad design computer science wise.






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users