Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The BASIC language has evolved a lot.

I think he's referring to very old BASIC which used numbered lines, a whole lot of GOTO's, did not support subroutines (or did it? Correct me...), etc.



Correct. Many of the concrete arguments from "Goto Considered Harmful" fall apart when you even have named labels rather than line numbers. BASIC can be used to make a mess, but BASIC can also be used to write highly structured programs- you must be dilligent. I haven't written BASIC in years, but personally I think BASIC taught me why structured programming, careful naming and indentation are all vital to creating comprehensible code. Staring down a few thousand lines of your own spaghetti code from months before drives the point home in a very useful way.


BASIC has always supported subroutines, albeit in about the most primitive way possible: the GOSUB command jumps to a particular line number, then the RETURN command jumps back to the line after the GOSUB.


ANSI BASIC has supported SUBs and FUNCTIONs going quite a ways back. Microsoft just didn't bother to support that standard except in its commercial compilers, and later beginning with QBasic.

Some non-Microsoft microcomputer BASICs (for example Extended BASIC on TI-99/4A) support them to some extent.


That may be the case, but the oldest ANSI basic that Wikipedia mentions is "for minimal Basic" from 1978. This text is from 1975, and I doubt that ANSI standard had anything like what we nowadays call functions.

Typical Basics of 1975 had gosub/return, but no functions (= no arguments, no return values). Apart from loop variables, all variables were global.

Commodore Basic had a "def fn" command, but it only supported single-line (= single-statement) functions.

Add in the effect that one had to 'name' subroutines by line number, and compare this with the Lisp's and Fortrans of ten years earlier, and Dijkstra's position becomes quite defensible.


Commodore Basic had a "def fn" command, but it only supported single-line (= single-statement) functions.

Sounds vaguely familiar!




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

Search: