Hacker News new | past | comments | ask | show | jobs | submit login

As a BASIC programmer from the 1980s, thank you for that heart attack.





They say BASIC programmers never die, the just GOSUB and never RETURN.

I remember my Atari behaving awfully slow (whole atari basic environment, even after the program finished) because I did many GOSUBs without the amount of RETURNs necessary, and didn't understand why because I was only 9yo at that time...

Trivia: at least in some BASICs (QBasic, QuickBasic, FreeBASIC) it's not necessary for every GOSUB to be matched with a RETURN, since the GOSUB is a single 'call' instruction that pushes onto the stack (and RETURN is a single 'ret' instruction, hence GOSUB-RETURN is highly efficient!) so it gets removed when you exit the function if you didn't RETURN, like alloca(). I actually re-implemented GOSUB this way using macros and inline assembly. I called it GOSUB/RETRACE.

In Wang BASIC, there was the "RETURN CLEAR" statement which cleared the stack up to and including the most recent GOSUB call frame. This includes any FOR loop frames that were push on the stack in the subroutine before the GOSUB. This was intended to be used for handling error conditions.

https://www.wang2200.org/basic_comparison.html#retclear


Or we get lost in DATA.

Just PEEK every address.

Careful doing that, you could POKE your eye out

Think of what TRON would do with that.

I don't have a Clu

For some reason your comment made me think about computed gosubs - pretty sure I've managed to forget about those for ~40 years!

lol GOSUB as a BASIC command, yes I can see the reference. It actually referes to the BASIC command.

Thanks for this! I didn't really use BASIC much back in the day, but I am from - ahem - an older time...and the name seemed so familiar, but quite couldn't place my finger on it. so, thanks for clarifying this! :-)

Logo? Lisp? Punched cards?

It's a great name!



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: