37 votes

What is your favourite programming language?

What is the programming language you enjoy the most, or otherwise define as your favourite? Why is that particular language your favourite?

Bonus: add just a little bit of code in it that you think exposes its beauty.

101 comments

  1. [9]
    Diff
    Link
    Go. Everything feels very concise while also being very fast. No other language I've seen has had such an easy concurrency model. Python there's all these modules and all this setup you have to do...

    Go. Everything feels very concise while also being very fast. No other language I've seen has had such an easy concurrency model. Python there's all these modules and all this setup you have to do around them, to launch another thread in Go it's just a single extra word before your function call to make it non-blocking and maybe 2 changed lines of code.

    func BusyWork(val, iterations int) int {
    	for i := 0; i < iterations; i++ {
    		val /= i+1
    		val *= val
    	}
    	return val
    }
    
    func ThreadyWork(val, iterations int, results chan int) {
    	for i := 0; i < iterations; i++ {
    		val /= i+1
    		val *= val
    	}
    	results <- val
    }
    

    Even just blindly launching 100,000 goroutines all at once, ends up being more than twice as fast (7.3 seconds vs 3.4).

    It feels quick and easy to write, and honestly for simple scripts go run file.go feels like it rivals python3 script.py in startup speed, while the actual code runs insanely faster. Just as a super bad comparison, the single threaded python busy_work() function takes 50 seconds to finish.

    Not as fast as C, sure, but I still feel like I'm getting the ease of writing of Python while also not sacrificing speed.

    20 votes
    1. [2]
      gpl
      Link Parent
      I watched a computerphile video recently that had an interview with Brian Kernighan, and they asked him which languages he uses today and Go was among the list. I've been interested in trying it...

      I watched a computerphile video recently that had an interview with Brian Kernighan, and they asked him which languages he uses today and Go was among the list. I've been interested in trying it out since then - I've heard it described as "C for the 21st Century".

      7 votes
      1. Diff
        Link Parent
        It's definitely very thoughtful in its design and doesn't go nuts with building absolutely everything into the language. Gives you the tools you need and no more. I've heard it said that Go tries...

        It's definitely very thoughtful in its design and doesn't go nuts with building absolutely everything into the language. Gives you the tools you need and no more. I've heard it said that Go tries to tackle new problems by writing new code, instead of writing new language features.

        6 votes
    2. [5]
      cadadr
      Link Parent
      I really like Go, but have troubles with the way it wants code be organised, GOPATH&co is really off putting to me and I don't understand why they want to enforce something like that. Code is...

      I really like Go, but have troubles with the way it wants code be organised, GOPATH&co is really off putting to me and I don't understand why they want to enforce something like that. Code is here, in this very $PWD, why where it is matters, and why not just download dependencies in a vendor dir or some common place like ~/.local/share or ~/.gopkgs or ~/.cache/golang? Also the whole dependency management shenanigans were unnecessary IMHO.

      7 votes
      1. [3]
        ainar-g
        Link Parent
        GOPATH is effectively gone with the Go 1.11 module system.

        GOPATH is effectively gone with the Go 1.11 module system.

        8 votes
        1. [2]
          cadadr
          Link Parent
          So this means I can put code wherever I want (except under $GOPATH up until 1.13) and expect go to work like any other package manager, right?

          So this means I can put code wherever I want (except under $GOPATH up until 1.13) and expect go to work like any other package manager, right?

          5 votes
          1. ainar-g
            Link Parent
            Yeah, that's the plan. I have already used it in a project of mine, works pretty good.

            Yeah, that's the plan. I have already used it in a project of mine, works pretty good.

            5 votes
      2. lobtask
        Link Parent
        I hated $GOPATH but with some recent updates, one can use their module system to write code anywhere. Pretty much sealed the deal for me.

        I hated $GOPATH but with some recent updates, one can use their module system to write code anywhere. Pretty much sealed the deal for me.

        1 vote
    3. povey
      Link Parent
      Golang is definitely my favorite language for a number of reasons: it's opinionated (I'm opinionated too, and find much overlap). this is fantastic for any project with more than one developer. go...

      Golang is definitely my favorite language for a number of reasons:

      • it's opinionated (I'm opinionated too, and find much overlap).
        • this is fantastic for any project with more than one developer. go fmt fixes every style issue that could arrive.
      • building is as easy as go build, and compiles into a static binary. Trying to build Python, or using CMake, is just not nearly as intuitive.
      • importing packages with the package manager is straight-forward and works well. Easier to manage versions for different projects than using virtualenv.
      • coroutines are simple to use, and simple to pass data between.

      It has it's oddities, like how removing an element from a slice is relatively non-trivial, but overall I find it to be very well thought-out and implemented. If I find something designed by the go team that isn't how I would've thought about the problem, then I see it as a learning opportunity because they certainly approached the solution better.

      5 votes
  2. izik1
    Link
    For me, it's most certainly Rust, and I'm not going to try to force anyone to like it, because it's not perfect, and also, that backfires. I actually like Rust for several reasons, method...

    For me, it's most certainly Rust, and I'm not going to try to force anyone to like it, because it's not perfect, and also, that backfires.

    I actually like Rust for several reasons, method chaining, an error story that actually lets you know what error states your program can enter into (looking at you Exceptions, not that I hate exceptions, they're better than some other options at least). and the whole "can't easily write a program that violates memory safety" thing. Going back to the states thing for a second, I like that I can move a lot of errors to compile time, where they might be runtime errors in other languages (Like guaranteeing that a UART controller doesn't accidentally set the wrong register, by using 2 different structs, that physically can't be created without the hardware being in the right state)

    For some reason, the following function is my favorite function, it isn't perfect (actually, it isn't even that great), but I smile every time I see it:

    pub fn ld(cpu: &mut Cpu, hw: &mut Hardware, dest: Reg, src: Reg) {
        match (dest, src) {
            (Reg::HL, Reg::HL) => halt(cpu, hw),
            (Reg::HL, src) => hw.write_cycle(cpu.regs.hl, cpu.regs.get_reg(src)),
            (dest, Reg::HL) => cpu.regs.set_reg(dest, hw.read_cycle(cpu.regs.hl)),
            (dest, src) => {
                let val = cpu.regs.get_reg(src);
                cpu.regs.set_reg(dest, val)
            }
        }
    }
    

    This function copies the contents of the src "register" to the dest "register" (except when they're both actually memory addresses, then it runs the halt instruction).

    12 votes
  3. [10]
    mrbig
    (edited )
    Link
    I'm still a beginner, but, in this order: Python for the beauty, philosophy, practicality and community Example of switching values between variables in Python: a, b = b, a C for the small size,...

    I'm still a beginner, but, in this order:

    1. Python for the beauty, philosophy, practicality and community
    • Example of switching values between variables in Python:
    a, b = b, a
    
    1. C for the small size, simplicity, terseness and for forcing me to think through certain things

    2. Emacs Lisp because I can do a lot with it on Emacs without even really knowing it

    11 votes
    1. [3]
      eutrimonia
      Link Parent
      You're a beginner but know elisp? That's pretty interesting! I've been coding for years and use emacs (doom flavour) everyday and still haven't got around to learning elisp. I mean I know some of...

      You're a beginner but know elisp? That's pretty interesting! I've been coding for years and use emacs (doom flavour) everyday and still haven't got around to learning elisp. I mean I know some of the basics of the functional paradigm but to build an extension for emacs is something I've been thinking about.

      How'd you go about learning elisp? Do you have any suggestions on resources that you found useful?

      5 votes
      1. [2]
        mrbig
        (edited )
        Link Parent
        I'm less than a beginner. I'm just a master at googling and pattern recognition. I also found lots of help at /r/emacs, /r/orgmode and #emacs. Basically, I look at how something works and I mess...

        I'm less than a beginner. I'm just a master at googling and pattern recognition. I also found lots of help at /r/emacs, /r/orgmode and #emacs.

        Basically, I look at how something works and I mess with it. After a year using Emacs, I gained enough knowledge to make a bunch of configurations and "hacks" amounting to 3000 lines that could probably only serve for my own use. I am not a lisp programmer by any means.

        My suggestion: Emacs self-documenting nature is something you should definitely take advantage of. Master it, first of all. It should be second nature.

        If you wanna learn Elisp for real, ask @cadadr! (but the eintr seems good enough).

        6 votes
        1. cadadr
          Link Parent
          Eintr (Emacs Lisp Intro, it is part of Emacs' Info docs) is great and I do suggest it, but I learned most of my Elisp skills through writing my config and hacking Emacs' core libraries or third...

          Eintr (Emacs Lisp Intro, it is part of Emacs' Info docs) is great and I do suggest it, but I learned most of my Elisp skills through writing my config and hacking Emacs' core libraries or third party code. I'm a learn-as-you-go type, which is not efficient, but fun.

          2 votes
    2. [2]
      json
      Link Parent
      I guess Javascript can do the similar enough variable swapping as Python now because of array literals and destructuring. let [a, b] = [1, 2]; [a, b] = [b, a];

      I guess Javascript can do the similar enough variable swapping as Python now because of array literals and destructuring.

      let [a, b] = [1, 2];
      [a, b] = [b, a];
      
      2 votes
      1. mrbig
        Link Parent
        Similar, but it doesn’t beat Python’s intuitiveness. Python was created for non-programmers, and it still shows!

        Similar, but it doesn’t beat Python’s intuitiveness. Python was created for non-programmers, and it still shows!

        2 votes
    3. [4]
      Jimmy
      (edited )
      Link Parent
      People always use switching two variables as an example when discussing programming, but when would you ever need to switch two variables? I have literally never needed to do this. Edit: I just...

      People always use switching two variables as an example when discussing programming, but when would you ever need to switch two variables? I have literally never needed to do this.

      Edit: I just had to do this for the first time! I was working on some user interface where the user can swap the position of two items.

      1 vote
      1. [3]
        mrbig
        Link Parent
        IDK, it came up in algorithms class.

        IDK, it came up in algorithms class.

        3 votes
        1. [2]
          tommit
          Link Parent
          It's a very classic example for beginners, but hardly shows up in the real world. That being said, it's still a good example to demonstrate Python's power and simplicity!

          It's a very classic example for beginners, but hardly shows up in the real world. That being said, it's still a good example to demonstrate Python's power and simplicity!

          2 votes
          1. mrbig
            Link Parent
            Yeah, the class was actually in C, when I saw how to do it in Python it blew my mind because of how simple it was.

            Yeah, the class was actually in C, when I saw how to do it in Python it blew my mind because of how simple it was.

            1 vote
  4. [4]
    ras
    Link
    Python is my go to language when I need to solve a problem quickly.

    Python is my go to language when I need to solve a problem quickly.

    11 votes
    1. [3]
      mat
      Link Parent
      Solving problems in python these days is often just import solution problem.solve() Which is nice. I do love python for lots of reasons, and it's my go-to language as well. But I've had more fun...

      Solving problems in python these days is often just

      import solution
      problem.solve()
      

      Which is nice. I do love python for lots of reasons, and it's my go-to language as well. But I've had more fun in other languages. Fun isn't always the goal, of course.

      8 votes
      1. [2]
        ras
        Link Parent
        It's true. I really want to learn more C++ (or dive into Rust) but I haven't yet found a case where it leapt out at me as the right language.

        It's true. I really want to learn more C++ (or dive into Rust) but I haven't yet found a case where it leapt out at me as the right language.

        1 vote
        1. teaearlgraycold
          Link Parent
          Unless you want a job with C++ I'd recommend Rust over it any day for personal projects. I know Rust isn't the peak of static analysis, but coming from Ruby/Python/Javascript it's amazing.

          Unless you want a job with C++ I'd recommend Rust over it any day for personal projects. I know Rust isn't the peak of static analysis, but coming from Ruby/Python/Javascript it's amazing.

          2 votes
  5. cadadr
    Link
    For me, it is definitely Emacs Lisp, because it is at my fingertips all the time and I can use it to interactively build programs in Emacs that solve my immediate problems. Interactively building...

    For me, it is definitely Emacs Lisp, because it is at my fingertips all the time and I can use it to interactively build programs in Emacs that solve my immediate problems. Interactively building code makes it really easy. I tried and failed (bad API design, may retry) building an SSG recently, and the uninteractive way of building that I chose, namely TDD, was a big obstacle for me all the time. With Elisp, I can test parts of my function as I build the thing, so I generally don't need to test stuff afterwards. That's obviously bad for software that'll be collaboratively built or later distributed, but when it is your init.el, little programs just for you, this approach is way more productive.

    I'll use an example session to demonstrate this: imagine you have a buffer, and you're editing a function that acts on it. [] is where the cursor is at.

    (defun fn (buffer)
      (interactive)
      (with-current-buffer buffer[]
        (message (buffer-substring (line-beginning-position) (line-end-position)))))
    

    So, you want to test this with the buffer test.txt. You don't need the repl, and you don't need to copy stuff around. You also don't need tests and mock data. You just replace buffer on line 3 with (get-buffer "test.txt") and move to the end of the with-current-buffer expression

    (defun fn (buffer)
      (interactive)
      (with-current-buffer (get-buffer "test.txt")
        (message (buffer-substring (line-beginning-position) (line-end-position))))[])
    

    and hit C-x C-e to see what it does. If it works as expected, just undo with C-/ and evaluate the command with C-M-x: ready to go. And the effects of all this is immediately applied to your live environment, so you can immediately start using this stuff without restarting your program and/or losing any state. You can jump into core libraries or 3rd party code and just edit-eval-test until you have a working thing, then send a patch or save customisations to your init.el (i.e. override the functions). You can easily get help for functions, variables, etc. from the manual or the docstrings.

    This interactivity coupled with the Emacs platform makes for a great experience.

    10 votes
  6. [7]
    mat
    Link
    PHP. Fight me. :) Not any more, really. But I spent a long time writing websites (back when they were web sites, not web apps) and php was great, in it's heyday. The days when if you wanted a...

    PHP.

    Fight me. :)

    Not any more, really. But I spent a long time writing websites (back when they were web sites, not web apps) and php was great, in it's heyday. The days when if you wanted a framework you had to write it yourself. And I did, several times. I still use it here and there for the few small projects I'm involved with, because why do I need to mess about with Rails or Django or node or any of that stuff for my little brochure site? It feels a bit like driving a classic car - you have to be a bit careful otherwise something might explode or fall off if you go too fast, but it's all there, the foundations on which so much that came after was built on.

    10 votes
    1. [2]
      welly
      Link Parent
      I work with PHP and have gone from "This isn't Classic ASP! I love it!" to "What is this inconsistent, patchy shit?" to "You know what, PHP is pretty good these days" and it is.

      I work with PHP and have gone from "This isn't Classic ASP! I love it!" to "What is this inconsistent, patchy shit?" to "You know what, PHP is pretty good these days" and it is.

      6 votes
      1. cptcobalt
        Link Parent
        I totally agree. Most PHP dissenters are thinking of the 5.x era, not the 7.x era—PHP is extremely livable these days. It's not without its problems, but it feels pretty good to work in daily.

        I totally agree. Most PHP dissenters are thinking of the 5.x era, not the 7.x era—PHP is extremely livable these days. It's not without its problems, but it feels pretty good to work in daily.

        4 votes
    2. joeldare
      Link Parent
      I agree. I've used lots of languages and I like PHP the best; maybe only because it's where I have the most experience. It has its oddities, like different ordered arguments in some functions, but...

      I agree. I've used lots of languages and I like PHP the best; maybe only because it's where I have the most experience. It has its oddities, like different ordered arguments in some functions, but it's a fairly fast language, easy to deploy, and I find it a joy to use.

      I like the cgi execution style it uses where it just executes through your front end server. I don't love the extra complexity (however small) of other languages that run each program on its own port and then using a proxy to push traffic to those ports.

      From this comment it's probably clear, but I do mostly backend web development such APIs.

      2 votes
    3. [3]
      Somebody
      Link Parent
      You should check out Laravel.

      You should check out Laravel.

      1 vote
      1. mat
        Link Parent
        I've never met a framework I didn't very strongly dislike. Except my own, of course. They're all fun and games while you're doing stuff that the framework designers envisioned but every single...

        I've never met a framework I didn't very strongly dislike. Except my own, of course.

        They're all fun and games while you're doing stuff that the framework designers envisioned but every single time I've used one I've ended up running into problems because the things I want to do either aren't possible, or trip all sorts of problems that the designer didn't plan for. I once triggered a freakin' kernel bug from inside Django. On Debian STABLE. Cost me a fortnight of work of increasingly awful hacking, dicking about on LKML, in the end I ended up hiring one of Django's original devs and even he couldn't fix it. Had to rewrite a whole load of code to run in a different, and much, much slower, way. Awful.

        I am not a frameworks guy. I get they save a lot of time for a lot of situations but for me they've been nothing but trouble.

        3 votes
      2. cptcobalt
        Link Parent
        Hi! PHP die-hard here. I am not a Laravel person. I appreciate that it exists, but Laravel is very uncomfortably opinionated. I know that big frameworks are supposed to be better because more eyes...

        Hi! PHP die-hard here.

        I am not a Laravel person. I appreciate that it exists, but Laravel is very uncomfortably opinionated. I know that big frameworks are supposed to be better because more eyes have worked on and used the project, but it I can't help but feel that Laravel—the few times I've used it—forces me into design choices I'd never make myself. And, let me tell you, the core tenant of their project is not resist complexity.

        1 vote
  7. [3]
    markh
    Link
    If you want to change how you think about software development, give Erlang a try. It’s a really cool language that doesn’t get enough love. The syntax looks odd at first glance, but it’s actually...

    If you want to change how you think about software development, give Erlang a try. It’s a really cool language that doesn’t get enough love. The syntax looks odd at first glance, but it’s actually pretty simple and pretty great. Give it a try!

    10 votes
    1. mwksl
      Link Parent
      I’ve liked using Elixir a lot. I think it really “meshes” with how my brain thinks about data flows and software in-general. As (primarily) a node/react web developer, phoenix framework has really...

      I’ve liked using Elixir a lot. I think it really “meshes” with how my brain thinks about data flows and software in-general. As (primarily) a node/react web developer, phoenix framework has really gotten me out of a rut!

      2 votes
  8. [3]
    rmgr
    Link
    I work in C#/Net Core/JavaScript on a daily basis so I've come to like those languages but my favourite one for general dicking about on personal projects is Python. It just clicks with the way I...

    I work in C#/Net Core/JavaScript on a daily basis so I've come to like those languages but my favourite one for general dicking about on personal projects is Python. It just clicks with the way I think.

    8 votes
    1. [2]
      mjangle1985
      Link Parent
      I feel nearly the same way about C. C just makes sense to me.

      It just clicks with the way I think.

      I feel nearly the same way about C. C just makes sense to me.

      2 votes
      1. joeldare
        Link Parent
        Same. I don't have much opportunity to use it these days but it does work how I think. I used to love that the quick reference manual was something like 30 pages.

        Same. I don't have much opportunity to use it these days but it does work how I think. I used to love that the quick reference manual was something like 30 pages.

        2 votes
  9. pleure
    Link
    Haskell! I understand it's not the most practical language, but it's certainly changed how I look at computations and problem solving in general (for the better, I hope at least). In general I...

    Haskell! I understand it's not the most practical language, but it's certainly changed how I look at computations and problem solving in general (for the better, I hope at least).

    In general I suspect the whole world would be better if we went back in time and built everything in functional languages from the start.

    7 votes
  10. [7]
    Staross
    Link
    Julia, for multiple dispatch, performance and generally elegant design. It just feels more fun to code with it. If only they could magically fix the loading/compilation times.

    Julia, for multiple dispatch, performance and generally elegant design. It just feels more fun to code with it. If only they could magically fix the loading/compilation times.

    6 votes
    1. [2]
      poopfeast6969
      Link Parent
      I always found the vectorised stuff from MATLAB and numpy to be really cool. Especially in a high level language.

      I always found the vectorised stuff from MATLAB and numpy to be really cool. Especially in a high level language.

      2 votes
      1. Staross
        Link Parent
        What's great with Julia is the you are not forced to vectorize your code for performance, so when it makes sense or you feel like it you can just write for loops. You can also use a more...

        What's great with Julia is the you are not forced to vectorize your code for performance, so when it makes sense or you feel like it you can just write for loops. You can also use a more functional style without penalties, so it's quite freeing.

        I love the broadcast syntax too:

        julia> (x->x^2).(1:8)
        8-element Array{Int64,1}:
          1
          4
          9
         16
         25
         36
         49
         64
        
        3 votes
    2. [2]
      cadadr
      Link Parent
      What do you use it for? I'm keen on learning some statistics in the coming months, and if you use it for stats, would you suggest it over R or Python?

      What do you use it for? I'm keen on learning some statistics in the coming months, and if you use it for stats, would you suggest it over R or Python?

      2 votes
      1. Staross
        (edited )
        Link Parent
        I use it for scientific computing mostly, biology, statistics, machine learning, etc. I think it's better than R for statistics, for example if you want to compute the density of a Poisson...

        I use it for scientific computing mostly, biology, statistics, machine learning, etc.

        I think it's better than R for statistics, for example if you want to compute the density of a Poisson distribution at the value x you do:

        pdf(Poisson(5), x)
        

        At value 0 to 100:

        pdf.(Poisson(5), 0:100)
        

        If you want to take the quantile your do:

        quantile(Poisson(5), q)
        

        If you want to fit it to data you do:

        fit(Poisson, data)
        

        Integrate it between 0 and 100:

        sum(pdf(Poisson(5),k) for k in 1:100)
        

        You can probably guess how you draw random numbers from a Normal. In R you have your dpois (or ppois, I never remember which is which), qpois methods and a plethora of function with random names that don't compose into anything,

        Scipy is nicer than R (being object oriented), but it's also pretty slow, so doing your own sampling, optimization or integration can be a pain.

        You can check this too:

        https://people.smp.uq.edu.au/YoniNazarathy/julia-stats/StatisticsWithJulia.pdf

        3 votes
    3. [2]
      Nmg
      Link Parent
      I used Julia for a Semiconductor Device Simulation class and had a lot of fun with it. I certainly think my code was more performant than my classmates who used Matlab, however I basically could...

      Julia

      I used Julia for a Semiconductor Device Simulation class and had a lot of fun with it. I certainly think my code was more performant than my classmates who used Matlab, however I basically could only use it in a Jupyter Notebook because otherwise loading my packages would take half a minute....

      If they could fix that issue, my workflow would basically be divided into:

      • Julia, for when I need things to run fast
      • Python for everything else
      2 votes
      1. Staross
        Link Parent
        Yeah you have to leave your session open, you can't reload things each time.

        Yeah you have to leave your session open, you can't reload things each time.

        2 votes
  11. mbc
    Link
    C, because I can keep its syntax in my head. Also, it just makes sense to use C in my most-used operating system, OpenBSD. I like the "close to the operating system" feel.

    C, because I can keep its syntax in my head. Also, it just makes sense to use C in my most-used operating system, OpenBSD. I like the "close to the operating system" feel.

    6 votes
  12. [2]
    Tygrak
    Link
    Probably C#, it just feels right. Every time I look at different languages I end up wishing the syntax and everything was more like C#. I used to like Dart, because it can be transpiled to JS,...

    Probably C#, it just feels right. Every time I look at different languages I end up wishing the syntax and everything was more like C#. I used to like Dart, because it can be transpiled to JS, which means I can use it to replace JS and do some fun stuff like making games in the browser from scratch in the HTML5 canvas, but Dart feels a bit dead for this use now. Also Dart is really similar to C#, that's probably why I liked it in the first place.

    I also don't like Google, which is definitely a good reason not to like a language... especially considering C# is Microsoft haha.

    6 votes
  13. [3]
    lobtask
    Link
    Some of the most enjoyable programming experiences I have ever had is in Golang. While the language is simple (no generics or fancy error handling), I haven't ran into a case where either are...

    Some of the most enjoyable programming experiences I have ever had is in Golang. While the language is simple (no generics or fancy error handling), I haven't ran into a case where either are explicitly needed. Once I am done writing the code, the program feels robust. It has replaced any of my Python or Node.js development entirely. With that said, I think Rust takes the cake. Rust had a steep learning curve for me. For a long time, I was running into errors with the borrow checker left and right. But after enough time, I truly believe that Rust has forced me to be a more cognizant programmer.

    6 votes
    1. [2]
      stu2b50
      Link Parent
      In my experience, the lack of generics (+ no function overloading) hurts. You can even see it in the standard library. There is no function in Go to take the max of two integers. Because max only...

      In my experience, the lack of generics (+ no function overloading) hurts. You can even see it in the standard library.

      There is no function in Go to take the max of two integers. Because max only takes in floats, they didn't want to clutter the std with max_int, and no generics.

      You're actually supposed to write the max or min function yourself every time you need to use it. In fact, in the standard library's sorting implementation, it does. Whhhyyyyyyyyy

      1 vote
      1. Diff
        Link Parent
        Generics are on their way.

        Generics are on their way.

  14. [6]
    stu2b50
    Link
    All of the ML languages. Though, in terms of viability F# takes the cake for having access to the .net ecosystem, as opposed to ocaml's fairy lackluster one. Kotlin and typescript have good typing...

    All of the ML languages. Though, in terms of viability F# takes the cake for having access to the .net ecosystem, as opposed to ocaml's fairy lackluster one.

    Kotlin and typescript have good typing systems and the modern features you'd expect from a modern language. They solve some of the uglyness of their base platform's language (i.e you can free functions in Kotlin, no === in TS, sane scoping rules in TS, etc.)

    Rust is nice for being an actual systems language with the taste of modernity (and without C++17+'s cruft, and a real module system)

    5 votes
    1. [2]
      json
      Link Parent
      My favourite is the HT one. HTML

      All of the ML languages.

      My favourite is the HT one.

      HTML

      6 votes
      1. vivaria
        Link Parent
        For anyone like me who read this and was confused at what ML meant in this context: stu2b50's ML: "Meta Language" (see here: https://en.wikipedia.org/wiki/ML_(programming_language)) json's ML:...

        For anyone like me who read this and was confused at what ML meant in this context:

        4 votes
    2. [3]
      Bauke
      Link Parent
      Wait... what? Is that a typo? Or, can you explain?

      no === in TS

      Wait... what? Is that a typo? Or, can you explain?

      1. [2]
        Elronnd
        Link Parent
        In javascript, == performs a type-weak comparison, so—for instance—5 == "5" is true, which is obviously undesirable. So === was introduced, which does what you actually want 99% of the time. In...

        In javascript, == performs a type-weak comparison, so—for instance—5 == "5" is true, which is obviously undesirable. So === was introduced, which does what you actually want 99% of the time. In typescript, == always does the sane thing so you don't need ===.

        2 votes
        1. Bauke
          Link Parent
          Interesting, I kind of shudder at the thought of using == though since if you're dealing with any TS won't detect it and will just let 5 == "5" through without issue. I'll stick with my triple...

          Interesting, I kind of shudder at the thought of using == though since if you're dealing with any TS won't detect it and will just let 5 == "5" through without issue. I'll stick with my triple equals though. Thanks for explaining!

          3 votes
  15. [11]
    Bishop
    Link
    You tell people that you can build a backend API, construct your database, build your frontend web app, build an accompanying mobile app, and build a desktop app within the same language...

    You tell people that you can build a backend API, construct your database, build your frontend web app, build an accompanying mobile app, and build a desktop app within the same language environment.

    They go crazy.

    Tell them it’s JavaScript.

    jAvA iS mORe eFfiCIenT aNd Js dUm.!! 👿👿

    (Not arguing that JS is more efficient than Java because that’s obviously not the case. Just think the rampant JS hate is funny.)

    5 votes
    1. [7]
      cfabbro
      Link Parent
      To be fair, when 90% of the web is a bloated mess of unnecessary, obtrusive and privacy invading JS... is it really all that surprising that people have projected their hatred of that aspect of it...

      To be fair, when 90% of the web is a bloated mess of unnecessary, obtrusive and privacy invading JS... is it really all that surprising that people have projected their hatred of that aspect of it onto the language itself?

      9 votes
      1. [2]
        mjangle1985
        Link Parent
        We can hate both Java and JS.

        We can hate both Java and JS.

        8 votes
        1. banned
          Link Parent
          Clearly, CSharp is superior.

          Clearly, CSharp is superior.

          5 votes
      2. Wes
        Link Parent
        Hey we could all go back to allowing VBScript in webpages. Then maybe people will lay off on JavaScript.

        Hey we could all go back to allowing VBScript in webpages. Then maybe people will lay off on JavaScript.

        3 votes
      3. [3]
        Bishop
        Link Parent
        Eh. If you eat Chipotle food 5 times and get E. coli 5 times; is it the fault of Chipotle or Mexican food? Sure people use JavaScript to do shitty things, but that’s not JavaScript’s fault; nor...

        Eh.

        If you eat Chipotle food 5 times and get E. coli 5 times; is it the fault of Chipotle or Mexican food?

        Sure people use JavaScript to do shitty things, but that’s not JavaScript’s fault; nor does that take away from its incredible capabilities as a language, which is mostly what I was speaking towards.

        2 votes
        1. teaearlgraycold
          Link Parent
          There are some good things going on with Javascript. I've read through "The Good Parts" and learned to appreciate some of the language design - but there's a lot more to a language than just...

          There are some good things going on with Javascript. I've read through "The Good Parts" and learned to appreciate some of the language design - but there's a lot more to a language than just language-level features. Without a standard library you go from a neat little LISPy C-syntaxy language to the shitshow we have today.

          3 votes
        2. cfabbro
          Link Parent
          I never said it was... but projection need not be (and rarely is) logical. I was simply explaining why it's not really surprising that people hate it, even though that hatred may be largely...

          but that’s not JavaScript’s fault; nor does that take away from its incredible capabilities as a language

          I never said it was... but projection need not be (and rarely is) logical. I was simply explaining why it's not really surprising that people hate it, even though that hatred may be largely undeserved and misplaced.

    2. slambast
      Link Parent
      I spent a year doing full-stack (mostly back-end) development in JS/node. I gotta say, I totally get the hate. It definitely has interesting parts, and it allows for some crazy tinkering, which...

      I spent a year doing full-stack (mostly back-end) development in JS/node. I gotta say, I totally get the hate. It definitely has interesting parts, and it allows for some crazy tinkering, which can be cool. However, when you combine the dependency-happy ecosystem (so many packages!) with a remarkably flexible language, you get a whole lot of weirdness...

      On top of that, there are some features of the language design that result in a lot of unpredictable, inconsistent behavior. Things like arrow functions, ==, and || come to mind (and don't get me started on this!).

      The fact that you can do stuff like this is cool...

      // api.js
      export default new Proxy({}, {
        get(_, method) {
          return message => axios.get(`${process.env.API_URL}/${method}`)
        },
      });
      
      // app-or-something.js
      import api from './api';
      await api.users(); // performs an HTTP GET on api-url.example.com/users
      

      ...but I don't really want to be able to do things like that in "important" code; it's unclear, fragile, and will throw off every linter in existence AFAIK.

      I don't want to pick on anyone for liking JS (I even enjoy using it sometimes), but it does have some issues that go beyond being inefficient.

      2 votes
    3. [2]
      cadadr
      Link Parent
      Isn't the inverse the case today? I hear that V8 is one of the fastest VMs out there, and what I've encountered up until today makes me feel like good JS can easily be faster than Java. I haven't...

      (Not arguing that JS is more efficient than Java because that’s obviously not the case.

      Isn't the inverse the case today? I hear that V8 is one of the fastest VMs out there, and what I've encountered up until today makes me feel like good JS can easily be faster than Java. I haven't done/looked at any benchmarks or comparisons tho.

      1 vote
  16. [5]
    Anwyl
    Link
    I'm a big fan of java for collaborative stuff, and scala for non-collaborative stuff. Java seems to make good designs easier to communicate and keep when you have multiple people working on a...

    I'm a big fan of java for collaborative stuff, and scala for non-collaborative stuff.

    Java seems to make good designs easier to communicate and keep when you have multiple people working on a project. It also has a huge number of good libraries (and a huge number of bad ones, but...).

    Scala lets me program in a functional world without losing access to those libraries. I wouldn't want to expose some of the horrors I've created in functional land to others, but you can make some really "clever" syntax with it...

    5 votes
    1. [4]
      izik1
      Link Parent
      Hey, if you like Java, you might also like Kotlin! Kotlin is similar to Java and also runs on the JVM. It's kind of similar to Java, but has learned from some of the pain points. It also has a...

      Hey, if you like Java, you might also like Kotlin! Kotlin is similar to Java and also runs on the JVM. It's kind of similar to Java, but has learned from some of the pain points. It also has a whole bunch of nifty stuff in it as well that makes it quite the joy to program in. (I keep finding myself missing when in other languages)

      5 votes
      1. [2]
        Anwyl
        Link Parent
        I think the main reason kotlin's come up on my radar in the past has been when looking at ways to write code once and release on iOS/android/web/other, but I wasn't in a position to make language...

        I think the main reason kotlin's come up on my radar in the past has been when looking at ways to write code once and release on iOS/android/web/other, but I wasn't in a position to make language decisions on that project. It does seem like a nice one though.

        2 votes
        1. izik1
          Link Parent
          Ah, my job seems very keen to use the best tool for the job, even if that means I get to learn the tool on the job (thanks boss, not even joking, I'm very grateful for this). But I've learned both...

          Ah, my job seems very keen to use the best tool for the job, even if that means I get to learn the tool on the job (thanks boss, not even joking, I'm very grateful for this). But I've learned both Kotlin and more recently Dart (for flutter). Flutter is pretty nice for building once for Android/iOS/web for the most part and has other OS' in the works. But it's fairly young and I've had bugs with both Flutter itself and libraries using it before (not on stable, but on the other hand, I've needed to use something other than flutter stable in production).

          2 votes
      2. feigneddork
        Link Parent
        I was scanning this thread to find my two favourite languages. Kotlin in recent months has completely won me over. I've been writing a lot of code in Kotlin and the following has really won me...

        I was scanning this thread to find my two favourite languages. Kotlin in recent months has completely won me over.

        I've been writing a lot of code in Kotlin and the following has really won me over:

        • Encouraging immutability. If you've ever had to design a system with concurrency in mind, you'll realise how much of a headache it is, and how much of that headache stems from mutable objects. Immutability is an absolute godsend which forces you to think of your object in a fixed state, and if you want to "mutate it" in Kotlin, you just use the .copy( innerVariableToChange = value ) to create a new object with just the value of innerVariableToChange replaced
        • As you mentioned, when is so good
        • Smart casting, just such an obvious thing to include in the language
        • Stupid easy ways to iterate over lists/maps
        • data class are the best things that any business minded programming language has ever came up with
        • The sneaky way it includes elements of functional programming - you can probably see some of it above, but it never flat-out forces you to write in a functional way like Scala does. That way you can have your bland methods that process a CSV and then you have your core data processing classes written in a pure functional programming way with tailrec in the method so you can avoid all the obvious tail recursion pitfalls that exist in other languages.

        It really is such a nice little language, and I've recently bought the 'Kotlin In Action' book which has exposed me to some other clever little tips and tricks I could use in Kotlin as well as explaining how it was achieved in Java.

        I mean, Java is cool and good and is really my first real grown up language that I've coded in over 8 years, but Kotlin is Java just smoothed out as well as some other stuff built into the language which I'd have to add some Apache/Guava library to achieve the same thing in Java. I cannot recommend it enough!

        2 votes
  17. [2]
    Netzakh
    Link
    Lua. The main reason is that most of Tales of Maj'Eyal is written in it. My favourite feature is Lua tables as the universal way to structure data.

    Lua. The main reason is that most of Tales of Maj'Eyal is written in it.

    My favourite feature is Lua tables as the universal way to structure data.

    5 votes
    1. mrbig
      Link Parent
      Upvoting for patriotic reasons ;)

      Upvoting for patriotic reasons ;)

      2 votes
  18. bogdan
    Link
    Racket for the sheer amount of thought and engineering that has gone into it. The community is wonderful and the standard library is feature-packed but consistent. Everything is well documented...

    Racket for the sheer amount of thought and engineering that has gone into it. The community is wonderful and the standard library is feature-packed but consistent. Everything is well documented and cross-platform-ness is heavily emphasized (this is also a minus in certain cases, because to do platform-specific stuff (eg. fork(2)) you need to either use the ffi or use an external package). It's also consistently among the fastest dynamic programming languages out there.

    5 votes
  19. zaarn
    Link
    Two in fact. First, LISP. Not elisp but classical (or Common) LISP. That language really moved the computing world ahead by decades, you can look it up; on LISP based computers people invented...

    Two in fact.

    First, LISP. Not elisp but classical (or Common) LISP. That language really moved the computing world ahead by decades, you can look it up; on LISP based computers people invented networking, GUI, laser printers, the computer mouse and much more. I believe that everyone should learn LISP. Not to program in it, but to understand it. There is always the moment when you really get LISP and learn a new way to think about programming in general.

    Second is Rust. Although it's macros are not as powerful as LISP's, it has some other advantages. I really enjoy how it makes most of what I type an error so I can fix it before I deploy it! Though on the other hand, I also ran into compiler bugs, which put a project of mine on hold for almost half a year by now until they get a newer LLVM merged.

    5 votes
  20. [2]
    suspended
    Link
    It was classic ASP and ASP.NET. Now that I've been introduced to Python by people here on Tildes I'm starting to get attached to it.

    It was classic ASP and ASP.NET. Now that I've been introduced to Python by people here on Tildes I'm starting to get attached to it.

    4 votes
    1. welly
      Link Parent
      Classic ASP! I did about 7 years of that. Loved it for the first 3 or 4 years as it was the start of my career. Couldn't wait to do something entirely different after then. The last 3 or 4 years...

      Classic ASP! I did about 7 years of that. Loved it for the first 3 or 4 years as it was the start of my career. Couldn't wait to do something entirely different after then. The last 3 or 4 years of working with ASP almost killed me.

      1 vote
  21. switchy
    Link
    I work with Fortran most frequently, so I guess my favourite is anything but that? I like C++ and OCaml quite a bit, and I'm a fan of Go because of its fairly simple (and well-enforced) syntax and...

    I work with Fortran most frequently, so I guess my favourite is anything but that? I like C++ and OCaml quite a bit, and I'm a fan of Go because of its fairly simple (and well-enforced) syntax and tooling.

    As far as languages I thought would be more of a favourite, I'd have to nominate the lisps. I like them in theory, but I've never managed to actually implement a real world project (other than some Advent of Code problems in Picolisp I guess)

    4 votes
  22. starchturrets
    Link
    Javascript, because it’s also the only programming language I know.

    Javascript, because it’s also the only programming language I know.

    3 votes
  23. [3]
    Ephemere
    Link
    It's fairly unpopular these days, but I prefer perl5 for pretty much all of my home programming needs. This is in part because I've been using it professionally for the last fifteen years, but...

    It's fairly unpopular these days, but I prefer perl5 for pretty much all of my home programming needs. This is in part because I've been using it professionally for the last fifteen years, but even in that span I haven't really seen terribly much of the 'write only coding' which it's famous for.

    I've been taking some halfhearted efforts to switch to python or nodejs in order to stay in the mainstream of languages with available useful modules, but so far it hasn't seemed to be to an extreme benefit. I guess I'll have to switch someday, but so far it's been treating me quite well.

    3 votes
    1. [2]
      cadadr
      Link Parent
      Perl 5 is beautiful. I have used it to write some essential scripts (e.g.) for my config, and it is the best tool for that. For larger programs, it is harder to use, tho. I'm not really fond of...

      Perl 5 is beautiful. I have used it to write some essential scripts (e.g.) for my config, and it is the best tool for that. For larger programs, it is harder to use, tho. I'm not really fond of how OOP is done in Perl 5, writing classes looks hard and unnatural.

      1 vote
      1. Ephemere
        Link Parent
        I certainly respect that as an opinion, though the code base I work with professionally is fairly large and object oriented. As far as I can tell the only real downside is that you can't have...

        I certainly respect that as an opinion, though the code base I work with professionally is fairly large and object oriented. As far as I can tell the only real downside is that you can't have private members or data. That said, sometimes dipping into the object you're using has been pretty handy, even as I understand it to be not best practice.

        Of course, I don't have a ton of experience with other languages, the largest codebase I'm otherwise familiar with is probably only ~5KLOC or so.

        2 votes
  24. [2]
    Don_Camillo
    Link
    Can i ask a kind of offtopic question? I'm really surprized that nobody mentioned rust. I feel that if this thread would be a year or two ago it would have been mentioned more than once. Was it...

    Can i ask a kind of offtopic question?
    I'm really surprized that nobody mentioned rust. I feel that if this thread would be a year or two ago it would have been mentioned more than once. Was it just a hype? Or is it just not as beloved as i percieved it was?

    3 votes
    1. stu2b50
      Link Parent
      There are at least two posts which mention rust. In general, it's a somewhat niche language. Not everyone works in systems/embedded, and for those that do many still must work in C, whether that...

      There are at least two posts which mention rust. In general, it's a somewhat niche language. Not everyone works in systems/embedded, and for those that do many still must work in C, whether that be for legacy reasons or just compatibility. For those that do not, oftentimes a GC just makes life easier.

      6 votes
  25. mftrhu
    Link
    I write code in a lot of languages, but my favourite is definitely Python. Not because it's particularly beautiful, but because it's straightforward and it makes solving most problems easy, even...

    I write code in a lot of languages, but my favourite is definitely Python. Not because it's particularly beautiful, but because it's straightforward and it makes solving most problems easy, even when ignoring all the third-party libraries available for it. If it had a decent standard library, Lua would fill the same niche for me, "arrays start at 0" be damned.

    If anything, I find shell - not full-fledged scripts, just one-liner pipelines - more elegant, more aesthetically appealing. But I don't really use languages for their aesthetic: I appreciate it more when they can make things simple. Python does that (but then, so do awk, shell, and make - in their own niches).

    (bad/weird syntax, in any case, doesn't deter me much - writing boilerplate does, but not bad syntax)

    3 votes
  26. [2]
    Micycle_the_Bichael
    Link
    This feels like a copout shitty answer. My favorite programming language right now is Python 2.7. Why? Because it comes pre-installed on all CentOS servers which means I can finally stop writing...

    This feels like a copout shitty answer.

    My favorite programming language right now is Python 2.7. Why? Because it comes pre-installed on all CentOS servers which means I can finally stop writing scripts in bash for server monitoring. I fucking hate bash. There are no amount of tutorials that will get that language to click with me it seems. Which isn't to say bash is a bad language. It is to say it is a bad language for me and since 100% of my programming is for work, my favorite language is the one that makes work less frustrating for me. Once there is a CentOS version that comes with python3 natively and we move all our servers to that, then python 3 will probably become my favorite language.

    I don't really care directly about the beauty of python or anything about python itself, just how it compares to my other options (bash). I use to work in C# and java and thought they were equally as good of languages as Python, but I don't have to work with those anymore so I don't care about them now.

    3 votes
    1. cadadr
      Link Parent
      Shell scripting is a horrible experience. I generally script in Posix Shell for my scripts, and while there are advantages to that (easily piping processes together), I'm not a fan of the...

      Shell scripting is a horrible experience. I generally script in Posix Shell for my scripts, and while there are advantages to that (easily piping processes together), I'm not a fan of the experience of writing them.

      If only there was a standard way to do it in a more proper programming language, nearly as ubiquitous as the (ba)sh...

      5 votes
  27. kdtsh
    Link
    Honestly, Java. Sure, it's what I use day-to-day at my place of work (work is work, whatever you do you learn to play nice with the shop tools). And really, it's probably more the ecosystem that I...

    Honestly, Java.

    Sure, it's what I use day-to-day at my place of work (work is work, whatever you do you learn to play nice with the shop tools). And really, it's probably more the ecosystem that I love - Eclipse, Maven, Jenkins, Artifactory. But I've always found it so pleasant to work with (or really, I'm just very comfortable working in it). It's got a library for everything I need. It's got great build tools. It's got great IDEs. It runs everywhere. It's open source if I want it to be. Some people think that it's too verbose, but I think the verbosity is just about right. I really like class-based programming, and Java does too.

    There are some things that bug me about it of course. The way Java does access control is a bit silly sometimes. I'm fond of interpreted languages and Java isn't one of them. The only things that really make me sad about Java are type erasure and lack of multiple inheritance. But these things have never been enough for me to really jump ship.

    3 votes
  28. [7]
    Somebody
    Link
    PHP. For realz. I've never understood why people give it so much hate. It's always felt unjustified to me.

    PHP. For realz.

    I've never understood why people give it so much hate. It's always felt unjustified to me.

    2 votes
    1. [6]
      aphoenix
      Link Parent
      There are so many good reasons to not love PHP. Most of them come back to this article: PHP: A fractal of bad design. It's 2019 now, and this article is 7 years old. If we were to explore it in...

      There are so many good reasons to not love PHP. Most of them come back to this article: PHP: A fractal of bad design.

      It's 2019 now, and this article is 7 years old. If we were to explore it in detail we would find that some of the specific examples have been fixed, but at the core, the article still has a lot of good points, and it comes down to this sentiment, which I've made as brief as possible:

      A good programming language should be predictable, consistent, concise, reliable, and debuggable; PHP struggles with each of these.

      It is important to note that for each of these five pillars of languages, PHP has made improvements in the last 7 years since this article was written, but because of these issues people had already begun to move away from PHP as their core language and considered other things. The big bonus of PHP was its ubiquity, and it no longer has that bonus over other languages; it's trivial to acquire whatever hosting you want, and it's just as cost effective to do things with a "good" language as it is to do things with PHP.

      Long story short - PHP was a standard because it was available everywhere you wanted to host things, but that edge no longer exists, so now that we consider the other reasons we have to use a language, PHP is just generally not a particularly good choice. It's not necessarily a bad choice, though! It's certainly possible to do great things with it.

      2 votes
      1. [5]
        Somebody
        Link Parent
        You sound like someone that hasn't tried PHP7.

        You sound like someone that hasn't tried PHP7.

        1. [4]
          aphoenix
          (edited )
          Link Parent
          Honestly, that response makes you sound like somebody who didn't read a thing I said, since I explicitly stated in my comment that PHP has made improvements in the last 7 years, and I even...

          Honestly, that response makes you sound like somebody who didn't read a thing I said, since I explicitly stated in my comment that PHP has made improvements in the last 7 years, and I even stipulated that most of the examples in the article linked have been fixed. How would I make that statement if I hadn't used PHP7? This doesn't make PHP7 good, by the way, it just makes it less shit than earlier PHP.

          Other than Javascript (which is hands down the worst language) every other major popular language is at least as good, if not better, than PHP7.

          3 votes
          1. [3]
            cadadr
            Link Parent
            Is there a good "fractal of bad design" article out there for JS? Wat is close, but it is not as detailed.

            Is there a good "fractal of bad design" article out there for JS? Wat is close, but it is not as detailed.

            4 votes
            1. [2]
              aphoenix
              Link Parent
              Not that I know of, unfortunately. Hmm... maybe I should write one.

              Not that I know of, unfortunately.

              Hmm... maybe I should write one.

              1 vote
              1. cadadr
                Link Parent
                Would love to read if you do!

                Would love to read if you do!

                2 votes
  29. whism
    Link
    So hard to choose! But right now my favorite is a language I'm building. It is a scheme-like with unhygienic macros, smalltalk-like messaging facility, delimited continuations, built-in graphics...

    So hard to choose! But right now my favorite is a language I'm building. It is a scheme-like with unhygienic macros, smalltalk-like messaging facility, delimited continuations, built-in graphics via SDL, and (working on this part now) a PEG-like facility to extend the surface syntax, similar to OMeta. I'm certainly having a lot of fun working on it!

    1 vote