Ask HN: Choosing a language to learn for the heck of it
For "real work" I write mostly Python, a lot of SQL, a little bit of Go, and some shell scripting to glue it together. I'd like to learn something I have no need of for work. If it becomes useful later, that is OK, but not a goal. The goal is in creating something just for fun. That something is undefined, so general purpose languages are the population.
I have become curious lately in Nim, Crystal, and Zig. Small, modern, high performance languages. Curiousity comes from the cases when they are mentioned here, sometime for similar reasons I list above.
Nim is on top of the list: Sort of Python like, supported on Windows (I use Win/Mac/Linux), appears to have libraries for the things I do: Process text for insights, play projects would use interesting data instead of business data.
Crystal does not support Windows (yet), but appears to closer to Ruby. Its performance may be a bit better.
Zig came on my radar recently, I know less about it, compared to the little I know of the others.
Suggestions on choosing one as a hobby language?
24 comments
[ 2.9 ms ] story [ 19.7 ms ] threadIDK how much of a hobby it'd remain, but: Rust compiles to WASM, C++ now has auto and coroutines (and real live memory management)
"Ask HN: Is it worth it to learn C in 2020?" https://news.ycombinator.com/item?id=21878664
I tried Rust but it was too much for my small brain and seeing multiple blog posts about people spending years with it and still not getting the borrow checker down perfectly is putting me down a little. Perhaps I'll try it again down the line.
You can even write a "script" by putting "#!/usr/bin/nim r" at the top of your file (like #/bin/sh) and making it executable. (With nim r the compilation will be cached and so not require much time at all.) I would not call Nim a scripting language as typically understood (e.g. with 100 usec to 15 msec startups), but both compile|use cached & run makes it more similar than most alternatives. pypy3 on an empty file on the same machine as the above timings takes 40 ms, for example.
There is also a mode called "nim script" where rather than running an external C/C++/nodejs compiler a restricted subset can be compiled and run right on the same VM Nim uses for its Lisp-like macro facility. That only takes about 100 ms, but the savings relative to 200..250 ms with no subset restrictions may not be very compelling.
TL;DR is that Nim gives you a lot of options. In this and in most things, really (memory management, code style, etc., etc.).
Or I am a fan of LISP as it is a completely different way of thinking.
https://racket-lang.org/
Regarding the autoformatter... Not sure if Racket really needs that since the syntax is so simple. But maybe it would be an improvement.
Zig probably has a few years left before it reaches version 1, which may not matter to you. But it probably means features are likely to change and missing features still require implemention.
Not on your list, but also worth considering: Julia. The language has been growing steadily and there are a growing number of learning resources (more than for Nim and Crystal).
[1] https://www.amazon.com.au/Programming-Elixir-Dave-Thomas/dp/...
Or a Lisp if you want to tread into the weeds.
- Modern COBOL. You can get free course from IBM with access to virtual Z/OS development platform. Real language - and totally fresh stuff to learn!
- Julia - it seems that it will dominate the "big data" hype in incoming years. Also its similar to ALGOL or PASCAL so you will be able to learn something new from typical C/Python/Go syntax.
Plus, it is really simple, especially if you are already familiar with a language such as C.