NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
Building my own Vi text editor in BASIC (leetusman.com)
userbinator 4 hours ago [-]
One who has a true mastery of programming should be able to write any program in any language, or at least see how to do so, because one thinks in terms more abstract than language-specific constructs yet is able to map them to any language.

Relatedly, here's TLS 1.3 in VB6: https://news.ycombinator.com/item?id=35882985

utopiah 4 hours ago [-]
What's interesting about it precisely that despite the equivalence (Turing machines and all that) the difficulty to do one thing is a language versus another is what make it prohibitively hard.

If one is "just" translating something that is idiomatic to a language to something that is not in another, it might take 100x for lines for codes in a way that is terribly hard to understand.

consp 46 minutes ago [-]
I've had the unfortunate exercise of copying an API from pure android java to typescript because "they are similar". It goes against best practices and creates all kinds of weirdness resulting in a finished product which is almost the same but far enough away you could just as well have designed a better API in a few hours from scratch (the real complexity is in the backend of the code, not the interface fortunately). But requirements must be met.
mcabert321 2 hours ago [-]
[dead]
markfsharp 5 hours ago [-]
Not very pro or anti BASIC but very pro your rationale, and love that you do what you do because it is fun and stimulating. I love reinventing wheels also, and, in fact, believe it is under appreciated just how useful it actually is. I'd encourage people to reinvent things for their own benefit, maybe you might end up building a better version of something, but more importantly you will possibly encourage, energise or inspire another to explore and learn.
rmunn 10 hours ago [-]
In BASIC? Why? Why would you do that to yourself?

Don't get me wrong, if he enjoys writing code in BASIC, I'm not going to tell him to stop having fun. It would be silly to tell some random stranger "You're having fun wrong!" (Even if I totally think he's having fun wrong. Grin). If he's having fun with it, go for it.

But man, I looked at the code and got flashbacks. The bad kind. BASIC was the first language I learned when I was a kid, and it's what taught me programming (because after typing "LOAD WIZARD.BAS", I could type "LIST" instead of typing "RUN" and I could actually see what the program was doing. So I learned by reading other people's code. And The Wizard's Castle was pretty good for a BASIC program: it had subroutines, a multi-dimensional map stored in a single-dimensional array (and an actual function defined to convert X,Y,Z coordinates to an index in the array!), and so on. So I am grateful to BASIC for teaching me programming.

And I never, never, NEVER want to write another line of BASIC code again in my life.

But if he enjoys doing so, good for him. I'll just sit here muttering under my breath "But he's still having fun wrong"... :-)

joblessjunkie 8 hours ago [-]
Laughing agreement. I’m very sentimental for BASIC.

By the standard of getting kids started it’s an amazing and wildly successful language.

By any other standard, it is absolutely terrible! It commits every famous programming sin! Stay away! Do not learn from this language! LOL

keyle 5 hours ago [-]

    10 PRINT "THIS IS FINE"
    20 GOTO 10
icedchai 9 hours ago [-]
I haven't written BASIC since I was a teenager! The more "modern" basics, without line numbers, were a definite improvement. I went from AppleSoft to AmigaBasic and QuickBasic.
1313ed01 1 hours ago [-]
I only use BASIC with line numbers, mostly GW-BASIC and pcbasic. Without numbers it just feels like Lua or python or any other scripting language, but worse? The line numbers BASICs come with their own almost-REPL (IDE?) that I find quite nice (or at least fun) to work in. Maybe mostly nostalgia, but it is the only reason for me to use BASIC at all. I have some basic-mode installed to edit BASIC code in emacs, but I only rarely edit the code outside of its natural built-in line-editor.
rmunn 9 hours ago [-]
> The more "modern" basics, without line numbers, were a definite improvement.

Never used them, and yet I can unquestioningly agree. The way you had to number each line in increments of 10 so that you could insert a line 15 later in between lines 10 and 20 was, looking back at it, insane.

I can understand why they did it. In the era of no full-screen text editors, where you just typed each line one at a time into a REPL (not that I knew the term REPL at the time), and it stored the lines in the order of their lines numbers... well, that was the only way to edit your code. Made a mistake on line 20? Type a brand-new line 20 and it will replace the old line 20. Want to insert a line between lines 10 and 20? Type in line 15 and it will go and insert. So you could actually load your program, edit your code at the REPL, and save it.

But man, using an actual visual editor is so, so, SO much better than that system. I'm glad it's on the dust heap of programming history where it belongs. It was a decent option for the time when computers had 4K of RAM, but once it was actually possible to edit code in a full-screen editor, line numbers were no longer useful.

smackeyacky 7 hours ago [-]
A lot of 8 bit basics had a RENUM which would even out the line numbers and repoint all the GOTO statements.
jaredsohn 8 hours ago [-]
The line numbers were also used for GOTO and GOSUB (although later on languages supported strings instead of numbers).
rmunn 8 hours ago [-]
Yeah, forgot to mention that, but that's entirely correct. Modern BASIC variants (I assume) let you label lines so that GOTO and GOSUB can still be used. But with a few flow-control constructs (I don't know modern Basic but in the linked repo I saw a couple `while ... wend` blocks) the need for GOTO is much reduced, I'm sure. GOSUB, well, again I haven't checked. But if GOSUB is allowed to point to a string label rather than a line number then it just becomes a function call, and is still a useful construct. (GOTO only has utility in being able to do the equivalent of `break` or `continue` inside a loop).
dvhh 6 hours ago [-]
I heard Basic is pretty good as far as embedded script interpreter
jibal 7 hours ago [-]
"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 Dijkstra
pasquinelli 7 hours ago [-]
even smart people say dumb things sometimes.
voidUpdate 3 hours ago [-]
like "goto considered harmful" when all assembly language depends on it
mcabert321 2 hours ago [-]
[dead]
fitsumbelay 9 hours ago [-]
awesome project and cv.

speaking of which, I was pleased to see FORTH in there. not that I've ever used it but I was introduced to it in the early 90s and it's cool to see that it's still useful

really enjoying your site content

k3vinw 2 hours ago [-]
Never occurred to me how much ms dos batch syntax must have been inspired by basic when I saw the comments (aka remarks) start with “rem”
anthk 26 minutes ago [-]
Great Basic interpreter: https://www.moria.de/~michael/bas/ (it will almost all of the 101 Basic Computer Games if formatted).

On another non-compatible but really small Basic, check NMH BASIC 3:

https://www.t3x.org/nmhbasic/index.html

Compile it under Unix (or windows with w64devkit):

       cc -o tcvm tcvm.c
       
Run primes.bas:

       tcvm basic primes.bas
       NMH BASIC III - 7599 BYTES FREE
       #3 = primes.bas
       OK
       load #3
Also, as it's T3X0 code, you might be able to port and run under DOS and CP/M. Yes, you read it right. By default I didn't compile it to Unix native 32/64 bit with T3X/0 because it NMH Basic requires a 16 bit machine/interpreter. But if it's cross-compiled to a 16 bit DOS or CP/M, it will run native.

Show up what you can do. Port scoundrel, for instance:

https://codeberg.org/luxferre/scoundrel-ports

I already doing that to JimTCL and it's a piece of cake.

JSR_FDED 9 hours ago [-]
It’s a great learning project, and there’s nothing like building your own tools.
bitwize 2 hours ago [-]
This takes me back. When I was about 12 years old I used Tandy BASIC to build a rudimentary programming editor that had a Multiplan-like interface. It's all part of the fun and challenge of programming: how can you construct something interesting or useful under these constraints?
ubermonkey 7 hours ago [-]
SEEK HELP.
ivolimmen 4 hours ago [-]
HELP is not a correct argument to SEEK. You must not have a lot of BASIC experience.
bitwize 2 hours ago [-]

    ?Illegal function call
    Ok
fortran77 8 hours ago [-]
There's a little BASIC resurgance now. I've been having fun with this https://github.com/ReuvenSwirsky/erlbasic "Erlang BASIC" which implements a mini-computer style time sharing BASIC system in Erlang. There's a beta of it online now, running a more advanced version than the branch on GitHub I’ve been using.

I'll see if I can port this "Vi" to this flavor of BASIC.

user3939382 8 hours ago [-]
Me and the Apple IIc on my desk are ready for it
globalnode 10 hours ago [-]
cant tell if vibecoded or not, function comments seem slightly redundant, either way its a cool idea, cant wait to see the language server written in basic also :D
keithnz 10 hours ago [-]
I vibe coded my own SQL query tui client mostly for myself, when I wanted vim editing mode, I just asked for it, and it just worked for a huge amount of common vim editing motions/actions. I did have to prompt it to add a few more when things when I noticed they were missing. Sort of makes this kind of stuff trivial. However, coding it yourself is a great mental exercise
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 10:10:57 GMT+0000 (Coordinated Universal Time) with Vercel.