I don’t need something practical. I just need something fun to keep me motivated.
Fun? Lua, Odin, nim, zig.
Impractical? Brain fuck.
Hell yeah, Odin is my default for everything.
I don’t need something practical. I just need something fun to keep me motivated.
People have already mentioned Lisps. So, I wont repeat that. So, let me tell you about this great one.
Forth. And the best way to learn forth is by implementing one for yourself. There are lots of forths out there, almost as many as prolific forth programmers, I suppose. You are supposed to find your own forth. Forth is one of those rare languages (along with Lisps) where you build the language upwards to fit the problem you aim to solve, than convert the problem down to code. Here’s a blogumentary on forth for your perusal.
It is not an easy programming language to learn. The concepts you need to understand is quite low-level. “Real” forths are usually implemented in assembly. If this sounds fun to you and you have time and patience to take the challenge, have a try.
And the best way to learn forth is by implementing one for yourself.
… I wrote a FORTH interpreter in TI-BASIC decades ago. I thought I was weird.
That blogumentary is quite a journey!
The most fun languages to learn that I have learned so far, are Haskell, Factor, Prolog and Agda. Each are quite different from mainstream programming and each other, and it is really satisfying when concepts “click”
Probably Python. It’s very accessible.
I was looking for some ‘Big Daddy-O’ super-fun rando programming language that some guy wrote in C over the weekend in his garage, but Python should work too.
What type of fun are you after?
Type 1 is probably python.
Type 2 is probably rust or c.
Type 3 is one of the esolangs. Uiua. Or assembly.
Haha thats great. Thanks for the taxonomy of fun. I have been trying to learn Rust but I find the payoff is still a ways away, so something to keep me going in the meantime would be good. So I guess 1 is the way to go, because if I want to keep going back then that’s good motivation.
C is not type 2 C is type 3
Go is probably the best in terms of time it takes to learn and building something fun. It replaced Python in that regard for me.
Interesting, what are the main benefits of Go over Python in your opinion?
Speed and the fact that Go compiles into a single binary, so you don’t need a specific runtime environment.
I’m curious what you mean by the payoff being a ways away. Do you feel you don’t understand some aspect of Rust well enough to write anything in it?
As a tangent to that and your original question what languages do you already know? Understanding where your knowledge is lacking could help provide better answers as what languages someone enjoys learning/using tends to change a lot as they become more experienced and start to develop an appreciation for the more complicated problems more involved languages help solve.
I feel like the payoff is a ways away because, I write something that should work, but then I need to wrangle with the compiler for sometimes multiple days just to get it to work. To answer your second question, I know a very small amount of Python and some Typescript, but I’m mostly familiar with Javascript. I do think that is part of what’s going on here. Javascript is super losey goosey and not typed. So then my brain translates Javascript code to Rust and it just leads to total chaos.
Aaaah, yeah. You’re struggling with thinking in terms of types and scopes and probably also a tiny bit of stack vs. heap allocation. Javascript side steps most of the concurrency problems by having a single threaded runtime, and of course is a garbage collected language so you never really need to worry about memory management either.
Rust is a much more powerful language, but of course with power comes responsibility. The compiler believe it or not is actually helping you a lot even though it probably doesn’t feel like it. In something like C you’d probably be able to successfully compile those programs that Rust refused to build but then you’d get crashes and weird bugs when you ran the program with very few clues on where you made a mistake.
Fundamentally here’s the difference. Javascript is making the tradeoff that it will worry about a lot of the details for you, but it will get them wrong a lot and performance will suffer as a result. It also doesn’t give you a lot of ability to express your problem well due to its incredibly primitive type system which will lead to a lot of bugs that are very hard to diagnose.
Rust on the other hand says you need to worry about the details but it will give you some tools to make managing them easier to the point where you can ignore them a lot of the time. E.G. most of the time you can just stack allocate your variables and not worry about heap allocation and the headaches that can introduce. But the tradeoff for that is you can get some of the best performance out there and its advanced type system lets you model problems in ways that make bugs far less likely and much easier to diagnose and fix.
Rust doesn’t let you write code that works 90% of the time but fails 10% of the time, it forces you to write it in a way that works 100% of the time. This is particularly true for concurrent code where Rust prevents (mostly) race conditions that nearly every other language lets you write. If you’re thinking some code that should work isn’t compiling it’s almost certainly because that code would fail with some kind of race condition under concurrency. The good news is once you start to understand where these problems crop up it’s usually easy to resolve them by putting a Arc or RwLock wrapper around something or maybe just a simple
.clone()if you don’t mind the performance hit.I see. After reading your comment I can already see how learning Rust is helping me look back and better understand what Javascript is doing, too. So somethings working I guess! Thanks for your response.
Once it clicks, rust can be type 1, it certainly is for me. But it’s definitely a long and hard type 2 to get there.
I just gotta stay motivated. Miley Cyrus said it best.
Lol, one of the great philosophers of all time
I bet esoteric languages are fun, if you’re the right type of person!
yeah, if you want something really esoteric check out piet. it doesn’t even use letters or numbers, the code literally just looks like abstract art
thanks for the graphic btw, that’s very useful
assembly can be a lot of fun to play with if you are not making anything super serious.
I’ve done a little, it could definitely fall into type 2 depending on the person.
Type 3 is brainfuck.
C and assembly if you like learning how computers work
Python and typescript if you want to make blinky lights
How does C compare to Rust? I’ve heard you can learn the syntax in a weekend, but you spend years trying to master it because of all the memory leaks and such that it leads to. Would you say that’s accurate?
So C is basically assembly with a bunch of syntactic sugar on top. It manages a lot of the book keeping and boilerplate, but at the end of the day there’s not a ton of difference between them in terms of the abstractions it provides. If you know assembly learning C is a piece of cake. If you don’t you’re probably going to take a while to really wrap your head around pointers and the myriad ways C can use them for great and terrible things. Beyond pointers (and race conditions if you’re crazy enough to do multithreading in C) the rest of C is super easy because there really isn’t much else there.
Rust on the other hand is a much higher level language more comparable to something like Java, C++, or Python. It gives you a lot of tools to solve complicated problems but unlike Java and Python and like C++ it still gives you the option of working at a low level when you need to. The big advantage it has over C++ is that it learned from the many mistakes C++ made over the years, and the borrow checker really is a unique and powerful solution to both memory management but also crucially concurrency problems.
Interesting. I always assumed that Rust would be more similar to C since they are now using Rust in the linux kernel
No, for a good modern C alternative I’d look at Zig. The main reason C is used for the Linux kernel is because Linus hates C++ for a variety of reasons. For what it’s worth I agree with him. Most other OS kernels are written in C++. Linus allowed Rust in because it demonstrated that it could provide the same power as C++ without all of C++'s problems (mostly that over the years it became a kitchen sink language, anything that anyone ever thought might be a good idea got rolled in even when it was incompatible with some other feature already in the language).
Thanks for the suggestion. How does Zig compare to C safety wise? One of my main reasons for going for Rust was because I was looking for something like C but safer
It’s a bit safer and a lot more convenient to use, but still lets you do dangerous things with pointers. At its core it’s still fundamentally the same as C just with a bunch of helpful tools and features to make doing all the stuff you do in C easier and more convenient.
Really the biggest thing it does significantly better than C is its macro system. C macros are “dumb” in that the C pre-processor does a simple find and replace on the source files without doing any kind of processing on the underlying C code so you can E.G. write C macros that spit out mangled illegal C code when you run them. Likewise a C
is literally the same thing as copy and pasting the contents of the included file before it gets fed into the compiler.Zig on the other hand has a smart macro system that’s actually aware of the zig code and works in concert with it at compile time.
Python is like your automatic transmission. It handles a lot of work on the backend to make life easier, but the trade off is performance and control.
In C/C++, you’re reaching into the gearbox and moving it by hand. It doesn’t clean up anything for you and doesn’t prevent you from making dumb mistakes. In exchange, it can be wildly faster than Python.
In Assembly/Binary, you’re crafting the gears before you can even start the car.
Man people actually code in binary? That’s hardcore
They don’t type out the 0s and 1s, no. 😅
@otacon239@lemmy.world wrote “Assembly/Binary”, because an Assembly language is basically just a list of aliases (or mnemonics) for the different combinations of 0s and 1s.
For example,
HLT(Halt) may translate to00000001, which is then already what your CPU understands.In practice, these lists for the different Assembly languages will look like this: https://en.wikipedia.org/wiki/Opcode#Sample_opcode_table
Ah I see. That’s interesting thank you.
My favourite childhood game RCT2 was a masterpiece of assembly: https://youtu.be/ESGHKtrlMzs
It’s crazy to me that someone actually took the time to write a whole game in assembly. The skill required to do that is remarkable
Somewhat. The issue isn’t memory leaks themselves so much as learning project architecture, patterns, and generally how to do things without shooting yourself in the foot.
Rust has plenty of gotchas and unintuitive elements, so they’re not too different in that sense. Though Rust is more likely to point out when you’ve done something wrong, where as C will exercise your debugging skills.
Modern C++ is also an option, and surprisingly easy to use. The only catch is that the errors can be very difficult to parse and it’s hard to find modern best-practice materials to learn from since most of industry is quite far behind compared to where the language is.
One benefit Rust has is that it’s quite new and niche, so the materials tend to be of fresh, without much legacy mindset, and of a relatively high quality. Tbh I’m not sure how Rust is for newbies, but it may be worth a shot. At the very least, the community is passionate and the errors will be readable…
generally how to do things without shooting yourself in the foot
In programming, as in life, this is key.
To your point, I have found the error messages and the documentation for Rust to be super helpful and easy to read. As a newbie it is straightforward enough, but it’s really an endurance game, because I think unlike other languages you need to cross a critical threshold before you can really understand the language well enough to use it even for simple tasks
Rust is close to C++, in that you get a lot of high level constructs to help you. C is very low level, and you can learn the syntax in a weekend, but you’ll also have to learn memory management and implement advanced structures (linked lists, etc) yourself.
Memory management isn’t too hard, it’s mostly remembering who created what, who reads and writes to it, and who is responsible for cleaning up. With some additional comments as you go it’s not too hard. Also, depending on what your doing, leaks may be acceptable. A short lived program can leak all it likes, and the OS will clean up for you ibthe end :D
Good to know, thank you for your input
Backend? Frontend? What do you want to do with it?
I want to use it to take over the world. Also, backend
Just pick a thing you want to work on. If it’s a website it’s JS/TS, if it’s a terminal app then python (or JS/TS). If it’s a desktop app then I’d personally say C# but opinions vary wildly. If you want to do something embedded (microcontroller) then C, Zig or python. If it’s a mobile app then Swift for iOS, Java/Kotlin for Android or Dart/Flutter.
Honestly, python is IMO the best to get going unless you want to make a website then it’s JS/TS.
Web frameworks can be fun to learn but it might be a bit much to start out but making an Astro blog is easy and fun. If you want to spice it up to a Web app then I recommend Vue even though I work with angular and know react.
But yeah, I recommend python to most beginners unless you want your first thingy to be a website.
This is probably an unpopular opinion, but I find modern C++ with templates and
constexprto be quite fun, mainly from the perspective of trying to do as much at compile-time as possible. Most of the resulting code is nearly incomprehensible and never gets used for anything outside of a godbolt demo, but trying to do complex tasks within the limited and unintuitive world of compile-time evaluation is something I’ve never really been able to find in any other language.i don’t want to hear about rust, const generics are almost useless and you know it, specialization isn’t really a thing and nothing like variadic templates exists yeti don’t want to hear about rust, const generics are almost useless and you know it, specialization isn’t really a thing and nothing like variadic templates exists yetWhat is your honest opinion about Rust? I’m curious
Rust has a lot of cool ideas (I love the borrow checker), but in its current state I don’t think it can replace C++ for the things I’d be interested in using it for. 99% of the time when I reach for a natively compiled language it’s because I need to do some performance-critical loop I can’t reasonably implement in the language my business logic is written in (normally Java), and I end up in a situation where most of Rust’s advantages (and C++'s footguns) aren’t really relevant (lifetimes don’t matter if I’m just writing some SIMD code which reads/writes into externally allocated memory segments). So for my purposes, Rust is mostly just a worse version of C++ in that it’s missing a bunch of features I want (my main gripes already listed above) and has a bunch of cool features that I don’t care about.
If I were writing an entire program from scratch I’d probably opt for Rust over C++, at least for the bulk of the business logic, but I don’t think Rust has quite achieved its ideal of “zero-cost abstraction” for many performance-critical use cases, and certainly not most of the ones I actually have.
Learn what makes LISP LISP (lambda calculus), then start creating LISP-like interpreters in. every. language.
This video might pique your interest in the topic - William Byrd on “The Most Beautiful Program Ever Written” [PWL NYC] (tldw; he explains and shows how to build a LISP interpreter in LISP)
All these comments on LISP here are just making me realize I don’t really know what LISP is. I will have to look into it. Thanks for piquing my interest
I see a lot of people recommending things that a beginner definitely isn’t going to find fun. It’s not fun to bang your head against problems before you even understand what is going on. If that sounds like you then you do not want to be touching anything like Rust, C, C++, etc. Some people are recommending Python. I strongly recommend against that. Yeah it’s a simple language, but it breaks all conventions that other languages have set up. Whitespace, tooling, comprehensions. They’re all different. You’ll struggle with the terrible tooling, the whitespace syntax isn’t used in any other popular languages, and the stuff that is in other languages is implemented completely differently.
I like Ruby for fun. It’s an incredibly approachable language, it’s extremely fun. The tooling is dead simple and works on every system out of the box. Of course everyone else in here is gonna recommend other different stuff, but I can tell you that I have developed professionally with both Ruby and Python for over a decade and the people suggesting Python have most likely not programmed with many other languages.
I’ll give a second suggestion. I recently started learning Unity and it was a blast. It brought back that joy of programming for me. Of course, most of it isn’t programming, but that might help things in your case. So maybe if you’re looking for something that isn’t so … ‘backend’ then that might be what you want, a video game engine that can get you started easily.
Some others suggested esoteric or less used languages like Lisp or Forth, and I can’t give any recommendations about those. Maybe you’ll have fun with those, maybe you won’t.
Finally, one last thing, you can compare a lot of languages to see what ‘equivalents’ would be with this tool. https://evmorov.github.io/lang-compare/ruby-python/ There’s also https://codethesaur.us/, but it covers different bits and doesn’t seem to have much for Ruby.
Thanks for your response. The language comparison stuff seems useful
Yeah, you’re just giving a lot of recommendations about people’s favorite language rather than the most fun. I actually didn’t recommend my favorite language (which is Kotlin) because I didn’t want to do exactly what others are doing.
Fun languages don’t necessarily translate to ones you want to use in production. Like Ruby is great for scripting and command line tools, but I wouldn’t use it in any enterprise backend or frontend system.
Python is one of the more forgiving and extremely versatile.
I highly recommend checking out the game “The Farmer Was Replaced” on Steam as it might be the best way to introduce yourself to programming concepts outside of a classroom. (Not affiliated, just love the game XD)
Then in no particular order:
- Rust (and understand C++ and all interops)
- Typescript
- Bash
- DotNet (Java that works)
And as always - learning the anti patterns is more important than learning the patterns.
Hey thanks for the game recommendation. It’s always nice to have some leisurely activity that is fun to do but you can feel productive doing anyway. Thanks for the language list too.
This might be a basic question but what do you mean exactly about ‘learning the anti-patterns’? Can you expand on that?
Anti-patterns are essentially what ‘not to do’. Heres a good series of Medium articles on it!
Interesting! This feels like it’s going to be something that, once you understand it, you can’t believe you ever programmed without it. Thanks!
See also the closely related concept of code smells. These are things that aren’t necessarily wrong like anti-patterns are because in certain niche cases or in limited amounts they’re fine, but they’re often an indicator that you’re doing something wrong in your code. As a quick example I looked up some code smells in JS and a couple of the examples were using
==instead of===and having deeply nested/indented code (E.G. have if blocks inside of if blocks inside of if blocks inside of a for loop).
I have had the most fun with Rust, but that’s probably because I’m a masochist.
To me it just rolls off the keyboard very well, I don’t know how to really describe it.
It definitely seems like it would be satisfying once you get the hang of it, the learning curve seems steep tho
It is very steep
If you’re looking for something fun to write you might want Ruby. Literally built from the ground up with developer satisfaction as the primary goal.
Very expressive, plenty powerful. Not my absolute personal favorite but I can’t deny it’s satisfying to use.
Haskell or Clojure (or Common Lisp) if you want something weird but neat as alternatives.
These are unique suggestions, which is a good thing, thank you.
People calling functional programming weird hurts me. It’s just unfamiliar not weird.
Whats the best functional programming language for a newbie?
I find F# more approachable than Haskell, while being more modern than Scheme. I don’t think F# would be great for production, but it’s good as a learning tool.
I think Haskell would be a good choice. It’s mature, used for real things (amongst a particular crowd, at least) and it’s emphatic about being purely functional. Even when it is forced to enable other styles like imperative, it’s done in a way that’s syntactic sugar for a pure version (
donotation being a great example of this, it’s really just a chain of lambdas). You can do functional style programming in a lot of languages now, but they’ll also let you mix and match other styles, which can make it easy to “cheat.” Haskell will teach you functional programming and that’s it.Also, since it sounds like you’re familiar with Rust, it uses a lot of ideas from Haskell. Rust enums are a clone of Haskell’s algebraic data types, patterns are almost exactly the same, traits are typeclasses right down to the fact that the compiler can derive some common ones automatically, Rust strongly encourages immutability while Haskell basically requires it, and in both languages you’re only allowed to break the rules if you start using things with the word
unsafein them. My experience learning Rust was “oh, C and Haskell had a baby named Rust, cool!” The big difference is that in Rust, you’re programming from inside a C-style computer with RAM, while in Haskell you’re programming in a mathematical void and the computer is tidily packed away in a box labeledIO.A fun guide for learning Haskell is here: https://learnyouahaskell.github.io/
Very interesting. Haskell definitely intrigues me. What’s the learning curve like, I hear it can be a bit tricky?
It’s very different. You have to come at problems in a very different way because the tools at your disposal are not what you’re used to.
The language itself is quite elegant and simple, if you strip it down to its essence it’s basically “when you see A on the left side of the equals sign, replace it with B on the right side of the equals sign” repeated until your program has either errored out or been boiled down to a single value. The type checker ensures that the replacement will be legal no matter what’s happening at runtime, and can really help with getting things lined up just right because it’s very thorough.
The simplicity also leads to complexity, though, for a few reasons. The solution to any problem is usually generalizable, since there’s such a small surface area to the language itself and the type system allows for very abstract declarations of what a thing does, which leads to very beautiful solutions that are also so general and reusable that it can take work to figure out “okay, so this thing composes one function that is traveling recursively down the list of pairs, applying this function to the first item, and that’s composed into this other function that is pulling them apart into separate lists…” whereas if it had been written the “dumb” way it’d be more like “oh, we’re breaking these items into two lists and tweaking the first item as we go,” unnecessarily tied to the one particular scenario and totally unusable anywhere else in your code, but also more readable and concrete. There’s an entire vocabulary of functions that do abstract things that you have to learn to make sense of what’s going on sometimes.
Related to that is monads, which are such a common pattern in Haskell that the language has special notation for them; they’re an incredibly powerful tool for putting values in a context and/or creating an environment where background details can be handled out of sight, but they’re also so generalizable that they span from the simplest monad that basically just captures “this thing might not actually exist” all the way to the IO monad which, in a way, represents the entire universe, or at least your entire computer. Learning Haskell means wrapping your mind around them, which isn’t impossible, they’re actually quite simple, basically just 2 functions that need to follow a few rules, but it takes a few examples and explainers to really get it.
Generally I think any programmer benefits from at least trying out something like Haskell, even if you never become an expert or use it day-to-day, it’ll give you a new angle to think from and could spark thoughts you never would have had before.
The language thay you are already using! You need to understand FP, not a new language. Definitely read “Grokking simplicity” by Eric Normand.
But if you want to learn a new language more suited for FP, I would hardly recommend either guile scheme, racket, or clojure (all are lisps and you can use and build real word things with them forever). Haskell is also great but it’s much harder than lisps.
You can do oop or fp with lisps, there is basically no syntax, you can get started and actually focusing on doing FP in a month. (Som say you can learn the language itself in a week, which you can but if you are really dedicating time to it).
What do you mean by ‘FP’? I looked up ‘FP meaning’ and got ‘foreign policy’, which I don’t think is what you mean here
Functional programming
For a newbie probably something like Scheme (which is just a particular flavor of LISP) although I wouldn’t call it a good language.
Here’s the thing with purely functional languages that don’t allow in place mutation (most of them, or only under special circumstances like Haskell’s ST Monad), they force you into learning functions that typically don’t exist in other languages like foldl and force you to think about approaching problems in a different way. This will make you a better programmer even when working on other languages, but it’s very much something you have to learn and like all learning it will take time and effort.
I’m actually tempted to say Haskell is the best option because it actually is a really good language but it’s not so much a learning curve as it is a learning grand canyon. It has an amazingly powerful type system (very similar to Rusts) and uses it very well, but it’s also very unintuitive because it’s deeply rooted in academia and uses names for things taken from set theory and mathematics (terms like endofunctor, profunctor, affine space, and of course the famous Monad). If you’re finding Rust a struggle Haskell would be 10 times worse for many of the same reasons.
Another maybe good option that I can’t definitively recommend would be OCaml. I’ve heard really good things about it and what I’ve seen of it looked good, but I haven’t personally used it beyond maybe a little reading and a hello world type thing so I’m unsure what kind of pitfalls a newbie might run into.
The primary reason I’d recommend Scheme is because it’s in many ways a very primitive language. Its type system is very simple and it really doesn’t have a lot going on other than being purely functional. That is also its biggest downside with its second biggest problem being a rather annoying syntax (be prepared to spend a lot of time counting parens to make sure you’re closing every pair and working in the scope you think you are).
Thanks for your write-up. Haskell sounds interesting but a bit intimidating. I’m definitely intrigued by the functional programming thing though, I think that might be my next stop. Ruby seems interesting but I’m already familiar with JavaScript, which seems a bit similar to me, so it would be nice to shake things up a bit.
Weird is subjective. If you’ve only ever done C++ style object oriented programming then jumping into a lisp or a pure functional language is absolutely weird.
I had a blast doing AoC in https://gleam.run/
it’s like elixir with typing
Thanks for the suggestion!
















