4 ms·
Cool idea! I always thought of Python being the modern Basic. Its interesting to see this - could there even be potential for something like this?
by kerng 8y ago
Cool idea! I always thought of Python being the modern Basic. Its interesting to see this - could there even be potential for something like this?
- int_19h 8y agoNot really. Like you said, we have better beginner languages now, Python being the most prominent (especially seeing how it has a turtle graphics library out of the box). BASIC is extremely inconsistent for a modern language.
- cm2187 8y agoPython has its own inconsistencies, like any language that has been around for a very long time. Like some collection properties have to be accessed with a function (len()) while other as an instance function. It doesn’t seem to follow any logic.
- int_19h 8y agoBASIC is far worse than that. Like, at least in Python, len() is a regular function. In BASIC, tons of core features are implemented as statements, with rather weird syntax that got even more weird over time. LINE (x1, y1) - (x2, y2), 5, FB Can you remember what it does? (no, it doesn't draw a line; it would, if not for "FB"). Or, for example, MID$ is a function, except when it's not: MID$(s$, 1) = "foo" Then there's stuff like DEFINT and GOSUB and ON STRIG and ... The reason for all this is that BASIC was never designed as a language in which the standard library could mostly be written, or even described, in that language. Thus, most features were implemented as intrinsics, with magic syntax and/or semantics, which varies drastically from feature to feature. This goes even for the standard functions - e.g. MID$ is a function (except when it's not, as above) - but it can take either 2 or 3 arguments, which is not something that you can declare yourself. As a result, when language evolved, it also did so in a haphazard way, as with LINE re-purposed for other reasons. The original BASIC was very simple (but also non-extensible). The BASIC that most people remember - at its peak - was actually more complicated than an equivalent subset of Python.
- DonHopkins 8y ago>>> s = 'foobar' >>> s[1:2] = 'xxx' Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'str' object does not support item assignment Dammit Python! Immutable strings.
- DonHopkins 8y agoAnd then there was Applesoft's assembly language extension mechanism: "&". Enhancing Applesoft using ampersand routines: https://link.springer.com/content/pdf/10.3758/BF03203836.pdf https://link.springer.com/content/pdf/10.3758/BF03203836.pdf >Applesoft BASIC's ampersand (&) jump feature gives the programmer an easy and fast way to connect machine language routines to BASIC. When the Applesoft interpreter encounters an "&," it does an immediate and unconditional jump to location $3F5 (decimal 1013). This feature, originally described as being "intended for the computer's internal use only" and "not a proper APPLESOFT command" (Apple Computer, 1978, p. 123), has become the favorite procedure for executing machine language routines from a running Applesoft program.
- int_19h 8y agoMost BASICs had something like that. Here's something from QBASIC documentation: Transfers control to a machine-language procedure. CALL ABSOLUTE ([argumentlist,] offset%) ▪ argumentlist Arguments passed to a machine-language procedure as offsets from the current data segment. ▪ offset% The offset from the current code segment, set by DEF SEG, to the starting location of the procedure. Example: 'Calls routine for printing the screen to a local printer. DIM a%(2) DEF SEG = VARSEG(a%(0)) FOR i% = 0 TO 2 READ d% POKE VARPTR(a%(0)) + i%, d% NEXT i% DATA 205, 5, 203 : ' int 5 retf 'Machine-language code 'for printing screen. CALL ABSOLUTE(VARPTR(a%(0))) DEF SEG And before that, there was DEF USR: http://www.antonis.de/qbebooks/gwbasman/defusr.html http://www.antonis.de/qbebooks/gwbasman/defusr.html
- Jaruzel 8y ago> LINE (x1, y1) - (x2, y2), 5, FB > Can you remember what it does? (no, it doesn't draw a line; it would, if not for "FB"). Yes. Draws a filled box (FB), from top-left (x1,y1) to bottom right (x2,y2) in Purple (colour 5). Although thinking about it... I'm pretty sure that the co-ords of 0,0 were bottom left, not top left on DOS based graphic screens, so is quite probably bottom-left to top-right. Source: One of my first 'paid' jobs was as a QB45 programmer for an accountancy firm in the mid 1990s.