[HN Gopher] Was BASIC that horrible or better?
___________________________________________________________________
Was BASIC that horrible or better?
Author : syx
Score : 104 points
Date : 2023-12-23 10:13 UTC (12 hours ago)
(HTM) web link (retrofun.pl)
(TXT) w3m dump (retrofun.pl)
| Aardwolf wrote:
| The only basic variant I used was qbasic, it was the first
| programming language I used!
|
| It's not horrible at all if a child can learn to make a game in
| it from scratch.
|
| However, qbasic doesn't have the line numbers (edit: at least not
| mandatory!). Never used a basic variant that requires the line
| numbers, but that seems like a total kludge!
| tgv wrote:
| It was fun. The dense text, all caps, line numbers in the left
| column, peeking and poking in memory, simple variables, it felt
| as a direct connection with the machine. The step to assembler
| wasn't that big. They shared some aesthetics, and certainly the
| spaghetti structure. And it possibly made me appreciate the
| algol-inspired languages more.
| rahen wrote:
| Exactly. BASIC a high-level low-level language, effectively
| pretty close to assembly.
| thriftwy wrote:
| QBasic could do line numbers all right. It did not require
| them, that's that. It had labels and loops, so why bother.
| pavlov wrote:
| There were many kinds of BASIC created over the years. Some were
| incredibly limited interpreters for computers with 1kB available
| working memory, and decades later others were full-fledged
| desktop languages with structured programming and objects and GUI
| event loops.
|
| Is TypeScript in 2023 the same language as JavaScript in 1996?
| The various BASICs were even more different than that. It's
| impossible to say that they were all categorically horrible or
| perfect. But they did enable millions of people to discover
| computing, on everything from ZX-81 to Windows 95.
| jasfi wrote:
| BASIC was a product of its time.
| kragen wrote:
| as the article points out, many contemporary and even earlier
| languages supported structured flow control, records, local
| variables, and subroutines with arguments. and of course lisp
| was basically javascript
|
| basic had the advantage of being implementable in 4 kilobytes
| of ram and being memory-safe
| zabzonk wrote:
| > memory-safe
|
| you are forgetting peek and poke.
| kragen wrote:
| i don't think the dartmouth system had those, and anyway
| it's not the same problem as risking a crash every time you
| index an array
| pjmlp wrote:
| The problem is most times C stuff doesn't crash, it
| corrupts memory and erroneous results.
|
| We're lucky if it crashes.
| pjmlp wrote:
| Just like unsafe code blocks in modern languages, quite
| easy to search for.
|
| Basic has proper strings, proper arrays, with bounds
| checking, and automatic memory management.
| drewcoo wrote:
| > of course lisp was basically javascript
|
| Those used to be fighting words around here!
| mhd wrote:
| Nobody is ever talking about the original Dartmouth BASIC, so
| we're really talking about a vast language family here.
| Arguably with more difference between different strands than
| e.g. within the BCPL family.
| vajrabum wrote:
| Dijkstra was in fact talking about something very close to
| the original Darmouth BASIC. In 1975 all the other BASICs,
| like for example the CDC one I used, looked pretty similar to
| the original. And the differences back then were much smaller
| than what you see today or even in the 80s.
| ziotom78 wrote:
| It's been a long time since I programmed in BASIC, but I have
| gone memories of it.
|
| My very first computer was a Commodore Vic20, whose User's Manual
| was essentially a BASIC manual. One of the very first programs I
| learned to wrote drew a simple bird on the screen made by
| characters and made its wings flap. I was mesmerised.
|
| Boy, how much I enjoyed that manual!
|
| Edit: bids -> bird
| kleiba wrote:
| I started out on the C64, but that manual, too, received much
| love from me. I read it until it pretty much fell apart. Oh,
| well, the spiral binding might also have had something to do
| with that ;-)
| cbm-vic-20 wrote:
| The VIC-20 Programmers Reference was also a great next step, to
| get you into assembly/machine language. There wasn't a good
| freely-available assembler, so you get to become the assembler
| itself, POKEing instructions into memory.
|
| https://archive.org/details/commodore-vic-20-manual-del-usua...
|
| https://archive.org/details/VIC-20ProgrammersReferenceGuide1...
| RedNifre wrote:
| It's a great language if you want to write a compiler for fun:
| You can add the different statements incrementally, so you
| quickly get to a point where you can compile your first program
| and then add more and more features to compile more and more.
|
| Also, when I was implementing FOR, my first naive implementation
| was compiling the body first, then append the loop related things
| that check the conditional and jump backwards to the start of the
| body. "Hang on, what about the case when the condition is
| initially false?" I thought, only to discover that the BASIC
| standard actually specifies that a FOR loop runs at least once,
| even if the condition is false! Officially, the language is
| advertised as for beginners, but to me it looks like it was meant
| as a lingua franca of computers, as in not only easy to
| understand, but also easy to implement.
|
| Here's a BASIC compiler for the HP 15-C calculator written in
| Idris:
| https://gitlab.com/michaelzinn/voyc/-/blob/master/src/Compil...
| yiransheng wrote:
| Trying to compile Basic is actually a bit trickier than just
| implementing an interpreter indeed. Like the FOR statement
| example you mentioned. Another messy situation is non-lexical
| FOR/NEXT like here [1], where NEXT can be encountered before a
| FOR statement, fairly certain I did not get it entirely right
| there.
|
| Original Dartmouth BASIC had only 14 statement types, and it
| takes very little efforts to enumerate and implement all of
| them, even if you are just starting on a compiler journey and
| making things up suboptimally along the way.
|
| The bonus upside for choosing BASIC as your first compiler
| project is that you get decades of vintage test programs to
| play with like this one [2].
|
| [1]
| https://github.com/yiransheng/basic_rs/blob/ddd64e2eacfc2b36...
|
| [2] Game of Life compiled to warm: http://subdued-
| afternoon.surge.sh/
| flohofwoe wrote:
| The biggest achievement of BASIC was probably that it was _the_
| gateway drug into computing for teenagers throughout the 80 's,
| because every popular home computer came with a BASIC builtin,
| available right after switching the computer on.
| sokoloff wrote:
| Exactly! My Atari booted up to a READY prompt and even loading
| a program/game from tape required typing a BASIC command. The
| on-ramp was incredibly shallow and smooth.
| TheOtherHobbes wrote:
| Yes. You owned the entire machine, there was a progression to
| assembler (awkard, but possible if you didn't mind hand-
| assembling the hex and typing into a BASIC shell), and you
| could a huge amount just with that.
|
| The capabilities and the limits captured your imagination in
| a way that the modern stack doesn't come close to.
|
| And especially in the UK, easy and cheap access to 8-bit
| machines for teenagers launched a generation of coding
| careers.
|
| So Dijsktra is wrong. It's very possible to learn CS
| principles after learning BASIC. it's certainly an
| adjustment, but it's very easy to sell if you explain that
| you can build larger structured projects from smaller
| elements, including more complex data structures - not a
| difficult concept for anyone who taught themselves assembler
| from magazine articles and books, because there was no other
| help or support.
|
| The other thing BASIC did was gave some of those teens a
| career. The cost of entry to a small game business was very
| low, and there were plenty of games that didn't even need
| assembler.
|
| A bit of advertising in the magazines, maybe some hand
| duplication to start with, and good games made non-trivial
| money almost immediately, through organic word of mouth
| promotion.
| jaybrendansmith wrote:
| I found it very easy to learn these principles once BASIC
| taught me loops and functions. Once out of BASIC, a tough
| concept to grok was passing pointers and different data
| types, because BASIC made global and local variables so
| brainless. Object-oriented languages are in many ways
| further from assembly than BASIC, but even VB teaches you
| objects and methods and properties albeit in a very simple
| form. Leaving the virtual box framework of basic was also
| somewhat difficult, but I don't think learning basic made
| it any harder or easier, just more frustrating because it
| seemed so pointless at first. It's like learning to drive
| an automatic and having someone tell you that you must now
| learn a manual transmission with manual brakes and
| steering, and how to change the oil/clean the carb. Seems
| silly at first, but ultimately rewarding.
| karmakaze wrote:
| Same here, got my Atari 400 (with the membrane keyboard) and
| wrote so many games, then later utility programs, machine
| code routines, and not long after macro assembler.
|
| In no time, we were exposed to FFI (calling machine code
| routines) and internals (like BASIC program/token storage to
| make a line renumbering utility), and all the hardware
| interface memory locations. Learning how software copy-
| protection worked and defeating it was a great reverse-
| engineering/debugging passtime.
|
| We were always reading about new tricks and sharing with each
| other who had the same machines. Getting a copy of the "De Re
| Atari" document was the holy grail where we felt like we had
| access to know everything, and we mostly did. I even tried as
| a kid to make a multitasking 'game' which failed because I
| didn't know enough about interrupt handlers, but I was close
| --it worked, briefly.
| greenbit wrote:
| Indeed. Flick that power switch and in less than a second, that
| machine was READY!
| B1FF_PSUVM wrote:
| > every popular home computer came with a BASIC builtin,
|
| Until the Mac put the kibosh on that. You were firmly on the
| outside of the box, and to get in you had to buy either a box
| of floppies from Apple (MDW, was it?) or something like
| Lightning C which was just a couple of disks if memory serves.
|
| Later there was the Hypercard thing, a scripting tool from
| Apple which did get some traction, but was never very popular.
| krallja wrote:
| Microsoft BASIC for the Macintosh was quite nice, actually!
| kalleboo wrote:
| Microsoft wouldn't let Apple release a BASIC for the Mac
| https://folklore.org/MacBasic.html
| karmakaze wrote:
| The article mentions processing.js as a modern equivalent,
| which it can serve being rather high level and outputting great
| graphics. But that misses the "close to the machine" aspect of
| having a computer fully within the control of your hands.
|
| Similarly using a web browser and View Source for HTML/CSS+JS
| was a modern equivalent before we had all the single-page-
| apps/frameworks that make it incomprehensible. And again the
| 'machine' is an abstracted web client.
|
| The Commander X16 project[0] aims to recreate that environment
| for modern times (and also available for purchase). It's
| effectively what a C64 might be today, with more (but still
| limited) memory and easy to program graphics and sound.
| Something like a Raspberry Pi 400 looks the part but would end
| up running something like Linux and OpenGL ES2.0 which isn't
| much different than a regular desktop.
|
| I can't find the original video where I saw the project getting
| started, but here's a review[1] that runs through what it is.
|
| [0] https://www.commanderx16.com/
|
| [1] https://www.youtube.com/watch?v=bFIk8WV-RYQ
| citrin_ru wrote:
| What modern equivalents lack compare to pre-internet
| computers (including ones which come with BASIC) is a
| distraction free environment.
| AlexeyBrin wrote:
| I think Agon Light or Neo6502 are more affordable and as
| close to the machine as Commander X16.
| karmakaze wrote:
| Yeah the Commander X16 isn't the most affordable, but I
| think it's the most accurate 'retro' machine. Specifically
| the custom VERA graphics hardware works in ways analogous
| to the machines of the time with various tile or bitmap
| modes and sprites. It's also in the 'batteries included'
| camp with lots of software support to get right into
| writing programs rather than lower-level tinkering.
|
| There's even a full emulator[0] available so you can hack
| with friends who don't have one, or share your creations to
| run in the emulator.
|
| [0] https://github.com/x16community/x16-emulator
| rational_indian wrote:
| It was okay. Just don't use it to build large systems. It is
| known to create an unmaintainable mess.
| pjmlp wrote:
| Counter example, VMS Basic.
| nathell wrote:
| I'm so happy that this article mentions Bajtek.
|
| It was one of the most important, if not _the_ most important,
| source of computing knowledge in my early childhood. I was born
| in 1984, got my first computer - a C64C - in 1991, and my dad
| procured a heap of past issues of ,,Bajtek" from previous years.
| In rural Poland those days, knowledge was hard to come by, so
| those proved invaluable to me.
|
| Not only were there type-in programs and games, like in the
| German 64er, but most of them were actually accompanied by prose
| articles that offered clear explanations, background, and trivia.
| I learned BASIC from Bajtek and a few books. Bajtek literally had
| a monthly column called ,,For Preschoolers Only" with a BASIC
| tutorial in it.
| jeffwass wrote:
| BASIC was ideal for introducing a generation of school kids to
| programming.
|
| Back in the 80's you fired up your computer and you had a
| readily-available interpreter for which you could immediately do
| 'real' stuff like printing characters anywhere on the screen and
| turning on and off pixels (even in colour on some platforms).
|
| There was no need to compile or build a project or start with a
| lot of boilerplate. You just did stuff right away from a REPL or
| could make programs from line numbers and save them.
|
| I learned a ton from it. Eg how to think algorithmically and
| break up something complicated into small parts. A key milestone
| was grokking the difference between GOTO and GOSUB. I also
| understood much about its limitations once I started learning
| Turbo Pascal in high school.
|
| If you're judging BASIC compared to a modern IDE with a modern
| structured language of course it falls short, but for what it was
| at the time it was nearly perfect.
| wslh wrote:
| As a child a learnt BASIC after having taught LOGO. As a child
| that was an advancement (with all due respect to LOGO). Almost
| every computer included BASIC so it was an universal programming
| language for home computers. You could also interact with
| assembler (CALL/SYS instructions) so it enabled to go even
| farther. Conclusion, BASIC was pervasive and it was not horrible
| since your focus was in creating something on cheap personal
| computers. I know two older people than me, accountants, that
| learnt BASIC around their 40s and build their own accounting
| programs in a ZX81 [2] and TI-99/4A [3]. I don't think many
| people now of that age (plus "age inflation") learn this new
| skill (programming) and create an useful program or even a script
| for themselves.
|
| The language is primitive by today's standards but it gives you
| all sort of ways to express yourself. When BASIC progressed and
| was more structured, for example AmigaBASIC from Microsoft [2],
| there were more alternatives and more evolution so it is natural
| that BASIC faded.
|
| Also important to highlight that every popular computer magazine
| (media) published BASIC code, also books.
|
| [1] https://en.wikipedia.org/wiki/ZX81
|
| [2] https://en.wikipedia.org/wiki/AmigaBASIC
|
| [3] https://en.wikipedia.org/wiki/TI-99/4A
| sdsd wrote:
| I've programmed extensively in QBasic and TI-BASIC. Both were
| extremely limiting, ofc.
|
| But there is one thing I'm very grateful for, in retrospect. Both
| languages required very few "concepts". Functions? Pointers?
| Classes? These are basics for coders, but BASIC didn't ask even
| this of you.
|
| With a small syntactic baseline you could make full on games
| pretty easily. Compare this to making games even with Python
| using PyGame, or Godot, or whathaveyou.
|
| Of course, nothing prevents you from learning Python and just
| limiting yourself to a few data types and control structures. But
| what really made BASICs easy (for me) was that "draw to the
| screen" was such a primitive operation. Same with detecting
| keypresses.
|
| Again, these are easy if you're a software engineer, or even if
| you know how to code. But what if you don't?
|
| Even Visual Basic had this virtue. When I was in Mexico I
| volunteered at a homeless shelter. The man who operated the
| shelter had no coding education, but was able to self teach
| Visual Basic two decades ago, and had created an entire system
| for managing the facility.
|
| He had tried to rewrite it to use a more modern language (I
| believe C# or VB.Net) and was totally unable.
|
| I've never used VB but I've heard countless tales like this,
| where non-coders create entire functioning software in it.
| pjmlp wrote:
| Which is why VBA is still loved, regardless how many think it
| is outdated.
|
| Lost count of non-coders that outgrown their Excel macros that
| I got to know, that dive into VBA, eventually ask IT for VS and
| VB.NET.
| XorNot wrote:
| Linux is still missing something which had as tight a
| development loop as VB in terms of "intent -> result" (I've
| never managed to get Glade or any of the similar GUI tools
| working, and thus never really written a GUI app in Linux).
| pjmlp wrote:
| Have a try at Gambas.
|
| https://gambas.sourceforge.net/en/main.html
|
| Or Lazarus, for the Delphi variant,
|
| https://www.lazarus-ide.org/
| hoistbypetard wrote:
| Gambas very much fits that bill, as the other reply
| mentioned. If you want to pay for something, Xojo (formerly
| known as RealBASIC) does too: https://www.xojo.com
| campsoftware wrote:
| Xojo is full of bugs. https://ifnotnil.com was set up
| after Xojo banned users for complaining...
| pjmlp wrote:
| What a pity, I liked the product when it was Real BASIC.
| hoistbypetard wrote:
| Ugh! I hate to hear that. I used to like RealBASIC, and
| thought they'd kept up that spirit.
| ajuc wrote:
| bash?
| Turing_Machine wrote:
| Loved or hated, it's going to be around for a very, very long
| time, IMO.
|
| Too much business depends on some VBA macro that Shirley in
| Accounting or Jim in Shipping wrote 20 years ago.
| pjmlp wrote:
| And their replacements were adding new code just last week.
| ofrzeta wrote:
| Why would it be outdated? I just spent some time browsing the
| VB .NET docs and there's about everything you could imagine
| including async functions or iterators.
| sigzero wrote:
| VBA != VB.NET
| signaru wrote:
| I also used to be a non coder until I got my hands on VB.
| Consequently, my first programs were GUI instead of command
| line, which was everyone else's "hello world". It took a while
| to convince myself to learn other languages that didn't have
| GUI out of the box, because non-GUI software didn't look like
| the software I knew or wanted. My more "advanced" C/C++
| friends, on the other hand, thought of GUI stuff as being more
| difficult.
| noduerme wrote:
| I also grew up with BASIC (no new flavor. Controlling pixels
| one at a time on a TRS-80). One thing it teaches you is how to
| organize your own code, i.e., spaghetti is so easy in that
| format that you develop a lifelong appreciation for OO or
| functional code once you move on to it from thousand lines of
| GOTO and GOSUB... yet it teaches you everything you need. Yea
| it exposes screen interfaces you don't have to write yourself,
| but the point is to teach logic, not pure CS. Every first time
| coder should be exposed to BASIC because it has no preference
| or bias... any code you write in it will be equally shitty and
| equally educational.
| charlieyu1 wrote:
| Learning BASIC made me feel OO, clear variable names and
| clean code was unnecessary and I made no effort learning that
| back then. I'd regret about that much later
| greenbit wrote:
| Nearly the same story here. In HS the only computers in sight
| were TRS80 IIIs, PET4032s, and C64s. By graduation I'd moved
| to assembler for the sense of the metal and the speed.
|
| First year at college, took intro to programming in Pascal,
| and oh what breath of fresh air that was. Sure it was
| cumbersome, had a lot of ceremony, but it had procedures and
| functions that you could pass parameters to! And structures!
| Things that had been a hassle in BASIC suddenly had legible
| descriptions.
|
| But yes, BASIC did one thing very well: it got out of your
| way and let you cut your teeth on the fundamental concept -
| that a machine can follow a sequence of simple instructions
| to produce complex behavior. It provided a sense of that
| dynamic, that I think would have been a little less obvious
| with an edit/compile/test environment with as much ceremony
| as Pascal etc.
| hedora wrote:
| I'm surprised how close JS has gotten to this:
|
| https://developer.mozilla.org/en-US/docs/Games/Tutorials/2D_...
|
| It's not quite there, but getting to a context similar to a
| qbasic graphics mode is only 10-20 lines of boilerplate.
| radicalbyte wrote:
| Python is ideal! You can just drop code in a file - no
| structure - and it runs. Then when you have code you wanna
| reuse just wrap it in a function and drop it at the top of your
| file. That get too much? Split it into a different file and
| import. Have cases where data + logic in functions kinda all
| fit together? Move them to a class. Start getting overwhelmed
| by all the runtime errors and stuff being slow? Learn C#,
| Kotlin, Java or Rust.
| donatj wrote:
| I spent a pretty significant amount of time in QBasic. It
| definitely has functions. It also has subroutines "Subs" and
| the difference was a function returned a value and a subroutine
| did not.
| whstl wrote:
| I remember QBasic (the DOS 6 version at least) having a
| distinction between Subs and Functions, where the function
| returns a value but the Sub doesn't.
|
| I never stoped to wonder why and just accepted this as reality,
| but the mere existence of this distinction helped me understand
| software from an engineering point of view quite early.
|
| It was a bridge to Functional programming, CQRS, Bertrand
| Meyer's teachings, 10 years before I could even have a chance
| of hearing about it.
| colanderman wrote:
| I didn't understand it at the time, but even Applesoft BASIC
| made the same distinction (DEF FN/FN vs. GOSUB/RETURN). In
| fact functions could only be defined as pure mathematical
| expressions.
| 7thaccount wrote:
| There are some modern versions of basic (e.g. Purebasic and
| Powerbasic) that seem extremely nice. Also, there is Xojo,
| which is a fully OO Basic that natively cross compiles to
| Mac/Windows/Linux/Android/iOS/Raspberry pi. Xojo also has a
| full RAD tool that abstracts away a lot of stuff. Pretty easy
| to build games on it too. It's commercial though.
| pjmlp wrote:
| We miss having environments like BASIC nowadays, Python is
| probably the closest to it, but at least by the 16 and 32 bit
| days of home computers, BASIC not only was structured, native
| compilation was part of the picture against.
|
| Guess we need to hope for Mojo's success.
| thriftwy wrote:
| Pascal (the reference PL) is sooo clumsy and verbose that I just
| can't take Dijkstra's opinion at its face value.
|
| Maybe early BASICs were so-so, but QBasic already had all kind if
| procedural stuff.
| vajrabum wrote:
| In 1975 there was no QBasic which according to Wikipedia was
| delivered in 1991. And pretty much no microcomputers.
| thriftwy wrote:
| What would that generation of programmers do their thing on?
| A programmable abacus?
| vajrabum wrote:
| Mainframes or minicomputers of course, mostly from IBM
| (mainframe) and DEC (minicomputers). There were other
| players and IBM sold minis and DEC sold mainframes but
| those two dominated those two niches.
| thriftwy wrote:
| How do you spoil mainframe programmers? I don't believe
| they had sufficient passion and/or freedom to manifest
| spoiledness.
| alerighi wrote:
| What is a good program? To me, it's a program that does something
| useful and serves a purpose (being this a person or an
| organization).
|
| I'm tired of this "good programming", there is people that talks
| about good programming and than produced programs that are either
| too complex to do something useful. These to me are bad programs!
|
| There were a ton of companies or persons that used (and still
| use) BASIC (or Visual Basic) programs to do stuff, and maybe if
| it wasn't for BASIC these programs would probably never be
| written.
|
| Same thing we can say about COBOL, a ton of companies are run by
| an IBM AS/400 running old COBOL programs written in the 80s that
| still work fine.
| cm2187 wrote:
| Running fine isn't the only measure. It also needs to be
| maintainable. Those old COBOL programs are a major headache for
| the organisations running them. One company I worked for had to
| pull old COBOL developers out of retirement to implement a
| mandatory change to a critical program. I don't know what they
| will do if it happens again in 10 years.
|
| I agree with your point on companies running on VBA and how
| much worse the world would be without. But I still blame
| microsoft for making a language stuck in the 90s the only
| option for those users to integrate simple coding into their
| workflows. They are forcing users onto a bad path (and I am not
| complaining about the Basic syntax itself, but about the lack
| of the 25y of evolution and improvements you would find in
| VB.net).
| alerighi wrote:
| I don't see what there is such difficult in a COBOL program
| to have to take a programmer out of retirement. The syntax
| may be different and old, but still there is no reason why a
| programmer can't learn it. I mean, I know people of my age
| (30 years) that work on companies that still maintain COBOL
| programs, and they learned it (some of this went to work for
| these companies right after high school).
|
| It's not that is rocket science, like it is not BASIC. The
| most difficult thing is getting a development environment set
| up, but a company that maintains such programs can use
| virtual machines and test systems. There are even companies
| that provide you "cloud" IBM AS/400.
|
| Anyway, what I meant is that normal companies are not Google,
| you find a small department of developers (in case of small
| companies, only one) that does everyting, from fixing the
| printers to developing the programs that are useful to
| automate and do the job the company needs to do. I've seen
| companies build even systems that manage an entire production
| plant in house with a complex business logic, something that
| not even commercial software that cost thousands of dollars
| do!
|
| With no budget, and thanks to simple programming languages
| (in the past was BASIC, today I say that it's python)
| companies write programs that helps them speed up the work,
| that may be an ugly file of 10.000 lines of code with few
| comments, copied/pasted blocks, classes with poor or no
| encapsulation, but that work.
|
| Saying that they are bad programs because they don't follow
| SOLID pricniples, or they don't do TDD or have a CI set up,
| or they are on a folder in file server instead of a git
| repository, to me is stupid. A bad program to me is a program
| that doesn't work, a program that has bugs, a program that
| doesn't solve the problem it was designed to solve.
| acqq wrote:
| Trying to solve the modern problems and showing that one needs
| more code than in Python is not the point.
|
| The reason Basic wasn't horrible but amazing at the time as the
| home computers appeared is hard to understand without the context
| of that time:
|
| Basic on these computers was, in today's language:
|
| - an actual "complete" operating system and
|
| - a command language and
|
| - a script language and
|
| - a programming language
|
| Additionally, if one wanted to use the "full power" of the CPU
| one had to use machine code, as there was so little RAM that most
| of the programs that did fascinating stuff were true
| masterpieces. Those using Basic knew that it's not "all there
| is".
| forinti wrote:
| I don't think there was a better language for 8 bit micros.
|
| It was line oriented so you didn't need an editor. It was simple
| and had a very short learning curve.
|
| You were never going to write a huge program, so modules or
| packages weren't a necessity.
|
| It just fit this niche perfectly.
| karmakaze wrote:
| One really cool thing Atari Basic did was that you could list
| lines x,y and just move your cursor up to the line you wanted
| to change and insert/delete/overtype characters. It would even
| handle line-wrapping of the logical line up to 3 physical
| lines. Press enter and that's the new line (or change the line
| number and it's a new source line).
|
| It was often used for renumbering a few lines to make room for
| more as there was no built-in renumber utility.
| zozbot234 wrote:
| FORTH was the closest competitor. Perhaps it could have worked
| well enough if it was extended with custom parsing modes for
| infix arithmetic and for printing out floating point numbers,
| which were the main poimts where even minimal versions of BASIC
| were genuinely more user-friendly than FORTH.
| greenbit wrote:
| Punched cards were a thing of the past when I first encountered
| computers (in the form of ROM BASIC machines like the TRS80 and
| PET4032), but there's just something fascinating about being able
| to physically hold the individual lines of your program in your
| hand.
|
| These days if you want to run a program to crunch some numbers,
| the program is one file, and the data another - but back then,
| since you fed the whole 'job' into the card reader at once, you
| could change the data set by just swapping out the cards.
|
| Not saying that this was in any way better. Just that the idea of
| it feels so alien - and this was the era in which BASIC first
| evolved.
| eesmith wrote:
| Darthmouth BASIC used teletype terminals, not punched card
| input. The article has a picture, and comments "Dartmouth did
| better. At any time, when the program was in memory, you could
| use SAVE to save it from being forgotten when you finish
| working with the computer, and RUN to compile and execute it
| right away."
| wruza wrote:
| I still remember the appeal of BASIC to me as a kid. A simple
| GOTO loop over INKEY, in which you can test which key is pressed
| and erase+redraw a CIRCLE accordingly. A trivial thing, but the
| feel it created was unforgettable.
|
| Idk what Dijkstra means. My whole generation started with BASIC
| and learned languages as they've become useful enough for every
| new wave of accessible hardware, which wasn't cheap for a hobby.
| There was no like "oh, now you're lost". My next language was
| 8080 assembly then Pascal then 8086 then C. You just can't learn
| Pascal and C on a Sinclair clone when loading a compiler from a
| tape recorder takes half an hour and most of the available
| memory. And you can't learn Python either, because it doesn't
| really exist yet. I know it's from 1991, but never heard of it
| until ten+ years later.
|
| I also know that some ROMs had FORTRAN instead. Maybe Dijkstra
| would like to re-teach FORTRAN programmers more.
| eesmith wrote:
| > Idk what Dijkstra means.
|
| I thought the article did a pretty good job about describing
| what Dijkstra meant, and pointing out it was written years
| before you learned a BASIC variant on a microcomputer.
|
| What are you still unsure about?
|
| > Maybe Dijkstra would like to re-teach FORTRAN programmers
| more.
|
| Unlikely. The article points out Dijkstra called FORTRAN
| "hopelessly inadequate".
| InfamousRece wrote:
| I actually learned Pascal on a ZX Spectrum clone. It was Hisoft
| Pascal, so it was a bit limited (no strings - you had to use
| ARRAY OF CHAR instead). But it was awesome to draw 3D graphs
| due to its "fast" floating point routines.
| MarkusWandel wrote:
| On the Commodore PET, at least, you could do all kinds of clever
| things with BASIC due to the special graphics characters and the
| "cursor control" characters that could be embedded in strings
| (up/down/left/right etc). One of my hacks was a playable, graphic
| video game in _one_ line of code (almost the full maximum 80
| characters) and another is the standard 1-liner that generates
| mazes.
|
| For examples of fancy BASIC graphic programs, search for:
|
| https://www.youtube.com/results?search_query=cursor+tape+mag...
|
| Cursor magazine programs did occasionally have an assembly
| language subroutine; at least one flashed the screen using one.
| But most of them were just BASIC.
|
| Purists may scoff, but kids with zero experience could make
| animated graphics after just a day or two of playing around, and
| curiosity about how more sophisticated programs worked (in my
| case: The "Miser" text adventure game) would soon motivate to
| find out more. Is that bad? It was the whole point of the
| language, the B stands for "Beginner". Plenty of time to graduate
| to other things later (in my case: Assembly language -> Pascal ->
| C).
| odux wrote:
| Basic was my second programming language after Logo[1] in the
| early 90s (I was in 5th grade) in a third world country, on very
| slow computers that a factory had donated to my school after they
| had passed their useful life for the factory. In such an
| environment basic was amazing. Low barrier of entry both from
| computing and knowledge perspective. Easy to learn and create a
| lifetime of love and passion for programming and all things
| computers in people like me.
|
| [1]: https://en.m.wikipedia.org/wiki/Logo_(programming_language)
| weinzierl wrote:
| I've been thinking about this recently when teaching my daughter
| to program.
|
| What was very different about BASIC compared to today was that it
| was _" Beginners' All-purpose Symbolic Instruction Code"_ (that's
| what BASIC stands for). At the same time it used to be used by
| adults to solve real world problems.
|
| If you outgrew BASIC you could easily segue into Pascal which was
| much more powerful but still designed with education in mind.
|
| I think today the gap between what is used to _teach_ and what is
| used to _solve problems_ is much bigger. Once children get older
| the motivation for toy languages understandably goes away but
| learning a modern programming language that is actually used in
| the industry is a big step that is not easy to overcome.
|
| I have no perfect solution for that but for us and for now we
| settled for Godot and GD Script. It is simple enough to get
| started and I think when I showed my daughter the Tesla App [1]
| it was a big motivation.
|
| [1] I've heard the current version it is not made in Godot
| anymore, but it was when we started on this journey a while ago.
| nox100 wrote:
| I'd say Scratch is the #1 way kids to day are introduced to
| programming in 2023
|
| For parents that have some 8bit experience, Pico-8 (LUA) is
| also relatively popular. It's basically like running an Apple
| 2, Atari 800, Commodore 64 as if it booted into LUA instead of
| Basic. You can trivially draw things, and peak and poke bytes
| into "Screen memory" if you want to feel like you're "touching
| the hardware"
|
| JavaScript is also available everywhere a kid might be and it's
| easy to draw stuff with literally millions of examples all over
| the net. Processing.JS is also a thing
| https://thecodingtrain.com/
| pmontra wrote:
| How easy is it to move from Scratch to a traditional text
| oriented programming language, let's say Python?
| _trampeltier wrote:
| At least QBasic was great. No line numbers and came with a very
| good ducumentation. This was very important before internet was
| in every home.
| downut wrote:
| I spent the summer of '83 at the GE Wilmington, NC nuclear fuels
| plant as the sole user of an HP 9845C with the integrated full
| size plotter. My job as a GA Tech ChE co-op student was to go
| around the plant with a rather simple gradient air sampling unit
| mapping out the airborne density of the various sizes of UO2. I
| would take my overnight measurements (point a geiger counter at
| the different filter papers from the different levels) and enter
| the data into a program I wrote in... HP Basic. I would then feed
| that into another program I wrote in... HP Basic that plotted the
| densities as level plots in HPGL across a rather detailed for the
| time 2D map of the plant. It produced multicolor paper plots on
| full size drafting paper. My bosses, the physicists in the safety
| department, were very pleased. I was so happy doing this that I
| spent the evenings in the UNC Wilmington library learning level
| plotting algorithms. I needed more programming time so I would
| come in very early in the morning and have to remember to clock
| in at 8AM (overtime not allowed). All of us co-ops made $10/hr in
| '83, and I saved enough to pay for the entire next quarter at Ga
| Tech every quarter I spent working.
|
| Weekends I spent at the beach, though.
|
| I see from Wikipedia that the system costs were enormous! But
| that was an exquisite summer romance with BASIC.
|
| Not too many years later I discovered Turbo Pascal. Yeah, off to
| the races. And then came Turbo C++, and g++ around '92. Haha you
| kids today would really enjoy debugging templates in early g++.
| (The idea that you could write the same code for 'float' and
| 'double' was intoxicatingly cool.)
|
| The transition from Fortran (what I learned to program with) =>
| HP Basic => Pascal => C++ was pretty easy. Pointers, well if you
| study 'The C Programming Language' carefully, are not difficult.
| People writing serious computational mathematics codes are
| constantly using pointers, just not as 'pointers'. Debugging,
| well that is another problem entirely, and I believe from way out
| here in the future, that that is the most difficult problem of
| all. How to program in such a way that the bugs are not silent.
| Those silent ones were the cause of most of the grief in my
| programming life.
|
| The thing about HP Basic is none of the bugs were ever silent.
| Same with Turbo Pascal. I did a lot of really cool things with
| those 'toy' languages. They never caused me any grief.
|
| So I think Dijkstra didn't understand (maybe) the importance of
| painless pleasure when (some) mortals are learning programming.
| It sure turned me on.
| glimshe wrote:
| BASIC was responsible for sparking the interest in computers for
| a generation. One of the most harmful falsehoods about it is that
| somehow GOTOs and line numbers would turn you into a bad
| programmer for life. I think that even today there is nothing
| like BASIC to get kids interested in computers.
|
| But it's not a language just for kids. While most dialects are
| somewhat limiting, there is nonetheless a TON of real useful
| stuff you can do with it.
| phkahler wrote:
| I learned Basic at 10, and I would argue that Python is a
| better choice today. But regardless of which one, the most
| important thing about basic was that for a while _every_
| computer came with some flavor of Basic. It 's what got a
| generation hooked on tech.
|
| Why oh why doesn't Windows and macOS come with Python and Idle
| out of the box? Or does Mac, I forget.
| Cockbrand wrote:
| The Mac does come with Python, but of course it's easier to
| get started from zero when the first thing you see after
| switching on the computer is a BASIC prompt.
| leetrout wrote:
| Mac like other bsd/linux includes a system python but not
| idle.
| radicalbyte wrote:
| I also started with BASIC at 10 (C64 in 1990) and I'm going
| to teach my kids to code in Python. It's simple (low
| abstraction) and integrates well with other things (IoT) and
| they can use a REPL.
|
| It's disappointing that Windows doesn't release with an
| accessible interpreted language. They ship with a couple of
| games so why not drop some kind of super integrated and
| simple programming environment? Most of my generation cut
| their teeth on Microsoft Basic after all.
| colonelpopcorn wrote:
| I think most tech companies rely on ignorance to sell their
| "simple" solutions. If everyone could solve their own
| problems their own way, then nobody would buy "simple"
| solutions.
| zaphar wrote:
| Tech companies sell convenience. Most people don't want
| to to do the work required to "solve their own problems
| their own way". They aren't buying simple. They are
| buying: "It's Already Built".
| krallja wrote:
| `Win+X I` brings up a PowerShell window. It's supremely
| integrated - it can do ANYTHING a compiled .NET language
| can do, including calling into unmanaged COM, etc.. And
| it's super simple - you can get started with simple string
| processing and file manipulation in just a few characters.
| It's just not popular in the same way BASIC was.
| 7thaccount wrote:
| Agree with everything you've said about Powershell. It's
| pretty cool.
|
| Buuut...the common Basic computers of the time had
| commands that let you do built-in graphics in a very
| simple manner. Not anything as crazy complex as the .NET
| charting and GUI stuff available to Powershell now. It's
| a real shame there isn't a built-in DSL that could allow
| normal users (i.e. not full time developers) to build
| some really simple games in like half a page of code.
| Someone wrote:
| > the common Basic computers of the time had commands
| that let you do built-in graphics in a very simple
| manner.
|
| I don't remember Commodore Basic for the VIC-20 and
| Commodore 64 doing graphics other than through a series
| of POKEs.
| egypturnash wrote:
| Commodore was _very_ much the exception here. Pretty much
| every other 8-bit computer 's Basic had a bunch of
| commands to do graphics and sounds. But Jack Tramiel just
| slapped in a licensed copy of Microsoft's Basic with the
| least amount of work necessary to make it run.
| Someone wrote:
| I know, but it also was one of the most common of the
| "common Basic computers" of the time.
| Cockbrand wrote:
| The Commodore machines at least had a fairly extensive
| set of graphics symbols to create basic [pun not
| intended] graphics. For sound, though, there indeed
| wasn't really anything in Commodore BASIC V2.
|
| Tangential: Artist Raquel Meyers does really great stuff
| with the CBM graphics character set, see
| https://www.raquelmeyers.com/
| layer8 wrote:
| CMD.EXE is sort-of BASIC-like and you can write simple
| games in it:
|
| https://www.wikihow.com/Make-a-Video-Game-With-Cmd
|
| https://youtube.com/watch?v=tYgUxz6Rd_o
|
| A somewhat better choice is VBScript, which also ships with
| Windows and can be run with cscript/wscript.
|
| What's indeed missing is a built-in IDE. At least MS Office
| comes with a VBA IDE.
| blowski wrote:
| Apple encourages you to use Swift with Playgrounds on macOS
| and iPadOS.
| mavhc wrote:
| BASIC is smarter than Python, don't need :, and it can work
| out the difference between = and == by itself
| SoftTalker wrote:
| One of the advantages of a classic BASIC for a beginner was
| its very small feature set. It was easy even for a kid to get
| it all in his or her head. Python not so much, especially the
| idiomatic stuff. BASIC is very clear: 10
| PRINT "HELLO" 20 GOTO 10
|
| If you understand that the computer will execute lines in
| numerical order, it's very easy to understand that. The
| equivalent in Python of just that simple thing would not be
| so clear.
|
| It's great as an introductory language IMO. I disagree with
| Dijkstra that it will do any permanent damage -- if anything
| it will help the programmer appreciate the advantages of
| structured or object-oriented code when they are ready for
| it.
| tempodox wrote:
| macOS-10.14 (Mojave) has python-2.7 + idle still bundled, but
| macOS-13 (Ventura) not any more. You'll have to install it
| via MacPorts, but at least you'll have a choice which version
| to install.
| Cockbrand wrote:
| My Mac with Sonoma aka macOS 14 has Python in
| /usr/bin/python3, so I assume it's been installed with the
| system. It might have been installed with Xcode, though.
| bigbillheck wrote:
| > Why oh why doesn't Windows and macOS come with Python and
| Idle out of the box?
|
| Because they have something better: a web browser with a
| javascript console.
| gully_boy wrote:
| >>One of the most harmful falsehoods about it is that somehow
| GOTOs and line numbers would turn you into a bad programmer for
| life.
|
| i had nightmares about avoiding GOTOs in my teens...
| phendrenad2 wrote:
| > GOTOs and line numbers would turn you into a bad programmer
| for life
|
| Dijkstra will go down in history as one of the great algorithm
| designers, but this will always be a black mark on his legacy,
| possibly overshading his contributions. There's a lesson here
| about not pontificating outside of your field.
| johannes1234321 wrote:
| In his text he argued for higher level constructs, as they
| are established now. I think there he was right. Unrestricted
| goto often isn't good for complexer programs.
| skocznymroczny wrote:
| My understanding is that when "GOTO consider harmful" came
| out, the typical code flow was to put values into global
| variables, goto to some piece of code then goto back and
| continue. Nowadays we have functions with arguments and you
| should just use that. But harmful goto was about the specific
| type of coding that happened at the time, but people assume
| it's any goto use in general.
| Someone wrote:
| Dijkstra wrote that in 1968. At the time, quite a few
| languages didn't support recursion (ten years later, FORTRAN
| 77 didn't, officially), and lots of hardware didn't have a
| call stack (a word that Dijkstra invented, and described in
| 1960. See https://ics.uci.edu/~jajones/INF102-S18/readings/07
| _dijkstra...), so if they needed one, they'd have to write it
| in code.
|
| Using a language that supported structured programming would
| get rid of such scaffolding code that hid the logic of the
| actual program.
|
| Many languages also allowed code to jump out of and _into_
| loops, and programmers (ab)used that to cram their code into
| the small amounts of memory they had at their disposal. The
| resulting code could be quite hard to understand.
|
| > There's a lesson here about not pontificating outside of
| your field.
|
| How was that outside of his field, which was about thinking
| logically about programming?
| phendrenad2 wrote:
| 'Goto considered harmful' really brings nothing new to the
| table. It just states that gotos are hard to reason about.
| Well yes, that's true. Computer programs are hard to reason
| about as a baseline. Everyone knew that goto was hard to
| reason about before he wrote about it, but for some reason
| his letter became a reference for people who wanted to
| abolish GOTO from their codebases.
|
| > How was that outside of his field, which was about
| thinking logically about programming?
|
| Language design falls under human-machine interfaces, and
| while basically everyone in that era dabbled in that field,
| it wasn't really his forte.
| zaphar wrote:
| Modern Goto's are nothing like what Djikstra was writing
| about. Reading it in the context of the time it was
| written it is a fairly good write up.
| bigbillheck wrote:
| > Dijkstra will go down in history as one of the great
| algorithm designers, but this will always be a black mark on
| his legacy, possibly overshading his contributions. There's a
| lesson here about not pontificating outside of your field
|
| I am begging of you, please do a little bit of investigation
| into the historical context in which Dijkstra wrote that
| memo.
| phendrenad2 wrote:
| Your comment was likely inspired by other replies to my
| comment, but please, don't assume someone who has an
| opinion other than yours simply hasn't done enough research
| to agree with you.
| euroderf wrote:
| > One of the most harmful falsehoods about it is that somehow
| GOTOs and line numbers would turn you into a bad programmer for
| life.
|
| Yup! As soon as I was exposed to a language withOUT line
| numbers and GOTOs, a little light went on, and stayed on.
| zozbot234 wrote:
| GOTO-based programming is just continuation passing style - the
| definition of GOTO is literally switching the continuation of
| the current statement to something else. (Which means that its
| preconditions are OR'd to the preconditions of its target
| statement, and its post-condition is not defined. A GOTO-based
| program becomes easier to analyze and understand if you add
| COME-FROM markings to every possible GOTO target.)
| Incidentally, one can understand self-modifying code in a
| similar way.
| rafavento wrote:
| I find this intriguing. Would you mind to expand?
| queuebert wrote:
| > One of the most harmful falsehoods about it is that somehow
| GOTOs and line numbers would turn you into a bad programmer for
| life.
|
| In fact GOTOs in BASIC were, I think, a big part of lowering
| the barrier to programming for the new and the young. It
| relieves the mental load of structuring the program, allowing
| you to concentrate on the logic and syntax. Not using GOTOs
| requires already having a mental picture of what the program
| should look like before you write it, or at least rewriting it
| multiple times as you go.
|
| As a Rust programmer, I probably spent 5-10% of my time
| restructuring branches to deal with Results and Options more
| elegantly, and it is the least fun part. While not related to
| program flow, it's an example of a Good Thing that makes coding
| less fun.
| jermaustin1 wrote:
| For me BASIC led to VB which led to VB.Net which quickly led
| me to C#.
|
| I did some real fun stuff in BASIC as a kid that I never
| replicated in later languages. In kindergarten or first
| grade, I picked up a book called something like "Make Your
| Own Computer Games" at my local library. Everything was GOTOs
| and LABELS. The librarian didn't want to let me check it out
| because it was beyond my understanding, but my grandma
| insisted. That night and for the following 2 days, on my
| Dad's work computer, I would type and retype these computer
| games into GWBASIC in MSDOS, and then type run at the end.
| There was no way to actually save the .BAS files, so any time
| I wanted to play one of these games, I had to type it. So I
| memorized them before I had to turn the book back in.
|
| I then started to combine games together. Like "Guess the
| Number" and "Hangman" which actually taught me more about
| programming than anything I learned later in life from
| education.
| cookiengineer wrote:
| For me, as a golang programmer, it's almost the same like you
| mentioned. Additional mental overhead in golang is that you
| also need to implement everything in as-flat-dependencies as
| possible due to the compiler not having support to resolve
| single methods or recursive dependencies (and -injections).
|
| Usually I find myself rewriting the codebase at least 3 times
| until I have a modular enough architecture that does not have
| any unresolvable recursive dependencies. Usually it ends up
| in a folder structure with a top level structs, utils,
| actions, cmds, schemas, parsers, protocols etc.
|
| While it also embraces strong knowledge about the
| architecture, it also is a much higher threshold until you
| have a program working. Add to this the always occurring
| defined but not used errors and you can demotivate kids real
| fast, even though the language syntax and grammar could be
| very easy to learn (apart from what pointers, slices and
| reflections or memory allocations and callstacks are).
| dehrmann wrote:
| > GOTOs and line numbers would turn you into a bad programmer
|
| And yet no one said this about programming assembly.
| slim wrote:
| because there's no alternative to assembly, whereas for
| higher order languages there is
| tenebrisalietum wrote:
| line numbers don't exist in assembly?
| yetanotherloss wrote:
| Are memory locations or labels resolved to them, probably
| at compile or startup time, really any different?
|
| The whole GOTO-harmful is a product of a bygone time much
| as anyone needing to keep track of a jump table by hand is
| now.
| gregmac wrote:
| > somehow GOTOs and line numbers would turn you into a bad
| programmer for life
|
| I think the opposite. It's super simple to understand as a
| beginner and is a low barrier to entry. The key is likely
| aligning when to introduce someone to a more structured
| language with when the are hitting the limits of GOTO - like
| just have finished writing an awkward large program that could
| be significantly simpler, spent hours debugging a problem
| caused by lack of scoped variables, or are trying to modify
| something they wrote a few months ago that has dozens of GOTOs.
| These are the things where ideally the light goes on and people
| "get it".
|
| On the last point, I think that is really what makes people
| great. Go back and try to work on code you haven't looked at it
| even thought about in 6+ months. If you've only been coding a
| couple years, you'll gain a ton of insights into what (not) to
| do to write maintainable software, in the same way students
| learn why we don't use GOTO.
| BariumBlue wrote:
| Good point actually - when teaching absolute newbs, I found
| they'd often confuse the point of a while with a for with an
| if block.
|
| GOTO is super unambiguous and probably a better introduction
| to program control flow while they get used to manipulating
| and juggling variables around
| tialaramex wrote:
| I would suggest that Rust's only actual loop, (using the
| keyword loop) is unambiguous while also being structured.
| You can (and during development I sometimes do) just write
| loop until it's apparent what you actually meant and then
| rewrite - also the Clippy linter will point out various
| obvious idioms e.g. for or while let loops if they are
| written as legal but unidiomatic loop constructs. So that
| aids pedagogy. Your loop works, but the linter explains how
| an experienced programmer would express the same loop more
| clearly.
|
| Computed GOTO is often possible in BASICs. In one sense
| that's awesome, this is a very powerful technique, but in
| practice it's so unstructured that you shouldn't ever use
| it so why even offer it?
|
| "That's how the machine works". Yes it is, which is why we
| don't write raw machine code when we can.
| nsxwolf wrote:
| You didn't have to go straight from BASIC to a more
| structured language - you could learn about GOSUB first.
| ezy wrote:
| The funny part, and perhaps the part that really damns the
| critics, is that (IF..GOTO,) GOTOs and line numbers _are_
| useful baseline concepts because they have a direct
| correspondence to what a computer actually does. People who
| went from BASIC to assembly language did not experience much
| cognitive dissonance compared to your average JS programmer.
| And decades later, computers still work roughly this way under
| the covers complete with (tests,) jumps and memory addresses.
| :-)
| pge wrote:
| Definitely not just a language for kids - When I worked for the
| Navy in the early 90s, they were still using software written
| in Rocky Mountain BASIC on all the submarines in the fleet.
| Gibbon1 wrote:
| Rocky Mountain basic had exceptionally nice string handing,
| array handling and could do matrix math.
|
| I think traditional CS hates BASIC because it's hard to get
| people to look at it in terms of pure math. And it enables
| muggles to create useful programs.
| yetanotherloss wrote:
| I look at it more like Excel now. It gives you just enough to
| do simple things easily with tools that make more complicated
| things ... Horrifying.
|
| Seeing deeply nested excel IFs that parsed out individual
| letters of a string for recursive cell logic still gives me
| nightmares.
| DonHopkins wrote:
| Speaking of line numbers, does anyone know why DECSYSTEM 10's
| and DECSYSTEM 20's BASIC had a "LISTREVERSE" command?
|
| Yes, it actually did exactly what it sounds like!
|
| Chalk one up for DEC and BASIC. What other programming
| languages support that feature, huh?
|
| Now all you need is a COMEFROM and COMESUB and RUNREVERSE (or
| NUR) statements, and you can write reversible BASIC programs!
|
| https://en.wikipedia.org/wiki/Reversible_computing
|
| https://en.wikipedia.org/wiki/Counter-Clock_World
|
| https://web.archive.org/web/20210713130832/https://imgur.com...
| DECSYSTEM 20 BASIC User's Guide: LISTREVERSE command
| LISTREVERSE LISTNHREVERSE LISTREVERSE and
| LISTNHREVERSE print the contents of the user's memory
| area in order of descending line numbers. LISTREVERSE
| precedes the output with a heading, LISTNHREVERSE
| eliminates the heading. LISTREVERSE
| EQUIV 10:53 13-NOV-75
| 40 END 35 PRINT "THE EQUIVALENT CURRENT IS",I, "
| AMPERES" 25 I=E1/R 10 INPUT R 5
| INPUT E1 READY
|
| http://bitsavers.org/www.computer.museum.uq.edu.au/pdf/DEC-1...
|
| http://bitsavers.org/www.computer.museum.uq.edu.au/pdf/DEC-2...
| fortran77 wrote:
| I see many Ph.Ds programming in Matlab as if it were BASIC --
| no functions, everything global, etc, and they get a lot of
| stuff done!
| bena wrote:
| It's not a falsehood. It allows for a lot of bad stuff. Like
| the following function Thing1() begin
| do important things if condition goto
| thisIsBad end if do more important things
| end function Thing2() begin do
| different things label: thisIsBad perform
| actions end
|
| And people would do the equivalent of that. You'd run across
| uninitialized variables, variables accessed outside of scope.
| Yes, there are disciplined ways to use GOTOs. And most control
| flow can be implemented with conditionals and jumps, but most
| people are not disciplined.
| llm_nerd wrote:
| GFA Basic on the Atari ST was my true entry into programming, and
| I went through many other languages before I found one that felt
| as modern and productive.
| FabHK wrote:
| Yes. Great language, relatively fast, surprisingly modern (at
| the time - came out in 1986), lots of fun.
|
| https://en.wikipedia.org/wiki/GFA_BASIC
| karmakaze wrote:
| I used both an Atari 8-bit and ST and wasn't aware of GFA Basic
| (or Turbo-Basic XL found on Wiki page). They would have been
| cool to have. _On the ST I was using Megamax C compiler on one
| diskette and programs on another._
| bhauer wrote:
| GFA was fantastic. I used it for various telecommunications
| programs back in the day. The only thing I really wanted as an
| addition was data structures.
| rvba wrote:
| Is there anything as _visual_ as visual basic?
| WillAdams wrote:
| _That_ is a question I want an answer for.
|
| Currently I am using OpenSCAD Graph Editor:
| https://github.com/derkork/openscad-graph-editor to create
| programs:
|
| https://willadams.gitbook.io/design-into-3d/programming#open...
|
| but the fundamental question which remains unanswered is:
|
| >What does an algorithm look like?
| sigzero wrote:
| Xojo is that.
| stephc_int13 wrote:
| Dijkstra was a dick and his take has probably be more damaging
| than BASIC itself.
| drewcoo wrote:
| Of course Dijkstra didn't like BASIC. BASIC was the language that
| shook programming loose from his ivory tower and let common
| people try it. On actual computers. Bought at stores like Sears.
| ukuina wrote:
| Imagine what he would have thought of AI-driven programming.
| firebot wrote:
| I think a good supplemental way to extend on BASIC knowledge is a
| good stack-based language, something forth-like, perhaps.
| vajrabum wrote:
| The article's example of a Fortran program is an anachronism. In
| 1975, what we had was Fortran IV which didn't have any of the
| structuring stuff shown in the example. This example of Fortran
| IV shows where most of BASIC came from although there are
| important features of Fortran that it doesn't show (DO loops,
| multi-character variable names, SUBROUTINES, FUNCTIONS, COMMON
| blocks), but Basic was pretty clearly designed as an interactive,
| student dialect of Fortran. C AREA OF A
| TRIANGLE - HERON'S FORMULA C INPUT - CARD READER UNIT 5,
| INTEGER INPUT, ONE BLANK CARD FOR END-OF-DATA C OUTPUT -
| LINE PRINTER UNIT 6, REAL OUTPUT C INPUT ERROR DISPAY
| ERROR MESSAGE ON OUTPUT 501 FORMAT(3I5) 601
| FORMAT(4H A= ,I5,5H B= ,I5,5H C= ,I5,8H AREA= ,F10.2,
| $13H SQUARE UNITS) 602 FORMAT(10HNORMAL END)
| 603 FORMAT(23HINPUT ERROR, ZERO VALUE) INTEGER
| A,B,C 10 READ(5,501) A,B,C IF(A.EQ.0
| .AND. B.EQ.0 .AND. C.EQ.0) GO TO 50 IF(A.EQ.0 .OR.
| B.EQ.0 .OR. C.EQ.0) GO TO 90 S = (A + B + C) / 2.0
| AREA = SQRT( S * (S - A) * (S - B) * (S - C) )
| WRITE(6,601) A,B,C,AREA GO TO 10 50
| WRITE(6,602) STOP 90 WRITE(6,603)
| STOP END
| AnimalMuppet wrote:
| > Basic was pretty clearly designed as an interactive, student
| dialect of Fortran.
|
| Yeah. I knew Fortran (at a high school level). Then I came
| across the TRS80 Basic manual. I read it in an hour, and I
| thought "this is just like Fortran, except the words are
| different".
| cmrdporcupine wrote:
| Absolutely, and I remember in the 80s through the early 90s it
| being the case that this way of writing Fortran just continued
| for years in e.g. engineering disciplines (my sister was an EE
| student early 90s) while the rest of the world had moved on
| from classic BASIC and line # programming, which made Fortran
| in the real world twice as horrifying.
|
| I see programs written in later dialects of Fortran and they
| look totally fine. But my understanding is that Fortran in the
| "real world" is a far messier affair.
| ofrzeta wrote:
| The question is: what is BASIC? Just to take two examples, Atari
| BASIC and Atari Turbo-BASIC XL. They share some keywords but on
| the other side are totally different languages, for instance
| Turbo BASIC has structured programming constructs like
| procedures.
|
| Part of the problem is that the OS API is kind of restricted to
| basic sounds and graphics drawing primitives. For everything else
| you need PEEK and POKE.
| anonymousiam wrote:
| "Otherwise the examples mention 122 characters per line." I'm
| pretty sure that should be 132 not 122.
| readyplayernull wrote:
| BASIC was easy and I was able to modify some Apple Basic games
| and learn some techniques from their code, but using PEEK and
| POKE was such a mistery!
| cameldrv wrote:
| I learned BASIC at age 7 and then shortly thereafter tried to
| learn C and failed because I couldn't seem to grasp pointers.
| Then I took a detour to x86 assembly language and then pointers
| just became obvious.
|
| The beauty of BASIC is that everything is so concrete. Every line
| has a number, and you just keep going down the page unless you
| hit a GOTO. It's easy to reason about what's going on inside the
| computer. Abstractions make a language powerful, but also harder
| to learn. This is why spreadsheets are still the most popular way
| of programming a computer -- they're concrete and you can see
| exactly what is happening in every cell.
| EvanAnderson wrote:
| I took that BASIC-to-asm-to-C route (albeit 6502) and it
| absolutely made pointers totally make sense. I hear about
| people having struggles with pointers in C and I know that,
| almost certainly, they have no assembler experience.
| velcrovan wrote:
| "The beauty of BASIC is that everything is so concrete. Every
| line has a number, and you just keep going down the page unless
| you hit a GOTO. It's easy to reason about what's going on
| inside the computer. Abstractions make a language powerful, but
| also harder to learn."
|
| I will try to say this without bitterness: a wistful statement
| like this could only come from someone who hasn't had to
| maintain production software of any size written in BASIC,
| which was my situation from 2016-2021. It was incredibly
| fragile and difficult to reason about, *because of* its so-
| called simplicity, global variables and line numbers with
| GOTO/GOSUB in particular.
|
| Abstractions do not always make a language harder to learn. A
| language with the right set of abstractions for the problem
| space is going to be easier than a "simpler" language that is
| insufficient to meet the size or complexity of the actual
| problem. Machine code is the most concrete of all: by your
| standards it ought to be the most beautiful language of all.
|
| The appropriate problem space for BASIC is "an alternative to
| assembler for teaching programming to middle-schoolers" --
| which was how I first encountered it. Using it even for that
| use case is irresponsible in an age where we have Python and
| Pyret.
| cameldrv wrote:
| I certainly wouldn't advocate writing production software in
| BASIC, but I'm not sure Python is better than BASIC as a
| first language.
|
| Suppose you're trying to do maybe the second program someone
| ever writes -- print out the numbers from 1 to 10.
|
| In BASIC it's something like:
|
| 10 LET X=1 20 PRINT X 30 IF X <= 10 GOTO 20
|
| In Python it's:
|
| for x in range(1,11) print(x)
|
| In the BASIC example, you need to understand LET, PRINT, IF,
| and GOTO, and the general concept of a variable.
|
| In the Python example you have to explain:
|
| 1. What a variable is
|
| 2. What a for loop is, how it's repeatedly assigning values
| from a sequence to the variable x and then running the
| indented code
|
| 3. That range(1,11) is a function call (what is a function?)
|
| 4. That this function returns a generator (now we're really
| in the weeds)
|
| 5. That print(x) prints out the variable.
|
| IMO Python 2 was a better teaching language because lists are
| concrete and generators are (much) more abstract.
| robinhouston wrote:
| I don't want to make a big deal of a small oversight, but I
| think it _is_ telling that you omitted to increment X in
| the BASIC version. That's a category of error that's
| impossible to commit in the Python paradigm you're
| comparing it with.
| phkamp wrote:
| One often overlooked aspect of BASIC's and COMAL's success was
| the educational benefit of line numbers.
|
| Several teachers who taught BASIC/COMAL in the 1970ies and
| 1980ies have commented to me, that the line numbers made them
| much easier to teach than for instance PASCAL.
|
| The line numbers enables the teacher to say "Now, look at line
| 240" which is much more precise and concise than "Look at the
| statement in the IF inside the WHILE" etc.
| cmrdporcupine wrote:
| Absolutely. And the line numbers stuff was made it much easier
| to write code on these machines that lacked proper text
| editors, and made it easier to ship a minimal programmable
| machine without including one.
|
| Plus it immediately and intuitively exposes the imperative
| sequential "turing tape" model of the computer to the user. "Do
| these sets of things, in sequence, now go back to this line, or
| forward to this, and do the things there" is far less abstract
| than "execute this function."
| CydeWeys wrote:
| Most (all?) modern IDEs have line numbers for all languages, so
| if you open the code in the right program the educational
| benefit should still be there.
| colanderman wrote:
| Line numbers in an IDE change as soon as you add or delete a
| line. Not the case for BASIC.
| CydeWeys wrote:
| I always renumbered my lines in BASIC to be incrementing
| multiples of ten as I was anal about that ...
|
| But I was thinking more in the context of showing code to a
| class, during which you're usually not updating it, and
| even if you do, you just say the new line number as
| appropriate. It only breaks down if everyone is
| individually editing the same one piece of code.
| LanzVonL wrote:
| BASIC was the thing that allowed non-programmers to easily start
| out. It was the whole reason home computers initially took off -
| they all ran BASIC, source code was mostly compatible across
| systems (as long as you didn't use special features unique to
| your computer) and anybody could learn it in a day. It's never
| been replaced or improved upon. You could argue Python is the
| modern BASIC but it's much more complicated and far slower, bit
| banging the hardware is also not something easily experimented
| with in Python whereas with BASIC it was the next step beyond
| learning the keywords on your machine.
|
| The GOTO guy has done more damage to computing than Microsoft and
| Google combined.
| BeefDinnerPurge wrote:
| Why would I hate the first programming language I learned?
|
| What I hate is the number of tools since created to enable
| endless tech debt and horrible engineering practices so as to
| increase the hiring pool of fungible coding talent.
|
| Who needed nice things anyway when we have 280 characters and
| inspiring influencers?
| BeefDinnerPurge wrote:
| GOTO has its uses here and there, even in C/C++. It's just
| sometimes simpler than enabling exceptions or overthinking the
| indentation to annihilate the readability of code. But it's a
| horrible generic control structure and that's all anyone notices.
| sourcecodeplz wrote:
| BASIC is what got me into programming, so there is that.
| ChuckMcM wrote:
| I found that article to be great. The author does a good job of
| trying to understand what was going on in the 70's with
| programming languages. I have a small issue with their use of
| "Fortran 70" rather than Fortran IV (or Fortran 4 as it was
| called) which was far and away more used, especially in
| university/scientific contexts.
|
| As I've told unbelieving students that I learned to program using
| a Teletype and line numbers were really really useful. Later I
| actually used an "editor" on a DEC Writer and it was even more
| convoluted. (it would print the line you were editing, down arrow
| would move to the next line, up arrow to the previous line, right
| arrow would print out the current line character by character and
| if you typed other characters they would either be inserted or
| replace characters depending on the mode.)
|
| I think a case insensitive python with group delimiters rather
| than using indentation for groups and a line terminator character
| would be a good replacement. The goal is to minimize the number
| of new things you have to learn to get going. Concepts like
| grouping and individual statements seem to "stick" better with
| students when they can easily express that with characters in the
| code. (my experience teaching people to program YMMV of course).
| tanepiper wrote:
| I'm about to start writing some basic on my 2023 ZX Spectrum Next
| https://en.wikipedia.org/wiki/ZX_Spectrum_Next
|
| It was my first language - I don't think it was detrimental as it
| lead to me having my career in tech.
| analog31 wrote:
| I learned programming in BASIC. One nice thing about BASIC is
| that it allowed for a mechanistic model of what the computer was
| doing at each line. Being able to work through a program on paper
| was especially useful when lack of access to a physical computer
| for more than a few minutes a day discouraged trial-and-error
| programming.
|
| I think the idea of learning one bad thing and being ruined for
| life is a misconception about learning.
| bsder wrote:
| People forget that these languages grew up alongside the computer
| they ran on.
|
| BASIC is a product of _limited memory_. It can run, as an
| interpreter, in a machine with 4K of RAM and _nothing else_. No
| ROM--No tape--No disk.
|
| Try that in _any_ other language. The only ones that can even
| attempt that are Scheme and Forth.
|
| Dijkstra can slag BASIC all he wants; he had access to computers
| with megabytes of storage. We plebians, on the other hand, were
| quite lucky if we had 4K of RAM.
| teddyh wrote:
| Any BASIC which lacks user-defined named subroutines (i.e. real
| functions, not DEF FN) is a terrible language (compared to
| available alternatives), especially for beginners:
|
| <https://news.ycombinator.com/item?id=35220605>
|
| I wrote BASIC code in the 1980s; both games and utility software.
| It is _precisely because_ I did those things that I object to any
| BASIC lacking functions. The BASIC I used lacked functions, and I
| remember it being _very difficult_ to do what I can now call
| abstractions and subroutines. This would have been vastly more
| easy if the BASIC I used had had user-defined proper functions.
| jantypas2 wrote:
| BASIC itself can't be defined -- which basic? Altair 4K, Apple
| ][+, Microsoft QuickBasic? Some BASICs are quite advanced, others
| not so much. Honestly, later versions of QuickBasic were worlds
| ahead of what I did on the Apple.
| todd8 wrote:
| BASIC was almost my first programming language. Ten years before
| anybody had a home computer (1967), I decided that I would write
| a program. I was just a kid and I came across a keypunch machine
| in a small room at my high school. After reading a book on
| FORTRAN I keypunched a program that was supposed to solve
| optimization problems over sets of linear equations in a number
| of unknowns constrained by a set of inequalities. The algorithm
| for doing this is known as the Simplex Method.
|
| I gave the deck of cards to a friend and a couple of days later I
| got the fan-fold paper output that listed a bunch of syntax
| errors and nothing else. I just didn't understand programming
| very well.
|
| BASIC is what got me on track. I found a book in my local public
| library on the relatively new language BASIC. It was easy to
| understand and I practiced writing out the solutions to simple
| problems with paper and pencil. I didn't have access to a BASIC
| system, but I learned enough that I could try FORTRAN again (this
| time on simpler problems). After a few attempts (with the two day
| turnaround) I was successful and programming became a hobby that
| eventually led to a career as a real computer scientist.
|
| BASIC was just right. It was concrete enough for a novice to
| understand while being much more expressive than assembly
| language. I've never actually run any program that I wrote in
| BASIC, but I have written programs in scores of languages since
| and BASIC got me started.
|
| Today, there are better choices for a first language: Python
| provides students with a lot of power right away, and my daughter
| learned Scheme as her first language and never had difficulties
| in later classes with recursion or functions as values.
___________________________________________________________________
(page generated 2023-12-23 23:01 UTC)