Live data from Hacker News

Patten Matching in Nim

nim-lang.org

11–20 of 54 posts

Re: Patten Matching in Nim

#11
The pattern matching blog post is indeed great (good job @haxscramper!). Casual Nim observers might want to click on the Blog link at the top (Or all the other links!). There have been quite a few posts in the past year or so on ARC & ORC garbage collection, multi-threading run-times, and a variety of "overview posts" on a lot of various happenings.

Re: Patten Matching in Nim

#13
post #9

The amount of power that Nim has is absolutely obscene. I don't really have a good use-case for it right now, but it's a language that I know I'd enjoy if I got into it.

Does Nim solve the "what color is your function" problem?

Re: Patten Matching in Nim

#14
post #13
post #9

The amount of power that Nim has is absolutely obscene. I don't really have a good use-case for it right now, but it's a language that I know I'd enjoy if I got into it.

Does Nim solve the "what color is your function" problem?

That's kind of not a language-level thing. I mean it is, but it's tied very very closely to runtime choices rather than the language itself.

Basically your question is equivalent to asking whether the language has green threads. The original article describing color (http://journal.stuffwithstuff.com/2015/02/01/what-color-is-y...) says it's just threads, but it glosses over why a language like C# decided to add async-await and why Java now has its ongoing Loom project.

System threads are heavyweight and as a result usually unsuitable as your concurrency primitive for highly concurrent applications (although you can and most runtimes do build on top of threads). And so if you only have that, you inevitably get what the article calls the "color problem" (see e.g. in Java the async IO APIs, which the article laments, but doesn't explore why they exist and moreover are often preferred by Java programmers over their synchronous equivalents), because system threads aren't enough and a color-based solution inevitably must appear on top of them.

So the question to ask is "does Nim have green threads?" To which the answer is no (and then by extension it does have the color problem, in this case via async-await).

Re: Patten Matching in Nim

#15
post #13
post #9

The amount of power that Nim has is absolutely obscene. I don't really have a good use-case for it right now, but it's a language that I know I'd enjoy if I got into it.

Does Nim solve the "what color is your function" problem?

Fwiw I personally quite like having function colors for async tasks and I/O, and in fact wish we also had them for purity (both read-purity and write-purity).

Re: Patten Matching in Nim

#16
post #13
post #9

The amount of power that Nim has is absolutely obscene. I don't really have a good use-case for it right now, but it's a language that I know I'd enjoy if I got into it.

Does Nim solve the "what color is your function" problem?

> The await keyword can only be used inside procedures marked with the {.async.} pragma.

https://livebook.manning.com/concept/nim/await

Re: Patten Matching in Nim

#17
post #16
post #13

Earlier quoted context omitted.

Does Nim solve the "what color is your function" problem?

> The await keyword can only be used inside procedures marked with the {.async.} pragma. https://livebook.manning.com/concept/nim/await

Note also that using async/await should be used with the new, non-default ORC garbage collector.

Re: Patten Matching in Nim

#18
NIM seems like this unicorn of a language of having great performance, amazing balance between being both high-level and low-level, extremely approachable due to syntax ... yet very few have actual discovered and use NIM.

I wonder why.

Re: Patten Matching in Nim

#19

NIM seems like this unicorn of a language of having great performance, amazing balance between being both high-level and low-level, extremely approachable due to syntax ... yet very few have actual discovered and use NIM. I wonder why.

...because nowadays the world of software is marketing driven. People often ask me what big company is behind Nim even before asking about its design and features.

Re: Patten Matching in Nim

#20

NIM seems like this unicorn of a language of having great performance, amazing balance between being both high-level and low-level, extremely approachable due to syntax ... yet very few have actual discovered and use NIM. I wonder why.

In my case, I actually prefer my languages to be more opinionated. Nim implements just about every paradigm it can think of, and if there are multiple ways to implement a paradigm, it implements them all. It feels like a sophomore college student who keeps switching majors.

Some people prefer "There is Only One Way to Do It" languages.

Some people prefer "There is More Than One Way to Do It" languages.

Nim is more like a "There Are Seven Ways to Do It and the Eighth Way is Planned" language.

Post reply on HN