New programming language?
April 1, 2021 3:43 PM   Subscribe

I've been using Python for my day-to-day work for 15+ years. I want to learn something new, mostly for fun and to stretch a little. What new programming language should I learn?

I'd like something that's cool, different enough from Python so it's not just learning new syntax, and maybe has some sort of semi-practical application down the road.
Not interested in applying for jobs, interviews, etc., this is from a hobbiest perspective.
I don't have a formal CS education. I know Python fairly well, and enough JavaScript (and jQuery) to get by. I cut my teeth on Basic (and a tiny bit of Assembler) on a ZX81 and later a C64. I did some things with AutoLisp and ActionScript back in the day. I've dabbled in Ruby and Processing.
I make music, so if it's something that could be applied to that, that would be extra interesting.
posted by signal to Computers & Internet (25 answers total) 20 users marked this as a favorite
some stuff I've been either trying to learn or has been sitting on my to-do list:

- working through this online book on using Racket (modern lisp-like language) to build domain-specific programming languages
- I taught myself some Dyalog APL (array-based language which uses mysterious custom sigils instead of ascii keywords) with this book just because I loved the weird alien aesthetics of it
- in the opposite direction, I keep meaning to try out Rust because I don't have a ton of practical experience managing data types and memory and it seems like it has a decent user community
posted by theodolite at 3:55 PM on April 1 [1 favorite]

Coming from a Python data science day job perspective, I can say that I've had my eye on learning more Go (for engineering) or Julia (for scientific computing).
posted by supercres at 3:58 PM on April 1 [3 favorites]

You can try Rust, a systems programming language that has some interesting concepts related to memory and safety. It's similar to C++ except it doesn't have all the bloat, it is way more strict about what it lets you do but at the same time it is more modern. It has an npm like package manager for instance.

Otherwise, you can try Elixir which is Erlang with Ruby/Python like syntax. If you want to learn about everything related to concurrency and distributed programming, that is the language to look at. It's also functional programming, so there are no classes or imperative programming stuff.

Finally, if you want to stick to more of the same go with Java. It's not quite Python, I'd say it's a little more complex but there's a lot to do with it and it's easy to get into.
posted by Tarsonis10 at 3:59 PM on April 1 [4 favorites]

Rust is getting traction in bioinformatics, keeping most of the performance benefits of C, while ditching some of the technical issues.
posted by They sucked his brains out! at 4:09 PM on April 1 [1 favorite]

I'm a Python developer (long time one). Two languages I've learned recently that I really enjoyed, coming from a Python perspective, were Go and Rust.

Go felt very familiar to me: it's basically "C if C was more like Python". It took me a matter of just a few days to get comfortable. It's very fast, has a good standard library, and is a really nice general-purpose programming language. I could see using it in the future for a few places where Python isn't as good.

Rust, on the other hand, was quite difficult to pick up. It's a "big" language: lots of syntax, lots of features. Coming from Python, that feels disorienting. It also has a very unusual approach to memory management (the ownership/borrow model) which was hard to learn. I spent two weeks, 40+ hours a day, with Rust, and still wasn't fully comfortable. But I did stick with it, and got there eventually, and I'm glad I did. It's also a language I'll probably use. I sometimes do work with security implications, and Rust eliminates a massive class of vulnerabilities that plague other compiled languages. It's also fast as fuck, almost unbelievably so. The ecosystem is great (Cargo is, hands down, the best package manager that any language has). And, PyO3 lets you write Python extensions in Rust instead of C, which I could see being terrifically useful.

So, I can recommend them both. Go is easy to learn, and moderately valuable, I think. Rust is much harder to learn, but also more valuable.
posted by dorothy hawk at 4:09 PM on April 1 [5 favorites]

I'm also a no-CS-degree developer. I've been swimming in Python, PHP, and JavaScript for as long as they've existed. In a deliberate attempt to try something really different, I recently dove into Common Lisp, and it's been the most educational experience I've had in years. What I've learned has fundamentally changed the way I think about writing code -- in any language.

If you start reading Steve Losh's A Road to Common Lisp and find yourself intrigued, keep reading, because he goes on to provide a ton of pointers for getting started, and the books he recommends are extremely good. Like mind-expandingly good.

Common Lisp probably won't ever land me a job, but learning it has made me a significantly better coder.
posted by /\/\/\/ at 4:33 PM on April 1 [4 favorites]

>> ... this is from a hobbiest perspective.
>> I make music, so if it's something that could be applied to that, that would be extra interesting.

Max is a visual programming language for manipulating audio in fun ways.
posted by JohnFredra at 4:47 PM on April 1 [6 favorites]

I have friends who swear by Clojure, a Lisp dialect that runs on the Java runtime. If you’re at all interested in Lisp, this might be a good choice.

ETA: these friends do generative visual art, so it might be up your alley, though I have no knowledge of its support for music-related things.

ETA2: apparently there is a lot of support for music-related develooment.
posted by sjswitzer at 4:48 PM on April 1 [1 favorite]

You might also dig Sonic Pi, a live-coding music programming language.
posted by scruss at 4:59 PM on April 1 [2 favorites]

Came to suggest several of the previous suggestions, so as not to be repetitive, one I've looked at slightly, Julia, seems to be growing in the science/data niches. Performance oriented so could be a good match for sound processing.
posted by sammyo at 5:05 PM on April 1 [2 favorites]

MAX's less-popular but open source cousin in the world of music and sound programming is Pure Data.
posted by sibilatorix at 5:08 PM on April 1 [5 favorites]

Came here to mention Pure Data too.

LilyPond is awesome, if you're in to notation markup languages and are interested in traditional music writing/arranging. It started as a LaTeX project but is now its own thing. The syntax for doing things like arbitrarily tied eighth notes is fun; using what at first appeared to be mismatched/non-nested delimiters. But that's what's necessary! The output is beautiful and you can also generate midi with it etc. I use a front end called Frescobaldi on OSX, I think there's a few others too.
posted by SaltySalticid at 5:24 PM on April 1 [2 favorites]

If you're looking for something different and fun and easy to get started with, consider giving elm a try.

from wikipedia with edits:
Elm is a purely functional language for creating web browser-based graphical user interfaces. Elm is developed with emphasis on usability, performance, and robustness and advertises "no runtime exceptions in practice".
posted by metadave at 5:43 PM on April 1

Elixir is fun, and it's an interesting shift to get your head around a functional programming language.
posted by Ragged Richard at 5:53 PM on April 1 [1 favorite]

Have you ever dipped a toe into learning assembler? It is entirely impractical, but will give you a lot of insight into what's happening at the lowest level inside the machine.
posted by heatherlogan at 6:05 PM on April 1 [1 favorite]

scruss: "You might also dig Sonic Pi, a live-coding music programming language.

Great answers everybody! However, I'm in love with Sonic Pi!
posted by signal at 6:16 PM on April 1 [1 favorite]

Given that you're coming from Python, I think that your next language should be something either more systems-y or more purely functional.

I was all set to jump on the Rust train, until I got to your last point about making music.

You might be interested in the Haskell School of Music. I haven't actually worked through this book myself, but I've heard good things about it. I've only dabbled in Haskell, but it makes my brain happy and is pretty dramatically different from Python.
posted by Metasyntactic at 6:44 PM on April 1 [1 favorite]

Came here to see if people were talking about music programming languages. I see the big ones have been hit, EXCEPT Super Collider. I’m familiar with it because of how well it works with Lua when running on Raspberry Pi-based stuff, like the monome norns shield.

That said, most of the Python and Perl devs I know also write Go nowadays.
posted by sleeping bear at 8:11 PM on April 1 [2 favorites]

The top thing I would recommend (to pretty much everyone in this thread!) is the Programming Languages course on Coursera. This is a metacourse about reasoning about computation. It's quite abstract and theoretical, and it happens to use a language that you will probably never use in the real world and it encourages programming in a functional style to a degree that is not done outside academia. But it will rewire your brain, make you a better programmer, and make you better equipped to understand the designs and strengths/weaknesses of all programming languages. He starts the course with a very clear motivation and set of goals, so you'll quickly find out if it's not for you. And if you like it, then you can follow up with a real-world functional language (e.g. Haskell) or revisit Python with the functional style in mind.

But if your goal is to learn technologies that allow you to make fun projects and get good jobs, the answer is probably to take the bit of JavaScript you know and turn it into a more complete understanding of the JavaScript ecosystem: the browser, node, bundle/transpile tools, frontend frameworks like React and Svelte, etc. There's a lot to learn, and the JavaScript programming language is maybe 5% of it. I'm not going to tell you JS is a "good" language (although TypeScript is), and building stuff involves a lot of ugly stuff and toil, and the complexity of the ecosystem is overwhelming. But JavaScript's ubiquity and its dominant platform (the web) can make you incredibly productive. The ability to share your work with others using a browser is very motivating. Check out this React drum machine/sequencer as an example of a weekend project. And you can reduce the ugliness by switching from JavaScript to TypeScript for your own stuff as soon as you feel like you have a handle on things.
posted by caek at 11:03 PM on April 1 [2 favorites]

I've been using OCaml recently as a replacement for Python in places where I need better performance, and it's a pretty interesting language with some nice design features - the type and module systems in particular are really elegant. Thomas Leonard wrote a good series of blog posts a few years ago about moving from Python to OCaml which might be of interest.

(It's in the ML family of impure functional programming languages, so there are some other related languages: Standard ML is simpler but has a formal definition; Microsoft's F# is a .NET version of OCaml with Haskell-style syntax; Facebook's Reason blends OCaml and Javascript.)
posted by offog at 5:22 AM on April 2

I'm not a programmer, and will be looking forward to better suggestions, but one possible idea to consider is something that gets closer to hardware. For example, making some little, physical, FPGA-based audio gear could be a lot of fun. (Contributing to OpenRISC is on the list of things that I'd love to do, but have admitted I will never actually have time for.)
posted by eotvos at 10:02 AM on April 2

The only answer is Raku, y'know the Perl 6 that took so long they renamed it. What do you think they were doing all that time? They were making a really cool language. Aside from the languages that compile into single executables vs interpreted/bytecode + VM to run.... Dive off the deep end, everybody has already mentioned the popular and the flashy. Go for the underdog that people smirk at. Then spend the rest of your days reading articles about the other languages and thinking "meh, Raku does that better" because they spent that 16 or so years of development stealing every good idea from every other language and putting it all in one place.

My other things would also be out of the common and maybe deemed old but if you haven't yet you should give them a bit of play. Forth because it's like a ball of mud that gets polished into a shiny sphere... it's like interpreted assembly that you just keep chaining together until it's finished and then you save it. Squeak/Pharo or one of the other Smaltalk variants (Python: everything's an object. Smalltalk: lol, hold my beer.). Ada maybe? The military/govt has been using it for ages (Rust: I'm safe. Ada: lol, hold my beer.). I'd probably just do Erlang over some of the variants.
posted by zengargoyle at 8:17 PM on April 2

I discovered this question pretty late but as a programming languages nerd, I Have Suggestions:

Firstly, you may want to look into SuperCollider. This is the music composition system that provides the synthesis back end for Sonic Pi. However, it's got its own language ('sclang', a sort of Smalltalk with C++-ish syntax) that gives you access to a whole lot of other features (e.g. instrument creation, non-realtime synthesis, better Emacs integration, etc.) FWIW, I ended up graduating to SuperCollider from Sonic Pi when I found the latter too limiting for my own twisted workflow.

You might also want to look into Clojure (a Cool Kid Lisp for the Java VM) and its own SuperCollider binding, Overtone. This is what Sam Aaron wrote before he went on to create Sonic Pi. If you dig through the Sonic Pi sources, you'll find a lot of instrument definitions written in Clojure that are just different enough to not easily use from SuperCollider and totally not a pain to hand-translate into sclang (ask me how I know).

I'll also second playing with Smalltalk (Squeak is a good entry point; it's free and designed as the basis for various computer education thingies). It's a really cool language with GUI-based IDE, excellent multimedia capabilities, pure OOP and is written almost entirely in itself. It also works by saving its entire state to a file which you can then resume later, so in a manner of speaking, your Squeak image is the same Smalltalk process that was launched at PARC in 1976.

I also really like Ruby (minus Rails); it's got most of the good bits of Smalltalk but also has Perl-level OS integration. (A downside of Smalltalk is that it's difficult connect to third-party libraries and OS features; Ruby doesn't have that problem.) You're already using it with Sonic Pi but there's some really cool functionality. (E.g. take a look at how DSLs work.)

There's also Dragon Ruby, a game development kit based on mruby which has a nice, minimal API for 2D games. It's payware but if you bought the recent huge bundle, you have a copy.

Going beyond multimedia, there's Haskell (as mentioned above). I found it completely brain-bending. I strongly recommend learning it just for how it will change the way you think about programming. (But not as a practical programming language; I wrote one non-trivial program in it, started a second and gave up on the language. I'm still glad I learned it though.)

Alternately, you could try C. It's kind of unpopular these days but it has its virtues. It's simple, predictable and will do what you tell it to, no matter which foot its currently aimed at. Python is very "batteries included"; you may enjoy using a more minimal language. (Or you could try Forth if you want to take that to a further extreme. Forth is cool in that it's a really powerful system given the minuscule computers it can run on.)

There's also Racket (the Cool Kid's Scheme) but I don't know enough about it; it's on the list of languages I plan on learning some day (along with Rust, Go, Zig and relearning Prolog.)
posted by suetanvil at 10:36 AM on April 8

« Older Best store to buy a microwave?   |   3 innings at a time Newer »

You are not logged in, either login or create an account to post comments