top 100 comments

sorted by: hot top controversial new old
[–] 34 points 9 months ago* (17 children)

What type of fun are you after?

https://images.prismic.io/sketchplanations/281df432-3a48-4e78-ac58-1ff835091f99_SP+582+-+The+fun+scale+-+revised.png?auto=format%2Ccompress&fit=max&w=1920

Type 1 is probably python.

Type 2 is probably rust or c.

Type 3 is one of the esolangs. Uiua. Or assembly.

  • source
  • hideshow 17 child comments
  • [+] [S] 8 points 9 months ago (13 children)
  • [–] 3 points 9 months ago (6 children)

    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.

  • source
  • parent
  • hideshow 6 child comments
  • [+] [S] 3 points 9 months ago (5 children)
  • [–] 6 points 9 months ago (1 child)

    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.

  • source
  • parent
  • hideshow 1 child comment
  • load more comments (1 reply)
  • [–] 2 points 9 months ago (2 children)

    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.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 5 points 9 months ago (4 children)

    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.

  • source
  • parent
  • hideshow 4 child comments
  • load more comments (-1 replies)
    [+] 14 points 9 months ago* (3 children)
  • load more comments (1 reply)
    [+] 11 points 9 months ago (15 children)
  • [–] 11 points 9 months ago (13 children)

    People calling functional programming weird hurts me. It's just unfamiliar not weird.

  • source
  • parent
  • hideshow 13 child comments
  • [+] [S] 2 points 9 months ago (12 children)
  • [–] 5 points 9 months ago (1 child)

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

  • source
  • parent
  • hideshow 1 child comment
  • load more comments (1 reply)
  • [–] 2 points 9 months ago (3 children)

    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 (do notation 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 unsafe in 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 labeled IO.

    A fun guide for learning Haskell is here: https://learnyouahaskell.github.io/

  • source
  • parent
  • hideshow 3 child comments
  • [+] [S] 1 point 9 months ago (2 children)
  • [–] 2 points 9 months ago (1 child)

    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.

  • source
  • parent
  • hideshow 1 child comment
  • load more comments (1 reply)
  • [–] 2 points 9 months ago* (3 children)

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

  • source
  • parent
  • hideshow 3 child comments
  • load more comments (1 reply)
    [–] 9 points 9 months ago* (1 child)

    I've seen a lot of technical recommendations, but what I found most fun to experiment with is visual/art/music stuff, so here are some recommendation if that's also your thing. It's not strictly programming, because most of it requires learning more skills than just that, but I see that as an advantage. YMMV, though.

    The Book of Shaders is and extremely good introduction to some basic shader stuff. Especially thanks to the interactive editor they have in their tutorials, and web tools like Shadertoy, experimenting with shaders is easier than ever. It was the tutorial that made me finally get past the "super confused" part of learning shaders.

    It's kind of math heavy, especially once you get into 3D stuff, but I find it fun to learn, plus it's a rabbit hole and you can do some pretty cool stuff once you get into it. In general, anything technical artist related is interesting.

    Another thing I'd recommend is looking into Algoraves. Algoraves are live performances where both visuals and music is performed by people live-coding their tracks and projections in some kind of language that's made for the task. TidalCycles, one of the libraries/languages that's commonly used, has a web editor, and there's also Sonic Pi, although I've never tried that one.

    Processing is another language/tool used for making visual art. It also has a web edittor (with a lot of tutorials), and can make some cool visual stuff that can be fun to learn.

    And one last recommendation, this time not about art, but about learning/building your CPU, your own assembly language, and learning to do stuff in it! Turing Complete is a puzzle game, where you will learn how to build your own CPU, starting from a single NAND gate, slowly combining them into registers, memory, adders, ALU, up until you have your own, complete and working CPU. You then create your own instruction set and use your CPU to solve a few puzzles.

    It's super fun and engaging, and I'd consider learning logic gates and building a CPU as kind of also programming.

  • source
  • hideshow 1 child comment
  • load more comments (1 reply)
    [–] 9 points 9 months ago* (1 child)

    since you mentioned Rust, it can also be a matter of how you approach learning it – maybe learning a game might be more comfortable – as an example, Reddit’s r/roguelikedev links to multiple tutorials in multiple languages (with at least three Rust based options):

  • source
  • hideshow 1 child comment
  • load more comments (1 reply)
    [–] 8 points 9 months ago (5 children)

    take a look at one of the “fantasy consoles”, can do quick scripts and see results immediately:

    • TIC-80 – primarily uses Lua but they’ve added in support for Ruby, JS, Moon, Fennel, Scheme, Squirrel, Wren, WASM, Janet, and Python as well
    • uxn – virtual machine using uxntal, a kind of Forth/assembly hybrid

    for an actual language, don’t discount Lua – simple, fast, tiny – “real programmers” like to ridicule it, and yet it keeps turning up everywhere from video game scripting to text editor configuration to databases to web servers

    • Learn X in Y Minutes – a good introduction to a lot of languages, gives you a good idea of their look-and-feel
    • Rosetta Code – LOTS of languages with LOTS of code examples
  • source
  • hideshow 5 child comments
  • [–] 5 points 9 months ago (4 children)

    Lua to me is the language JavaScript wishes it was. It's super minimal and actually designed reasonably well. It knows what it is and isn't trying to be something else. I wouldn't want to try to write an entire app in it, but for a scripting language embedded in something else there's not a lot of languages I'd rate higher.

  • source
  • parent
  • hideshow 4 child comments
  • [+] [S] 1 point 9 months ago (2 children)
  • [–] 2 points 9 months ago (1 child)

    Lack of advanced features like generics and a weak type system (although still better than JavaScripts type system). Its library ecosystem is also pretty anemic because it's generally assumed if you're writing Lua it's as part of a script embedded in something else and most of those won't let you pull in random Lua libraries. There are stand alone Lua interpreters that let you run Lua on its own but most people writing Lua code aren't using them and so the community to develop a rich library ecosystem isn't really there like it is in most other languages.

  • source
  • parent
  • hideshow 1 child comment
  • load more comments (1 reply)
  • [–] 8 points 9 months ago (6 children)

    So, I can't answer the question of "what's the most fun language to learn" because that's highly subjective and my answer almost certainly wouldn't align with your experience. What I can do though is share my thoughts about different languages I've used over the years (in no particular order).

    • Assembly: the bedrock upon which all other languages are built. If you want to understand how a computer really works, this is a great language to learn, and it's honestly not that hard to learn. Writing something in assembly much more complicated than hello world is incredibly painful because of just how much you need to do and really makes you appreciate how much you get out of the box with other languages, but it's not hard in the "I don't get it" way, so much as "oh god, that's only 1% of what I need to do and it took me an entire day". This is also a great way to develop a deeper understanding of pointers and memory management.
    • C: assembly on steroids. Not quite as painful as assembly because you get a lot of libraries that take care of things for you, but still quite tedious compared to most other languages. The type system such as it is is practically nonexistent so your ability to design APIs is highly limited, and it's incredibly easy to introduce subtle and hard to find bugs. Relatively easy to learn, hard to master, and an act of masochism to use for large projects. At a minimum probably worth learning because C is the de facto interop language any time you want to interface two different languages together.
    • C++: C with the entire kitchen sink of comp. sci bolted on top of it. There's a good language in there somewhere, it's just buried under decades of terrible ideas and half baked experiments. If you know which are the "good parts" and which are the parts to ignore it's not bad, but figuring that out is far from a trivial task and everyone you ask is going to have a slightly different answer. I'd honestly say avoid this one unless you want to spend a couple years exploring all its dark corners and forgotten nooks.
    • LISP (and derivatives like Scheme): ye old functional language. This is basically the assembly of functional programming. It's "simple" to learn, but the lack of features is going to start to grate on you after a while, and the syntax is just horrible. Absolutely worth learning to learn to think functionally, but once you do I'd move to a better language.
    • Haskell: Like LISP but with a masters degree in set theory, a MUCH better syntax, and one of the absolute best type systems ever created. Amazing language that will expand your mind just from learning it but might kill you from a brain aneurysm in the process. To abuse a meme, this is the dark souls of functional programming.
    • JavaScript: A badly designed scripting language that was thrown together from a box of scraps in a cave, but rather than making it better over the years everyone just said "eh, good enough". Its original sin was that in an attempt to make it "beginner friendly" they made the syntax incredibly sloppy which means it's very easy to introduce bugs on accident and then very hard to actually find them because they don't error, they just silently do the wrong thing.
    • Typescript: A better JavaScript in every metric. At the end of the day under the hood it's still JavaScript at runtime so it can only do so much, but the addition of a real type system goes a LONG way towards making JavaScript more bearable to work in and helps eliminate a ton of bugs.
    • Perl: What LISP is to functional programming, Perl is to basic collection types. Scalars (single values), Lists, and Maps are your building blocks in Perl. It's not a bad language exactly, but these days other languages do almost everything it does but better. If there's one significant criticism you could level on Perl it's that the syntax is really easy to abuse to write some truly obtuse code. This is effectively a dead language these days, but it does live on a little bit by being the gold standard in regular expression design that everyone else just copied.
    • Lua: One of if not the best scripting languages currently out there. It's very similar to Perl except it went all in on Maps. It's simple to learn, and simple to master, although that comes with the downside that it's nowhere near as powerful as other languages. Out of the box you don't really get much with it, but since it's designed to be embedded it's really easy to extend and there are versions of it that come with all the bells an whistles you need to use it directly for writing apps. I'm not sure I'd recommend it over another language in general, but if you're looking for a scripting language to embed in something else it's my top pick. The web ecosystem would be a lot less of a mess if Lua had been the language picked at the dawn of the internet instead of JavaScript (to be fair I'm like 99.9% sure Lua didn't exist back then but I'm too lazy to verify that).
    • Python: A competent language. It's not a particularly great language and definitely has some warts, but there's not really anything in the language that makes me go "ewwww" except maybe the significant whitespace, although Haskell does the same thing so it would be hypocritical of me to ding Python for that. It's a solid middle of the road language, nothing really amazing about it, but nothing really bad either. It's biggest flaw is its duck typing system which really limits your ability to write APIs in it. If you want to crunch some numbers it has some really great data analysis libraries and frameworks, although performance isn't anything to write home about either.
    • Ruby: The train wreck that happens when Perl crashes into Python and the mangled remains crawl from the wreckage. It's the terrible syntax of Perl crossed with the middling type system of Python with a sprinkling of bad choices all its own. Performance is horrible and the language has a lot of features that make it easy to write obtuse code. Like Perl this is an effectively dead language. Just use Python or something better.
    • Go: Created in part by one of the guys involved in the creation of C and set out to be a "simple" language that anyone could learn. It does succeed in being simple, but the tradeoff is that it pushes all the complexity that most other languages handle for you onto the programmer to handle. Go programs are going to end up being a lot more verbose and filled with boilerplate than they would be in another language. It also still suffers from an early decision related to its generics system that leads to them being largely useless. Not unsurprisingly working in Go feels a lot like working in C, you often find yourself wishing the language handled a bunch of things for you or at least gave you some syntactic sugar to handle them more concisely yourself.
    • Java: Has a reputation for being verbose but that's more to do with the community than the language itself. Also has a reputation for being slow, and while startup times are certainly a problem at runtime it's surprisingly fast these days. Not a great language, but nowhere near as terrible as its reputation would make you think.
    • Kotlin: Java alternative. Solves some of Javas problems, introduces some of its own. At one point it was the clearly superior choice compared to Java, but since then Java has closed the distance and honestly it's a coin flip as to which is the better language between the two.
    • C#: Microsoft Java. Seriously, everything you can say about Java applies equally to C# and vice versa. It's not a better or worse language, it's just different. Criticisms of C# are less about the language and more about the company behind it.
    • Rust: A type system nearly as powerful as Haskell's, low level primitives that let you write bare metal code, but advanced abstractions that let you write high level code as well, and a truly unique approach to addressing concurrency and memory safety by way of the ownership system. One of the more interesting languages out there and my personal pick for "best" language because it gives you tools to solve some of the hardest problems to deal with in programming.
    • Zig: A better C. Has a somewhat powerful type system a bit like Rust or Haskell as well as a pretty unique and interesting macro system, but ultimately lacks some of the higher level features that something like Rust would give you. It's similar to C in that it it can be somewhat tedious to work with but on the whole not a bad language.
  • source
  • hideshow 6 child comments
  • [–] 4 points 9 months ago* (last edited 9 months ago) (4 children)

    Assembly: ... but it’s not hard in the “I don’t get it” way, so much as “oh god, that’s only 1% of what I need to do and it took me an entire day”. This is also a great way to develop a deeper understanding of pointers and memory management.

    Well explained.
    Although I understood memory beforehand, I found the little bit of Assembly I did pretty useful in getting a better understanding. This also ended up opening me to think of how multithreading worked underneath.


    I found C pretty fun, but that might be my bias.
    It was fun because it felt pretty close to hardware and let me understand how stuff can go wrong, without tripping me into it (the last part is subjective. I suppose most people would feel having been tripped, when using C).

    C++ was fun and useful as long as I thought of it like C. Once I went into software development and had to make sure stuff worked out well on top of mistakes that might come out of collaboration, I had to start considering things like smart pointers almost all the time and it was no longer as much fun.

    Rust is definitely not going to give the fun of C. Although it is more desirable for Software Development, when you start learning it, you will find quite a few blockers, that you might feel unreasonable. Me, even after having used C and C++ and realising the problems faced when making software and then having seen proper explanations of the features of Rust, still have a problem with the feeling of it.

    Python: if you just want to do some mathematics on computers, this will be more desirable. The "fun" for this one is that you don't need to worry as much when doing some scratchpad stuff. Start going big though and it stops getting any fun, pretty fast.

  • source
  • parent
  • hideshow 4 child comments
  • [+] [S] 1 point 9 months ago (3 children)
  • [–] 2 points 8 months ago (1 child)

    So, there's not a great answer to that. The big problem is that x86 assembly is painful because the x86 instruction set is a weedy overgrown mess due to being built on top of literal decades of cruft. Even a CPU made today starts off by booting up pretending to be an 8086 processor, a 16 bit CPU from 1978. To get to a "modern" operating mode you need to walk through a series of configuration steps to get the CPU into the correct mode, but all those modes and configs add a lot of noise when trying to understand x86 assembly. For that reason it's probably a good idea to start by not learning x86, but instead the far more minimal and sane ARM assembly.

    The problem of course is that there's like a 99% chance that the system you're going to be working on when learning assembly is an x86 system not an ARM one. So now you need two more things, you need an assembly cross-compiler to use your x86 system to build an ARM executable, and you need an ARM emulator to run it. Personally I'd install LLVM (specifically clang) and start by writing a small C wrapper with some inline assembly in it. For running it I'd use QEMU and a Linux ARM image (maybe one of the raspberry pi distros).

    Finally allow me to introduce you to one of the absolute coolest tools out there godbolt compiler explorer. Godbolt allows you to take a snippet of code written in one of dozens of supported languages and see the assembly instructions that various compilers would produce from that code. This is a great way to learn more about not just assembly, but any of the supported languages and is also an invaluable tool for doing fine grained optimizations.

  • source
  • parent
  • hideshow 1 child comment
  • load more comments (1 reply)
  • [–] 2 points 9 months ago*

    IDK really, perhaps you can use a book.
    I mainly did it in the 8085 practicals during B.Tech and they had a handy learning kit with a HEX keyboard so we could Assemble it manually on paper, write the program directly to a given RAM address and then run it from there. For ARM, we just used Keil µVision.
    Now I just download an x64 instruction manual or just look up the instructions on the web, on the occasional requirement of reading disassembly.

    I don't recommend starting with x86_64 reference. While it can be used just fine, it has lots of instructions and and you instead want a very small subset of them.


    Also, there will be a great difference between using an OS and not doing so, as going with one, then includes a lot of potential boilerplate.

  • source
  • parent
  • load more comments (1 reply)
    [–] 8 points 9 months ago (7 children)

    Easy: CircuitPython running on an RP2040 or RP2350 microcontroller. Being able to write a simple bit of code and have it control something in the real world is sooooooo satisfying. OMG: You'll jump for joy the first time you get it controlling some LEDs, a display, a servo, a motor, etc.

    Programming a microcontroller for the first time was definitely the most fun I ever had when programming. CircuitPython makes it so easy, too! Oh if only it had existed back when I started learning electronics.

  • source
  • hideshow 7 child comments
  • [–] 4 points 9 months ago* (1 child)

    100% agree! I write enterprise monsters for a living, in a bunch of different languages, and by far my favorite thing to do is make blinken-lights and other doohickies with my Arduino.

    Doesn't have to be Python or even the Arduino subset of C++, though. I like to use Go (tinygo.org) for anything that it will compile on

  • source
  • parent
  • hideshow 1 child comment
  • [+] [S] 2 points 9 months ago (2 children)
  • [–] 2 points 8 months ago (1 child)

    You'll want to get an electronics starter kit. There's zillions of them.

    Having said that, the easiest hardware to work with is the rp2040 (RPi Pico) and rp2350 (RPi Pico 2). It's got USB mass storage support built in which is about as easy as it gets and it does everything and you can use just about any pin for any thing. It really is awesome.

    If you can't find a kit that includes the RPi Pico (or Pico 2) just get a regular kit (e.g. Arduino) and a Pico separately.

    Note: I just found this neat thing... https://a.co/d/05qypEzY it looks like it'd be super easy to learn with but you miss out on learning how to use a breadboard but that's no big deal (you can just do that later).

  • source
  • parent
  • hideshow 1 child comment
  • load more comments (1 reply)
  • [–] 2 points 9 months ago (1 child)

    That reminds me I should finish that IR remote to USB keyboard translator I started... (I wonder if i can use the arrows on the remote to control the mouse pointer too...)

  • source
  • parent
  • hideshow 1 child comment
  • [–] 7 points 9 months ago (3 children)

    Elixir. Especially with OTP to write distributed systems. Or with phoenix and liveview for web apps

    It's a functional language based on Erlang with a nicer syntax

  • source
  • hideshow 3 child comments
  • [+] [S] 2 points 8 months ago (2 children)
  • [–] 2 points 8 months ago

    It's a lot like Ruby syntactically and visually but it's super easy to learn and start doing useful stuff in quickly. The combination of functional and declarative programming make for a very nice developer experience.

  • source
  • parent
  • [–] 2 points 8 months ago* (last edited 8 months ago)

    I can't comment as I've not used scheme but looking at scheme's syntax, elixir is much nicer. It's supposed to take some of its inspiration from Ruby.

    The big seller is that it runs on the Erlang VM so you get all the goodies for free: supervisor trees, OTP, processes, even able to call Erlang directly. It is both scriptable and compiled. Not so much suited for high performance computing though as benchmarls will show, but it is interesting to learn and I have gained a lot from exposing myself to functional programming paradigms.

    https://elixir-lang.org/

  • source
  • parent
  • [–] 7 points 9 months ago (1 child)

    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)

  • source
  • hideshow 1 child comment
  • load more comments (1 reply)
    [–] 7 points 9 months ago* (1 child)

    Lolcode:

    HAI 1.2
    
    HOW IZ I FIZZBUZZ YR INPUT
        I HAS A RESULT ITZ A YARN
    
        I HAS A FIZZ ITZ MOD OF INPUT AN 3
        I HAS A BUZZ ITZ MOD OF INPUT AN 5
    
  • source
  • hideshow 1 child comment
  • load more comments (1 reply)
    [–] 6 points 9 months ago* (1 child)
    load more comments (1 reply)
    [–] 6 points 9 months ago (1 child)

    Probably Python. It’s very accessible.

  • source
  • hideshow 1 child comment
  • load more comments (1 reply)
    [–] 5 points 9 months ago (1 child)

    Logo. Turtle graphics spirographs go weeeeeeee!

    At least, that's the most fun I had programming as a kid. There might be other good options nowadays, like Scratch or whatever they use to program those Lego robots.

  • source
  • hideshow 1 child comment
  • load more comments (1 reply)
    [–] 4 points 9 months ago (2 children)

    Fun? Lua, Odin, nim, zig.

    Impractical? Brain fuck.

  • source
  • hideshow 2 child comments
  • [–] 4 points 9 months ago (1 child)

    I had the most fun learning Haskell. Mostly because it was so different from the languages that I knew. Also, learning Lean was fun. But I guess that's kinda niche since it's not very relevant for anything but pure mathematics.

  • source
  • hideshow 1 child comment
  • load more comments (1 reply)
    [–] 4 points 9 months ago*

    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"

  • source
  • [–] 4 points 9 months ago (2 children)

    I am having the time of my life with Clojure. Lisps in general. They really change how you view software. I was showing how clojure works to my Java coworker and showing her the REPL and powers of Clojure, and we both almost teared up :)) It's tgat good.

  • source
  • hideshow 2 child comments
  • load more comments (2 replies)
    [–] 7 points 9 months ago* (17 children)

    C and assembly if you like learning how computers work

    Python and typescript if you want to make blinky lights

  • source
  • hideshow 17 child comments
  • [+] [S] 4 points 9 months ago (16 children)
  • [–] 8 points 9 months ago (5 children)

    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.

  • source
  • parent
  • hideshow 5 child comments
  • [+] [S] 2 points 9 months ago (4 children)
  • [–] 9 points 9 months ago (1 child)

    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 to 00000001, 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

  • source
  • parent
  • hideshow 1 child comment
  • load more comments (1 reply)
  • [–] 7 points 9 months ago (1 child)

    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

  • source
  • parent
  • hideshow 1 child comment
  • load more comments (1 reply)
  • [–] 4 points 9 months ago (5 children)

    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.

  • source
  • parent
  • hideshow 5 child comments
  • [+] [S] 3 points 9 months ago (4 children)
  • [–] 6 points 9 months ago (3 children)

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

  • source
  • parent
  • hideshow 3 child comments
  • [+] [S] 1 point 9 months ago (2 children)
  • [–] 1 point 9 months ago (1 child)

    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 #include 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.

  • source
  • parent
  • hideshow 1 child comment
  • load more comments (1 reply)
  • [–] 3 points 9 months ago* (1 child)

    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...

  • source
  • parent
  • hideshow 1 child comment
  • load more comments (1 reply)
  • [–] 3 points 9 months ago (3 children)

    So, if you're brand new and want to learn concepts of how to write code, I might suggest a game. There are a lot of programming games. Obviously it's never a one to one about learning something useful, and a lot of them even make "bad" things useful (though not bad enough to think it's going to teach you bad habits you won't be able to unlearn). I really enjoyed Exapunks, but it's sort of unrealistic. The Farmer Was Replaced looks fun as well and uses a "simple Python-like" language, but I haven't played it.

    If you sort of already understand the concepts and want to dive into a real language, well, it's hard to say what will be fun. Chase your fun. It might be easier to think about what's not fun and avoid languages at the start that deal with that. For example, if setting up an environment to code in is the problem, then maybe something like JavaScript would be a good place to start. It runs in your browser! Press F12, click "console", type alert("Hello, World!"), boom, done, you just did Hello World in JavaScript without downloading anything at all.

  • source
  • hideshow 3 child comments
  • [–] 1 point 9 months ago* (last edited 9 months ago) (2 children)

    I'll toss TIS-100 onto the list of programming games although that one teaches you a pseudo-assembly language as well as how to think about concurrent programming. Then there's Human Resource Machine although that one is aimed at absolute beginners to programming and teaches a sort of visual assembly, and then its quasi-sequel 7 Billion Humans which extends the concepts explored in Human Resource Machine into parallel processing (this actually makes a pretty good soft introduction to GPU programming and shaders).

    I actually played The Farmer Was Replaced and it's just straight up Python, not even Python-like, it just locks a lot of the language features behind campaign progression. It was OK initially, but gets kind of annoying at later levels because they intentionally hold back a lot of the tools to easily solve problems and make you solve them in a more verbose and annoying fashion first.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 9 months ago (1 child)

    TIS-100 and Shenzhen IO both felt annoyingly limited to me in ways that Exapunks didn't.

    The reason I say "Python-like" is because that's how their store page describes it.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 9 months ago

    Interesting. I did find Shenzhen IO to be a bit annoying but that was more because it forces you to use circuit design to solve certain problems rather than just brute forcing them via programming. Weirdly I couldn't get into Exapunks while I found TIS-100 really interesting.

    I suspect the reason that they call it Python-like is because I don't believe it allows you to import any libraries or anything into it and they don't want people to think they've got a full Python interpreter that can do all the normal Python things. Essentially it's Python syntax, but without the normal Python runtime. There's probably some more advanced Python-isms that are missing as well, but I've not used Python enough or played the game enough to really run into those things. E.G. I don't know if it lets you define new classes as I never bothered to try that. I kind of got bored of it once I got towards the later levels and didn't really see any reason to keep grinding to unlock what were just extra challenges in the game.

  • source
  • parent
  • [–] 3 points 9 months ago* (5 children)

    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.

  • source
  • hideshow 5 child comments
  • [+] [S] 3 points 9 months ago (4 children)
  • [–] 2 points 9 months ago (3 children)

    Anti-patterns are essentially what ‘not to do’. Heres a good series of Medium articles on it!

  • source
  • parent
  • hideshow 3 child comments
  • [+] [S] 3 points 9 months ago (2 children)
  • [–] 1 point 9 months ago (1 child)

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

  • source
  • parent
  • hideshow 1 child comment
  • load more comments (1 reply)
  • [–] 5 points 9 months ago (4 children)

    This is probably an unpopular opinion, but I find modern C++ with templates and constexpr to 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 yet

  • source
  • hideshow 4 child comments
  • [+] [S] 1 point 8 months ago (2 children)
  • [–] 1 point 8 months ago* (1 child)

    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.

  • source
  • parent
  • hideshow 1 child comment
  • load more comments (1 reply)
  • [–] 2 points 9 months ago (1 child)
    load more comments (1 reply)
    [–] 1 point 9 months ago (1 child)

    Backend? Frontend? What do you want to do with it?

  • source
  • hideshow 1 child comment
  • load more comments (1 reply)
    [–] 3 points 9 months ago

    Perl! It is a language with a lot of soul and the llama book is actually fun to read.

  • source
  • [–] 2 points 9 months ago (2 children)

    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.

  • source
  • hideshow 2 child comments
  • [+] [S] 2 points 8 months ago (1 child)
  • [–] -1 points 8 months ago

    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.

  • source
  • parent
  • [–] 1 point 9 months ago
    [–] 1 point 8 months ago (2 children)

    I had a blast doing AoC in https://gleam.run/

    it's like elixir with typing

  • source
  • hideshow 2 child comments
  • load more comments
    view more: next ›