1. 69
  1.  

  2. 14

    This really nails everything about how much I regret being a language enthusiast.

    1. 13

      I think it’s very funny that he says “learning a new language won’t make you a better programmer” and then he goes on to say that his first language was Haskell, and somehow he doesn’t put two and two together that hey, for most people if they learn a second language, the first one they learned is probably not going to be Haskell.

      Later on he says that applying ideas from functional programming is really valuable even in languages without immutable data structures (which is totally true) but like …? Where are you going to learn those ideas if you don’t learn more languages? You just said the ideas from functional languages make you a better programmer; how does that jive with “learning new languages doesn’t make you a better programmer”?

      1. 17

        You just said the ideas from functional languages make you a better programmer

        I don’t use the ideas that are idiomatic in haskell. I write very imperative code, I use lots of mutable state, I avoid advanced type system features. These days I even try to avoid callbacks and recursion where possible (the latter after a nasty crash at materialize).

        Look at this:

        https://github.com/jamii/imp/blob/2f85cca53b86b4c56392afb5b0596bdf2697b19b/lib/imp/lang/pass/desugar.zig

        I don’t even pass the scope around functionally - I mutate it before and after each recursive call.

        At one point the code gathers an array of mutable pointers to parts of the expression so that some other code can mutate them all at once.

        There is nothing about this that was learned from haskell.

        he says that applying ideas from functional programming is really valuable

        This is what I said:

        I do find it useful to try to organize code so that most functions only look at their explicit inputs, and don’t mutate those inputs.

        The idea of not writing code as a giant mess of global mutable state is not unique to haskell.

        The only part of the code I linked above that looks vaguely functional is at a very coarse level - the top level desugar function doesn’t mutate the input expression, and it only appends to the store.

        But the rest of the code is only allowed to mutate things within a single component and most of that mutable state is transient. I try to avoid having mutable pointers cross components, and also limit when and where long-lived state can be mutated. With the goal being not to avoid mutation, but to make it easy to find when reading the code or debugging.

        Where are you going to learn those ideas if you don’t learn more languages?

        Are new languages the only ways to learn new ideas about how to write code?

        I didn’t learn these ideas about organizing state from haskell. I learned them from things like:

        https://bitsquid.blogspot.com/2011/01/managing-coupling.html https://bitsquid.blogspot.com/2011/02/managing-decoupling-part-2-polling.html https://bitsquid.blogspot.com/2009/12/events.html

        https://www.dataorienteddesign.com/dodmain/

        https://www.youtube.com/watch?v=rX0ItVEVjHc

        All of which draw from examples in c++ and are applicable to pretty much any language.

      2. 10

        I just realize that I’ve spent the last hour immersed in fascinating stuff linked to by this article, and haven’t even made it very far into the article itself (which is also very good, as far as I can tell so far.)

        1. 7

          The first language I learned was haskell and for several years I was devoted to proclaiming its innate superiority. Later on I wrote real production code in ocaml, erlang, clojure, julia and rust. I don’t believe any of this improved my programming ability.

          Well, when you start at the top the only place to go is down ;)

          Seriously, though. I started in BASIC, then Java, then Visual Basic, then PHP. Along the way I learned enough C to be dangerous and finally got my first real job writing Ruby. I felt the same: everything is the same, what’s the point? Then I got a really boring job in big tech and taught myself Haskell. It opened my mind in ways I did not think possible. Same when I truly learned Ruby and played with Smalltalk. See the ur-languages post – some things are redundant, some are not.

          1. 4

            See the ur-languages post – some things are redundant, some are not.

            ref: https://lobste.rs/s/kwpyt8/seven_programming_ur_languages

          2. 4

            I am finding myself in a simlar boat, albeit much earlier on the timeline. Exhausted with Javascript, Haskell felt to me like torch to a moth. I have spent much time exploring Haskell, and trying to teach myself underlying theory. This article made me question how much of an impact it made on me.

            Sadly, the lure of new languages is strong. Since then I’ve hopped on to common lisp and Rust. Trying to find the right language/ecosystem that ticks for me, and I can finally seriously start building things I want to build; without reserving 70% of my time for paid work, 20% for learning, and only 10% of very exhausted time for working on side projects.

            One thing from article I strongly disagree with is the “Cost of Opportunity” bit. It is too anxiety inducing for me go in that direction. I have done a lot of exploration, I still do it, and I enjoy it a lot. It is not wasted opportunity, it is the right thing to do. I might not be as rich as I could have been, but I am more satisfied. Now that I am wiser than a few years ago, will I change my ways and invest in more “valuable” opportunities? Absolutely not. I am going to do what brings me maximum pleasure. And I am okay with it.

            This comes easy to me; having ADHD means I can’t do what I don’t want to do anyway (without external forces). Accepting this has brought me greater peace, and help me actually move forward instead of wallowing in misery stuck in same place. (Or this is how I rationalize my choices; but even that achieve the same goal, peacefully move forward, one step at a time)

            1. 2

              Excellent post.

              1. 2

                Category theory is the only undergrad class I regret, a hundred or so hours of my life that has yet to find a single plausible application.

                I don’t know what their undergraduate curriculum was like, but the connection between computability, type theory, and category theory is probably legible for the author, and is immensely important for comparison of programming languages beyond simple changes to type systems.

                1. 12

                  immensely important

                  If I spent time learning about it, what would I do differently afterwards as a result?

                  1. 3

                    Does composition in Eve form an operad? A similar line of thought contributed to modules in Monte, one of our improvements over E.

                    At risk of being too meta, it would have changed how you’d approached this post. Recall from your undergraduate course that there exists a category of sets and functions; you mention that being fluent in sets and functions is not “sexy” but is “consistently useful”, and it is similarly useful to know how to manipulate these objects with categorical tools not available to classical set theorists, notably Yoneda’s lemma. At deeper levels of study, beyond “basic logic”, category theory organizes many different fragments of logic with different behaviors over time, not all of which can be implemented efficiently in hardware; we can use functors to talk about when efficient implementations are possible.

                    1. 6

                      Does composition in Eve form an operad?

                      Composition of what? Should it be an operad? Would I change the design of the language if it wasn’t?

                      being fluent in sets and functions is not “sexy” but is “consistently useful”

                      It’s useful because when I have a problem and I look for papers that have solutions, they often describe the solution using sets and functions and basic logic and algebra. I haven’t run into a solution yet that was described in terms of categories. Maybe that’s just because people don’t know enough category theory yet, but I think it’s more likely that the problems I encounter are sufficiently concrete that there is no need to break out a meta-math to describe them.

                      I hope I don’t come across as too combative, because I really am open to discovering a new tool. But whenever I ask people about uses of category theory it always results in hearing how something I’m doing can be described using category theory, but never how doing so would lead to some insight I wouldn’t have gotten from, say, basic algebra.

                      At risk of being too meta

                      That does seem to be the main risk when it comes to category theory ;)