1. 18

  2. 2

    This is going to seem like a bit if a weird question but I’ve been wondering this for a while after going toe deep into a bunch of different programming languages: Do they not all seem pretty much the same aside from the syntax? Sometimes not even that. J is cool because it’s lists n stuff but it’s still a similar logic behind it.

    I mean, after a certain point everything seems to boil down into modify this, assign this to that, store this data here, send this data there, iterate, traverse, wrap this function/value, find this pattern and text replace then evaluate, etc, etc. I’ve looked into a couple of esoteric languages like brainfuck and INTERCAL but they’re not appreciably different either. I used to get my mind blown by the way some languages do things but now after looking at older programs, libraries and books that have already been written everything seems to be a rehash or just a reconfiguration of what already exists. It feels more like looking at a bunch of hammers than a bunch of toys.

    I don’t really know where I’m going with this…

    1. 4

      A few things:

      1. In the static realm, different languages’ type systems make fundamentally different guarantees. If your language’s type system makes more guarantees than another language’s, you can have more confidence in the robustness and correctness of programs written in that language.

      2. It’s not what the language allow you to do, it’s what they push you towards. Let’s say that, for some problem, there is a robust solution and a hacky solution. If a language makes hacky solutions easier to write, then programs written in that language are unlikely to be robust. This is somewhat related to, but yet distinct from, #1.
        An unlikely exemplar of this is perl. Despite its reputation for unmaintainability, I find programs written in perl tend to be rather robust and well-made. Partly, this is due its tradition of modularity and stability (in keeping with unix). But partly it’s because, since it’s so expressive, the error handling code you could have just skipped is not actually that hard to write, so you might as well write it.

      3. Related is what the ecosystem does for you. Perl has an excellent, robust package repository and a culture of writing high quality packages. Java has really high quality autocompletion. Common lisp’s dynamism (a language property) is taken advantage of by REPLs (not a language property), enabling an interactive development style that wouldn’t otherwise be possible.

      4. You may be selling syntax short.

      1. 2

        “What we currently call general purpose languages are actually domain specific languages for the domain of algorithms.” – Objective-S

        1. 1

          Kind of, ultimately we need to think about the hardware we’re running on so we end up with languages that are similar since we care (at least a bit) about execution speed.

          Most languages, C, Python, Assembly, Java, Go, Rust, etc, are based on playing around with register machines.

          Other paradigms give you different flavours.

          The ML family of languages give you a more usable lambda calculus which does not feel anything like a register machine.

          The Lisp family is based around the idea that since every expression is ultimately a tree we might as well get rid of the sugar and see what happens, then liberally salt it with a whole bunch of other ideas depending on the version.

          Forth et al. are based on the insane idea that since a two stack pushdown automaton is equivalent to a Turing machine we might as well program on one.

          The APL family is similar to register machines but you assume that most of the work will be done on long stretches of contiguous memory containing the same type, and that you can pass these arrays between as many functions as you could possibly want.

          Logical languages like (a subset of) SQL and Prolog are yet another way to program by giving constraints and letting the computer sort it out.

          Distributed languages are more about the communication between functions/machines and assuming that things will go wrong and messages lost. I’ve only used Erlang from this group.

          Term rewriting is another interesting paradigm that’s not at all popular, the wolfram language is the only one I know of, but I frequently write dsl based around these for maths work.

          There’s more but it gets difficult to decide what’s what since no language has only one idea.

          1. 1

            Term rewriting is another interesting paradigm that’s not at all popular, the wolfram language is the only one I know of, but I frequently write dsl based around these for maths work.

            Is there a rewrite engine you use regularly? Like Maude?

            1. 1

              No, I write most of them in Guile. It’s quite straight forward and I get access to a first class scripting language for GNU utils. The fact that the term rewriting system is also s-expression based means I can evaluate the results of whatever I do as Scheme programs when whatever transformations I want are done. Something that most other systems can’t actually do.

          2. 1

            What’s an idea to you that feels different? Not asking for a coherent, fleshed out thought here, just the vague sense in your head that’s driving some of this.

            Worth noting that BF and IC aren’t particularly esoteric as languages go, I’ll share some more interesting ones when it’s not 1 AM here

            1. 1

              I don’t think this is a weird question. I’ll be honest, I find most languages quite similar and quite quotidian. J and APL are probably some of the few languages I find fairly “different” from others (try building a scheduler in APL or J ;). I maintain that algorithms and data structures almost always end up much more important than a programming language. I also find both much more interesting than PL (or at least the treatment it gets here, which feels superficial.) I think the invite tree has just hit a local maximum of folks who are very interested in programming languages, so we get mostly that. I’m trying to change this by posting non-PL posts, but my language posts are much more popular than anything else I post so shrug

              1. 1

                try building a scheduler in APL

                Honestly, that sounds like a pretty fun exercise. People have done ‘real’ apps before, probably most notable of which is aaron hsu’s compiler.

                What’s hard is actually performing the context switch, but you can’t do that without help from assembly in c, either.

                1. 1

                  I did it actually, but not as a first-time thing. My first attempt at anything like this was a maze solver in J. Now that was a mind-bender that’s for sure. For me, it hit the same spot as a good math puzzle does. I highly recommend the exercise, it’s tough but fun!