Ask HN: Choosing a language to learn for the heck of it

14 points by bsg75 ↗ HN
I'm a technical manager, which means I do a lot of administrative stuff and a little coding. The coding has become a nice distraction when I need to take a break.

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 ] thread
> Suggestions on choosing one as a hobby language?

IDK 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 suggest Pharo[1]. It's an actively developed Smalltalk dialect. There's a MOOC[2] on it, and there are several free books that cover the basics of the language itself[3][4], data visualisation[5] and numeric stuff[6]. The whole environment is sweet, for example, you can actually search a method just by giving a example of what you want to do. The only issue is, as it is developed at a fast pace, documentation tends to get a bit dated quickly. [1]. https://en.wikipedia.org/wiki/Pharo [2]. https://mooc.pharo.org/ [3]. https://books.pharo.org/updated-pharo-by-example/pdf/2018-09... [4]. https://books.pharo.org/deep-into-pharo/ [5]. http://agilevisualization.com/ [6]. https://books.pharo.org/numerical-methods/
Thank you for the MOOC link. I have been looking for a good starting point to get into a Smalltalk language/implementation.
Haskell is a ton of fun and is a neat way to just learn a different paradigm of programming.
I'm keeping watch on Crystal and Zig personally. Crystal looks like a near perfect language for my style with one major caveat being compilation speeds. I'm a sucker for a dynamic language feedback loop, I'm curious how Nim is on that front if anyone knows.

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.

Nim has extremely low compilation times...order 200 millisec with the TinyCC/tcc backend and order 800 millisec with gcc (both for the zero length empty module). Less trivial projects (say transitively importing 25 modules) are more like 1.2 seconds and 5..6 seconds. All of these numbers are about to improve quite a bit with incremental compilation which is under active development, but they are already quite friendly/fast code-test-code again cycles.

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.).

I always recommend either assembly, as it is the root of everything. Kind of like learning to build your own computer. After that even micro code.

Or I am a fan of LISP as it is a completely different way of thinking.

Cobol, brainf*ck, Ada come to mind
I second this. It works on win/mac/linux. There is loads of readable documentation on the internet (lots of technical theory in it too but IMO easy enough to understand in comparison to Haskell). The Dr. Racket editor is nice and the features it provides are really helpful. I can't do it enough justice in a comment. If you wanted a scheme/lisp-like language that does some hand holding this may be worth looking into.
I tried this, but it doesn't have basic CLI tooling like an autoformatter or an LSP, which are very useful when getting started in a language.
Hm. I learned programming in large parts thanks to The Little Schemer, SICP and Scheme/Racket. LSP wasn’t a thing then and it worked fine anyway. Much of the code I wrote (and evaluated manually) was on paper.

Regarding the autoformatter... Not sure if Racket really needs that since the syntax is so simple. But maybe it would be an improvement.

I think both Nim and Crystal will make fine languages to learn. Both languages have reached the all-important version 1.0 milestone and are therefore at relatively stable releases. The communities are quite small as are the resources for learning the languages (which not may be a concern).

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).

I would consider a practical functional language like OCaml or F#. Of the ones you listed perhaps Nim--too much of a kitchen sink for me but more mature than the others from what I gather.
I guess I'll give the obligatory Rust rec - It's a fun language that prevents you from being too stupid (after you learn it).
I would learn a different paradigm, not just a different language. Learn Haskell.
JavaScript, C, C#.

Or a Lisp if you want to tread into the weeds.

You should definitely check out Julia. Give Pluto.jl a try.
Check out the rather strange Hoon and Nock languages used by Urbit. Very different from what you're used to.
If you want to learn something NEW with new syntax:

- 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.

Zig is a really great language to learn.

Plus, it is really simple, especially if you are already familiar with a language such as C.