News for hackers. Stuff that matters.
Re:A repository of “BASIC Computer Games” code in modern lan... by martincmartin on Monday July 31, 2023 @04:43PM (#36948512)
"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration." -- Edsger W. Dijkstra

As someone who got their start with BASIC -- mainly from "BASIC Computer Games" no less -- I was always kind of offended at that quote.

Re:A repository of “BASIC Computer Games” code in modern lan... by humanistbot on Monday July 31, 2023 @05:38PM (#36949232)
As someone whose first language was BASIC, which led me down a path that eventually culminated in a CS Ph.D, I have also not been a fan of that quote.

Remember that Dijkstra looked down on anyone who wrote using word processors, because he thought any academic should be able to work out their argument in their head and just write it down. Eventually he came to even reject the mechanical typewriter.

Re:A repository of “BASIC Computer Games” code in modern lan... by ianbicking on Monday July 31, 2023 @05:29PM (#36949124)
It's a very Sapir-Whorf sentiment, that somehow we are infected by what we learn, unable to imagine outside of those formative experiences. And like Sapir-Whorf, also false!
Re:A repository of “BASIC Computer Games” code in modern lan... by contingencies on Monday July 31, 2023 @06:04PM (#36949506)
Sapir-Whorf in the conventionally conceived sense of language-as-local-limitation is clearly false, partly as it invalidates itself as an origin story. (How would you invent a language if you can't think outside of it?)

Sapir-Whorf in the sense of language-as-influence however is clearly true, even if academics occasionally state otherwise, because at their core all languages used by communities of a size greater than one individual rely upon semantics that are socially dictated.

Personally, perl screwed me up a lot more than BASIC - but who can argue with the expressive power of regex for text extraction and matching problems?

Wikipedia has a fun excerpt featuring PG (and Ruby) on just this question https://en.wikipedia.org/wiki/Linguistic_relativity#Programm...

Re:A repository of “BASIC Computer Games” code in modern lan... by bitwize on Monday July 31, 2023 @06:51PM (#36949937)
I have noticed, however, that the more experience one has with C, the more flummoxed they are by Rust. It's why I tell C old hands who grouse about Rust: Rust isn't for you, it's for your replacement.
Re:A repository of “BASIC Computer Games” code in modern lan... by tialaramex on Monday July 31, 2023 @07:20PM (#36950226)
Do you think so? I would consider myself an Expert C programmer. I haven't written a C compiler but I can see how I would go about it, I know a lot of the weird arcana, and I followed WG14 enough to be heartened but not astonished when C23 got #embed while C++ still can't unstick their version of this work (and thus in practice if you're a C++ programmer you should hope your vendor's C++ compiler just offers the C feature anyway)

But I fell very much for Rust in about 2021, and now definitely wouldn't write any more C. Rust has coherent answers to a lot of questions that, to my mind, should be in any C programmer's head.

Now, maybe it helps my CS course's first language was SML/NJ and of course Rust is basically an ML in a trench coat pretending to be a semi-colon language like C. But that CS course was at least half a decade after I began writing C, which was in turn after many years of BASIC (and somewhere in there a little bit of Z80 assembler, but man assembler sucks when the CPU is as limited as the Z80 was, you young people who have a fucking floating point multiply instruction don't know what you've got etc...)

To me, the veteran C programmer, Rust's implementation makes lots of sense, while at the same time it's type system appeals to the more principled Computer Scientist I was taught to be, and its tooling to the Engineer I became as an employee.

Two examples: Wrapping<i32> is exactly how a 32-bit signed integer actually works in any vaguely modern computer. The machine can do this, and so unsurprisingly on a real computer this is nice and fast, despite also being completely safe. But, Wrapping<i32> is a nice elegant type, Wrapping is a polymorphic type, which grants to integers the property of wrapping (modulo) arithmetic for their normal operations, and so i32 is just a type parameter. Beautiful, and yet also fundamentally exactly how the machine works so it's fast.

Second, Option<&T> is exactly the same implementation as a C-style pointer. But it has the same ergonomics as rich Maybe types from a language like ML. So you use it in an inherently safe way, with the compiler catching many common mistakes you could make because they don't make coherent sense in the type system - but at runtime it's exactly the same performance as the nasty C code you'd have written where those mistakes wouldn't be caught.

Re:A repository of “BASIC Computer Games” code in modern lan... by qiqitori on Monday July 31, 2023 @08:40PM (#36950880)
TIL about #embed. Awesomeness! And in hindsight, why didn't we get this earlier? :D
Re:A repository of “BASIC Computer Games” code in modern lan... by tialaramex on Monday July 31, 2023 @11:33PM (#36951975)
If you haven't read it already, https://thephd.dev/finally-embed-in-c23 explains

Rust had include_bytes! from Rust 1.0, include_bytes! is philosophically the same thing, given a filename, it gives you an immutable reference which lives as long as your program, to an array of bytes from the file -- &'static [u8; N]

Re:A repository of “BASIC Computer Games” code in modern lan... by steveklabnik on Monday July 31, 2023 @07:07PM (#36950095)
A fun story to chain on here: I actually started out learning BASIC, and ended up working on Rust. So it must not brain damage everybody :)

(Even though the BASIC I learned GW-BASIC, I think Djikstra was complaining about an even earlier BASIC with even less structured control flow.)

Re:A repository of “BASIC Computer Games” code in modern lan... by glimshe on Monday July 31, 2023 @05:54PM (#36949407)
Dijkstra's maxim is both harmful and clueless. Many of the greatest programmers in the world started with BASIC. When I "graduated" from BASIC to Pascal, I very quickly dropped the BASIC approach to program flow, as any software engineer worth their salt would do. Dijkstra infantilizes programmers, as if it wasn't obvious that BASIC's approach is cumbersome and people just keep programming C++ as if it was BASIC...

Once you go to a "proper" programming language, there is nothing to "unlearn". The new approach is so obviously better! At the same time, having an interpreter up within 2 seconds of turning the computer one was AMAZING and got a lot of people interested in programming.

Much of the software world you see today was built by people who started with BASIC!

Re:A repository of “BASIC Computer Games” code in modern lan... by briHass on Monday July 31, 2023 @07:07PM (#36950099)
Same, and I always hated that quote also. If anything, BASIC exposes you to low level assembly concepts: instructions are processed in order based on their 'address' (line number), unless you have a conditional, where you jump (goto) a new address. Variables are global by default, as they would be as data at an address in memory.
Re:A repository of “BASIC Computer Games” code in modern lan... by anta40 on Monday July 31, 2023 @10:36PM (#36951674)
Ah good old line numbers for code execution.

https://softwareengineering.stackexchange.com/questions/3097...

I miss that... :)

Re:A repository of “BASIC Computer Games” code in modern lan... by klagermkii on Monday July 31, 2023 @07:31PM (#36950322)
I suspect that BASIC may have got a bad reputation in the same way as PHP or JavaScript did, where the accessibility of the language and infrastructure around it allows people who just want to achieve a specific goal to easily participate.

That influx of people with the attitude of "I don't care how computers work, I just want to know enough to solve my problem" shifts the stereotypes around those language users and may erroneously put the fault of it onto the language itself. It certainly feels that way during hiring, where it seems like developers of vastly differing skill or aptitude tend to cluster heavily around certain "friendly" languages.

Re:A repository of “BASIC Computer Games” code in modern lan... by bitwize on Monday July 31, 2023 @07:34PM (#36950355)
BASIC is explicitly a beginner's language. It may not be the best design for advanced programming, but as an instructional tool for someone who doesn't even know what a program is, it's almost second to none. The lessons it teaches are profound: that programs are ordered sequences of instructions that computers can follow, that control flow can involve branching, loops, and conditionals and what those are, and the rudiments of breaking out a program into subroutines. This is a real mindblow for people who've never actually programmed before -- it means they can make the machine do what they want, even very sophisticated (from their perspective) things. It's only when you've seen better -- Algol, Pascal, Lisp -- that BASIC seems miserably wrong in comparison.

As for Dijkstra -- arrogance in computer science is measured in nanodijkstras.

Re:A repository of “BASIC Computer Games” code in modern lan... by Jtsummers on Monday July 31, 2023 @08:00PM (#36950580)
Worth reading Alan Kay's take on that quote:

https://news.ycombinator.com/item?id=11796926

Re:A repository of “BASIC Computer Games” code in modern lan... by bitwize on Monday July 31, 2023 @08:32PM (#36950813)
I have a lot of respect for Dijkstra myself, and quoted Kay with tongue firmly planted in cheek.
Re:A repository of “BASIC Computer Games” code in modern lan... by Jtsummers on Monday July 31, 2023 @08:35PM (#36950843)
Fair, but reading some of the other commenters here they have no respect for him and likely a great ignorance of his contributions to the field.
Re:A repository of “BASIC Computer Games” code in modern lan... by kazinator on Monday July 31, 2023 @08:45PM (#36950912)
> it's almost second to none

Are you saying None is better for beginners?

https://nonelang.readthedocs.io/en/latest/

Re:A repository of “BASIC Computer Games” code in modern lan... by getpokedagain on Monday July 31, 2023 @08:21PM (#36950738)
People should ease up on "how" people learned. You learning basic would not frighten me.

The fact that the first coding I did was mIRC scripting however should terrify everyone hahaha

Re:A repository of “BASIC Computer Games” code in modern lan... by drcode on Monday July 31, 2023 @08:53PM (#36950976)
you should be fine.

well, as long as we aren't working on embedded code for pacemakers

in that case, we'll just skip to the first person in the stack of resumes who didn't start with basic

Re:A repository of “BASIC Computer Games” code in modern lan... by analog31 on Monday July 31, 2023 @11:47PM (#36952050)
I wear it as a badge of honor. I want to reprogram "show line numbers" in my code editor to number lines by 10s.
Re:A repository of “BASIC Computer Games” code in modern lan... by byndlimitsfy on Tuesday August 01, 2023 @09:01AM (#36955397)
This is an interesting take, I'm curious to know how you do this
Re:A repository of “BASIC Computer Games” code in modern lan... by ivolimmen on Tuesday August 01, 2023 @02:34AM (#36953025)
Me too! I even maintained an application written in Visual Basic in my spare time while working with Java professionally. I can honestly say I have 20 years of experience in BASIC :D
Re:A repository of “BASIC Computer Games” code in modern lan... by grumpyprole on Tuesday August 01, 2023 @02:35AM (#36953035)
BASIC didn't really raise the abstraction level away from imperative statements and loops. It didn't help us to write programs that were provably correct. I think that is what Dijkstra was getting at. And he was right. BASIC influenced a generation, my generation. The generation that gave us the next BASIC: Python. A language with litte coherence, that mixes imperative commands with the lambda calculus and has no static types. A language that makes easy tasks easier, but hard tasks harder.