Question

It seems like this is the right place to ask this question.
What is the best and effective programming language that can make computer programs and will still be useful in like 20 years?

Asking because I want to make some programs and do something better with my life.

Attached: you can't.jpg (715x694, 57.75K)

Other urls found in this thread:

learncodethehardway.org/c/
gigamonkeys.com/book/
stevelosh.com/blog/2018/08/a-road-to-common-lisp/
sicpebook.wordpress.com/ebook/
twitter.com/SFWRedditGifs

just about anyth--
C or Common Lisp.

Are these languages complicated and difficult to learn?

yes, but in different ways. With C, the difficulty is with doing it correctly and with correcting your mistakes, but you'll learn the language very quickly. With CL, the difficulty is the size of the language--there's just a lot to learn, but what you learn doesn't have edges as sharp as C's.
Neither is that hard though. Just get few good tutorials, get on IRC, and slog through the learning curve. We're not talking FP, Prolog, or dependent typing.

C, and probably C++. When using C make sure you use C99 with its properly define integer sizes like uint16_t for fixed-size integers, rather than assuming that a short will always be 16 bits large or something like that.

C has its flaws, lots of them, but it is well understood, time-tested, it can run on your toaster and every language can use C libraries. It's the universal high-level language for better or for worse and it's what we are stuck with.


C and Common Lisp have very opposite ideas of how a program should be written. C is fairly small and close to the machine, you could read through K&R in about a week if you already know the basic ideas of programming. Mastering C on the other hand takes practice, it is a language that allows you to do stupid things and will follow your orders. Also beware of undefined behavior, just because something works for you that doesn't mean it must work for others.

Common Lisp is a huge language with an ancient legacy. To understand why it is the way it is you have to image a whole bunch of mutually incompatible Lisp languages. Then try to make a Lisp that has features from each one of them, some features of its own, and it tries to make porting from all those Lisps to Common Lisp easy. You get one of the ugliest and most powerful languages ever.

It takes longer to learn due to its size, but once you get a grip on it you will have a massive powertool which lets you make your own powertools on top of power tools. The syntax is weird, it uses prefix notation, but once you get it any other notation will seem backwards to you.

So in summary your saying that these two languages have got their pros and cons. But to me it sounds like that C is the most effective at the moment. But it has some flaws sometimes. And this Common Lisp sound like an interesting language but difficult to learn and remember and porting problems. But at the end of the day they both are effective.

And if I want to learn these languages, then with what material should I start reading? And what kind of hardware is required to write in this language?

They're both useful and they're both fairly static. Code you write today will be just as readable 20 years from now. If you use libraries (yes even with C, I have an inherited C project with two cobweb-covered dependencies) those libraries might evolve into compatibility with your code. C++ can improve on C with some restraint, but with C++ some code you write today might be the Bad Old Thing a year or two from now, and then by 20 years from now people not even remember that the code you wrote today even works.
Since CL's a bigger language you can do things with it that you might reach for a library to do, in C. It's not necessarily any harder to port. It at least has much nicer support for porting it across systems.

start filling a directory with programs. 1.c, 2.c, 3.c. Compile something that works, run it, move on. The best programming book can't replace you doing stuff. The worst programming book can't prevent you from doing stuff.
I say that because I can't recommend any C or CL book that strongly, but try
learncodethehardway.org/c/
gigamonkeys.com/book/

Do these languages work on all OS or just a few (like Windows, Linux etc.)?

Like C and C++ on Windows?

Yes, they're widely useful. If you have a very specific goal ("I want to write JRPGs about female monsters that rape the male protagonist if he loses batles against them"), you may get a specific answer ("buy RPGMaker MV and learn JavaScript to write plugins for it"). But even there, it'll only benefit you to spend some time learning to program at all with a "good enough for 20 years" language.

Check the catalog before posting

You're being memed, at least as far as Lisp goes. While C is resilient because it's so straightforward and no-nonsense, it's not perfect and will probably be replaced b something else in 20 years. That's a very long time as far as technology goes.

I don't quite know myself what I should learn but this Lisp language sounds interesting.

But what language could be the next C or C++?

a good first language is "any language, idiot". He wanted a language to last 20 years, that cuts a lot of languages out.

Zig might do that, but if you master Zig today you're going to have to update your mastery in a month when it replaces varags with tuples. You're going to have to keep re-learning Zig for a while. "I want to learn the language that will be a very good language to know 20 years from now" is a different question.

Want my advice? Pick one and start churning out shitty useless programs that you thought of for fun, a program that takes the hex values of anything and converts them into pixels in an image for example, every language will be tough at first but unless you hack together programs that work but have way too many lines of code you will never learn to program properly.

The C Programming Language by Kernigham & Ritchie, it's old, but well written and you can later catch up on what new standards added. Make sure you read the 2nd edition, the first edition is older than the standard.

For Common Lisp Common LISP: A Gentle Introduction to Symbolic Computation by Touretzky is a good introduction. But it's just an introduction, it will not teach you the deep ends of Common Lisp. Here is also a good overview of Common Lisp to whet your appetite:
stevelosh.com/blog/2018/08/a-road-to-common-lisp/

I generally recommend staying away from online tutorials. With those you get what you pay for, which is usually nothing. They don't have to be bad, but more often than not they are. Especially the Learn Code The Hard Way by Zed Shaw.

Another really good book worth mentioning is SICP. It's an entry-level book about computer science, it's a very long read, and it uses Scheme as its language (a different type of Lisp). It goes more into the intricacies of designing a program rather than the act of programming itself, so maybe it's not necessarily what you want to read as your first book, but definitely read it at some later point. There is a version with better typesetting than the original online:
sicpebook.wordpress.com/ebook/

If your computer can handle posting on this site, then it can handle the above languages. You will need a compiler for C (GCC and Clang are two Free ones, so pick whichever) and for Common Lisp you will need an implementation (SBCL is a good one which can produce production-grade code). Keep in mind that those languages used to be run on machines so old, that our computers would be considered Science Fiction back then.


A language does not run anywhere, but I get what you mean. It depends on your compiler. For both C and Common Lisp there is a compiler for pretty much any platform out there. You can grab the source code for Doom on MS-DOS and if you know C you can study it.


Lisp is really cool, but its community is small. There are just the more dedicated for it, so it can be both a good and a bad thing. Just don't be surprised if people have no idea what you are talking about when you mention Lisp.

Thank You for this amazing thread Zig Forums. At least I'll know what do do know.

C weenies are trying to deflect by mentioning both C and Common Lisp, but what really sucks about C is that it restricts the hardware you are allowed to use. Tagged memory, useful hardware exception handling, hardware strings and arrays, and many other technologies that have been around for decades have huge advantages over the hardware you are using today, but C does not benefit from them.

Some reasons C sucks are pointer arithmetic, which prevents tagged memory and garbage collection, null-terminated strings, which slow every string down to 1 byte at a time, lack of error handling, which prevents useful hardware exception handling, and a brain-dead linker and "function pointers" which prevent any hardware attempts to speed up nested scopes, generics, or OOP.

C compilers need millions of lines of code to be efficient, so a C compiler on any kind of hardware would need just as much work as C on a shitty RISC like RISC-V. Other languages like Lisp, Ada, PL/I, Fortran, Basic, and so on would have serious improvements in both quality of implementation and compiler complexity by running on a tagged architecture, but C can't because anything not part of the PDP-11 is not useful to C. Even after all that code, C itself still sucks. Writing useful software (not FizzBuzz and K&R "exercises") in C is like trying to build a skyscraper out of toothpicks held together with shit. They need 15,600 "unskilled" "programmers" just to do a kernel, which sucks. OS/360 written entirely in assembly and including compilers for 5 languages (Fortran, Cobol, Algol, PL/I, and RPG) took less time and fewer people and that included creating the PL/I language and 360 hardware architecture. Multics was made with a much smaller group and that included inventing the hierarchical file system and rings and adding segmented memory to the GE hardware. Linux is mostly a clone of UNIX, an OS that already existed for 20 years, and despite all that and decades of better operating systems, Linux can't do system calls right and has an OOM killer and all that other bullshit and none of those are considered problems.


That's defeatism. You're confusing C not being compatible with other languages with being stuck with C. C would need an FFI on Lisp machines too because of the brain-dead data structures like null-terminated strings, but you wouldn't be stuck with C. We'll only be "stuck with" it if the world IQ becomes too low for anyone to ever be able to create something better again (>>988677). That might be what UNIX weenies want.

There is no difference between "the fundamental design flawsof Unix" and "the more incidental implementation bugs."If you had to write umpteen versions of of a pathname parserbecause the system didn't do it for you, I bet you wouldmake a number of "incidental implementation bugs." And itwouldn't be your fault. It just not reasonable to expectthat every programmer that comes along has thewhere-with-all to deal with aborted system calls, memoryallocation, a language that allows (make that "proudlyfeatures!") both "==" and "=" in conditional tests, etc.The fault lies with the original designers.I've been waiting for an appropriate time to use this quote.This is as good a time as ever. Programs are written to be executed by computers rather than read by humans. This complicates program comprehension, which plays a major role in software maintenance. Literate programming is an approach to improve program understanding by regarding programs as works of literature. The authors present a tool that supports literate programming in C++, based on a hypertext system. - abstract to an article in the Jan 1992 issue of the Journal of Object-Oriented programmingThe fundamental design flaw in Unix is the asinine beliefthat "programs are written to be executed by computersrather than read by humans." [Now that statement may betrue in the statistical sense in that it applies to mostprograms. But it is totally, absolutely wrong in the moralsense.]That's why we have C -- a language designed to make everymachine emulate a PDP-11. That's why we have a file systemthat forces every file to be viewed as a sequence of bytes(after all, that's what they are, right?). That's why"protocols" depend on byte-order.They have never separated the program from the machine. Itnever entered their tiny, pocket-protectored with acalculator-hanging-from-the-belt mind.

What does "useful" mean? I can still run games in this book via a BASIC interpreter today. It really depends on what you're trying to write.

Writing programms or even making AI sound interesting