Skip to main content
23 events
when toggle format what by license comment
Nov 2, 2021 at 11:01 history bumped CommunityBot This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Oct 2, 2021 at 12:20 comment added dave @supercat - maybe the 'derivation' happened before the 4th edition of Dartmouth BASIC?
Oct 2, 2021 at 8:58 history edited user3840170 CC BY-SA 4.0
added 10 characters in body
Oct 2, 2021 at 7:30 answer added dirkt timeline score: 2
Sep 30, 2021 at 17:45 comment added supercat @another-dave: For some reason I'd thought HP-BASIC was derived from Dartmouth BASIC. Was the way HP-BASIC handles strings unique to that dialect when it was produced (I know Atari BASIC behaved likewise, but that came later).
Sep 29, 2021 at 22:38 comment added dave @supercat - that's HP BASIC. DTSS had arrays of strings, so A$(4) is the 5th string. (0-based, as with numeric arrays). Hmm, I think perhaps I learned on HP BASIC - specifically it was dialup to the Open University, my maths teacher was doing a CS degree with the OU.
Sep 29, 2021 at 15:11 comment added supercat @BenCrowell: If the code had been "B2=C(I)", that could have been handled as "load variable 9; read that element of array 2; store that into variable #79". The presence of parentheses after "C" would have indicated that it was an array, whether or not the compiler knew of any "DIM" statement for it. If the book "A Basic Approach to BASIC" described Dartmouth BASIC as well as HP Basic (I used the latter) strings were a weird hybrid, since their names could be used with and without parentheses. "PRINT A$" would print all of A$, but IIRC "PRINT A$(4)" would print the fourth character.
Sep 29, 2021 at 15:06 comment added supercat @BenCrowell: I don't know if the first BASIC implementations reserved space to hold a value for every possible variable name, but they could certainly have had an array of 286 slots, each of which kept track of whether a variable was used and, if so, where it lived. When a BASIC interpreter received a line like "30 A1=B+C", it could scan that and convert it to an operation sequence "load variable 1; load variable 2; add them. Store the result to variable 52", without having to know anything about any other part of the program, since A1 would always be variable #52.
Sep 29, 2021 at 12:13 comment added dave @davidbak - "you don't see any type declarations". And, in most languages then, to the extent possible, you don't see any variable declarations, type or otherwise. Sometimes you need to specify array size, though BASIC defaulted to 11 elements. FORTRAN allowed you to control storage allocation (COMMON and EQUIVALENCE) but that's a little different to declaring a variable. ALGOL was an outlier in that every variable had to be explicitly declared, and as I recall reading, that idea was not 100% popular. Mostly, the early languages allowed you to introduce identifiers just by using them.
Sep 29, 2021 at 12:06 comment added dave @JeremyP - in BASIC, sure, but not in general. I'm suggesting that FORTRAN had a 'sigil prefix' rather than a 'sigil suffix'.
Sep 29, 2021 at 7:51 comment added JeremyP @davidbak Why not write up your comments into an answer?
Sep 29, 2021 at 7:50 comment added JeremyP @another-dave It is because the trailing $ is not part of the name but a leading letter is and that is especially important when you've only got two characters for each name (and the second character has to be a number).
Sep 29, 2021 at 0:26 comment added dave Is a trailing dollar sign significantly different to an initial I, J, K, L, M, or N? It doesn't seem that way to me, it's just dividing up the available-identifier space. The only difference (as hinted above) is that FORTRAN did the partitioning before there were users concerned about compatibility, and BASIC did it afterwards.
Sep 28, 2021 at 23:55 comment added user4766 @supercat: I don't understand your first comment, for the reasons benrg gave. I don't understand your second comment, since I don't understand where the "should" comes from.
Sep 28, 2021 at 21:06 comment added supercat @benrg: The question of whether 150 IF X < Y THEN 200 should perform a numeric comparison or a string comparison should not require examining anything else in the code, and should not be affected by anything else the program has done.
Sep 28, 2021 at 20:48 comment added benrg @supercat The lines have a dependency on the values of variables mentioned in them, though, and you could store the declared type in the same table. Or just have untyped variables and typed values, like Lisp. Maybe it just saves a bit of space to store variables of different types in separate linked lists.
Sep 28, 2021 at 20:15 comment added davidbak Finally, the era of the introduction of BASIC was the era of assembly languages, LISP, RPG, COBOL, and FORTRAN. You don't see any type declarations in any of those. (Well, COBOL. But that clearly wasn't going to influence any academically-designed language used for students.)
Sep 28, 2021 at 20:13 comment added davidbak It's kind of interesting, BTW, how limited Dartmouth BASIC was initially - yet, it was useful and popular enough that the experiment of creating it continued! Note that (according to that wikipedia article) it didn't even have an interactive mode of execution until v3!! (No "Enter 1 for YES, 2 for No" or even "Enter 1 to continue, 0 to stop" until then!)
Sep 28, 2021 at 20:08 comment added davidbak What supercat said for sure, plus, compatability with earlier versions of BASIC. There just weren't that many types. In fact, for the first THREE VERSIONS of Dartmouth BASIC there was only ONE type: float. String variables weren't introduced until version 4 (according to wikipedia). So, when introducing string variables, in addition to wanting to minimize implementation effort, you also wanted all old programs of your students and professors to keep working. So it would have been hard to introduce types.
Sep 28, 2021 at 19:12 comment added supercat BASIC was designed to allow lines of source to be processed without any semantic dependency upon any lines in the source code that have not been executed, nor any syntactic dependency upon other lines whether they have been executed or not. I don't know if it was the first such language, but those aspects somewhat force the design.
Sep 28, 2021 at 17:53 history edited user4766 CC BY-SA 4.0
added 15 characters in body
Sep 28, 2021 at 16:25 history edited user4766 CC BY-SA 4.0
added 65 characters in body
Sep 28, 2021 at 16:19 history asked user4766 CC BY-SA 4.0