Live data from Hacker News

Building my own Vi text editor in BASIC

leetusman.com

41–50 of 53 posts

Re: Building my own Vi text editor in BASIC

#41
post #5

Earlier quoted context omitted.

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.

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…

There were some advantages. The more advanced BASICs gave you functions / subroutines so you didn't have to mess around with using global variables to pass arguments to a "gosub".

Re: Building my own Vi text editor in BASIC

#42

Earlier quoted context omitted.

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

Classic Basic (line numbers, GOTO) resembles 1960s/1970s FORTRAN before it adopted structured programming. The idea when BASIC was invented in Dartmouth in the 1960s that it would be a good introduction to programming for students who might have to learn FORTRAN. The thing is, when BASIC was at its most popular (1980s home computers) FORTRAN itself had moved on from "spaghetti code".

Beginners' All-Purpose Symbolic Instruction Code, if I remember correctly.

I also started programming in BASIC, and moved on to Pascal when I discovered Turbo Pascal around 1983, which also happened to be the language most of my CS classes used a year later when I switched majors from foundering in EE to excelling in CS.

I still have a bunch of my BASIC programs from the day.

Re: Building my own Vi text editor in BASIC

#43
post #31
post #23

Earlier quoted context omitted.

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.

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)…

Funnily the conclusion is precisely why the whole idea of "just" giving specs and let do the work is risky. If nobody challenges requirements from a manager or client who "just to get it done" you end up with actual work done... that is totally inefficient, potentially dangerous or just irrelevant.

PS: the used here could be the next HN thread I opened, https://news.ycombinator.com/item?id=48047826

Re: Building my own Vi text editor in BASIC

#44
post #33

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

But you still need to know the language specific constructs. I can't magically speak German because I know a load of abstract language theory. And this can work the opposite way. If I know small talk, and then read that C++ can do OO code, I could then think about writing X in C++ and OO being the best model. But I then hit problems when the limitations of OO in C++ become apparent. In my experience, programming in a…

That's true, but the point the GP was getting at is, if you want to make a program that does xyz, you can do that in any complete language provided you have the mathematical reasoning to figure out how to make it happen. Whether you do that in an object-oriented manner because the language you're using makes that easy, or with some other paradigm.

Programming in a language is finding what works in that language, you're right, but programming at all is trying to get what's in your head into the computer.

Re: Building my own Vi text editor in BASIC

#45
post #33

Earlier quoted context omitted.

But you still need to know the language specific constructs. I can't magically speak German because I know a load of abstract language theory. And this can work the opposite way. If I know small talk, and then read that C++ can do OO code, I could then think about writing X in C++ and OO being the best model. But I then hit problems when the limitations of OO in C++ become apparent. In my experience, programming in a…

That's true, but the point the GP was getting at is, if you want to make a program that does xyz, you can do that in any complete language provided you have the mathematical reasoning to figure out how to make it happen. Whether you do that in an object-oriented manner because the language you're using makes that easy, or with some other paradigm. Programming in a language is finding what works in that language, you'…

I suppose it depends how we define 'true mastery'

Yes you have to understand the problem and state the solution, and that is a prerequisite to 'mastery' but I don't think that's everything that's required.

And this is just talking about the algorithm level. Is Ed equivalent to Emacs? They both do the same thing. Is a complicated solution that demonstrates your mastery better than a simple solution?

Re: Building my own Vi text editor in BASIC

#46

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

Just because you can doesn't mean you should.

Re: Building my own Vi text editor in BASIC

#47
post #4

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 le…

> Why?

https://justforfunnoreally.dev/

Re: Building my own Vi text editor in BASIC

#48
post #5
post #4

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 le…

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.

Yeah, AmigaBasic especially was when I felt that all the rough edges were sanded off, and it felt like a real language.

Using AmigaBasic or other polished Basics doesn't seem very different than using something like Python.

Re: Building my own Vi text editor in BASIC

#50
post #48
post #5

Earlier quoted context omitted.

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.

Yeah, AmigaBasic especially was when I felt that all the rough edges were sanded off, and it felt like a real language. Using AmigaBasic or other polished Basics doesn't seem very different than using something like Python.

Too bad Amiga Basic stopped being supported after Workbench 1.3! Supposedly it was Microsoft's only Amiga product.
Post reply on HN