Live data from Hacker News

Nim 1.6

nim-lang.org

11–20 of 179 posts

Re: Nim 1.6

#11
post #8
post #5

Earlier quoted context omitted.

I have written a bit of both, recently re-wrote a command runner for a side-project https://gitlab.com/jarv/cmdchallenge in Nim and found it very pleasant and much less verbose, which was a nice change from GoLang while keeping type safety. A good example is parsing JSON https://nim-by-example.github.io/json/ as you can do a lot with fewer lines of code. I think the main disadvantage of Nim is that there is less out…

I really like the look of Nim but every time I dig into it I find a really strange syntax decision. For example: > The json module provides the %* operator which is used to create JSON objects I'm curious what the benefits are here of an operator over some more readable syntax. I have a dislike of languages where ascii noise seems to be favoured over readable english tokens.

Yeah, I tend to agree with you here especially after a take a break from writing Nim I need to re-learn a lot because it is impossible to hold it in my head for very long.

Re: Nim 1.6

#12
post #8
post #5

Earlier quoted context omitted.

I have written a bit of both, recently re-wrote a command runner for a side-project https://gitlab.com/jarv/cmdchallenge in Nim and found it very pleasant and much less verbose, which was a nice change from GoLang while keeping type safety. A good example is parsing JSON https://nim-by-example.github.io/json/ as you can do a lot with fewer lines of code. I think the main disadvantage of Nim is that there is less out…

I really like the look of Nim but every time I dig into it I find a really strange syntax decision. For example: > The json module provides the %* operator which is used to create JSON objects I'm curious what the benefits are here of an operator over some more readable syntax. I have a dislike of languages where ascii noise seems to be favoured over readable english tokens.

This is interesting, especially for a language like Nim that favours familiarity with Python.

Even Rust dropped most of its strange operators/sigils early on in the experimentation phase, because they confused people and Rust doesn't step back from confusing people lightly, haha.

Re: Nim 1.6

#13
post #8
post #5

Earlier quoted context omitted.

I have written a bit of both, recently re-wrote a command runner for a side-project https://gitlab.com/jarv/cmdchallenge in Nim and found it very pleasant and much less verbose, which was a nice change from GoLang while keeping type safety. A good example is parsing JSON https://nim-by-example.github.io/json/ as you can do a lot with fewer lines of code. I think the main disadvantage of Nim is that there is less out…

I really like the look of Nim but every time I dig into it I find a really strange syntax decision. For example: > The json module provides the %* operator which is used to create JSON objects I'm curious what the benefits are here of an operator over some more readable syntax. I have a dislike of languages where ascii noise seems to be favoured over readable english tokens.

This way you can write json literals in the code, and it will look just like regular json. For serialization and deserialization stdlib uses `to/load/store` proc names.

  import std/json

  echo %*{
    "key1": "value",
    "key2": 12,
  }

Re: Nim 1.6

#14
post #2

I don’t know much about Nim, does it have a mandatory gc, like go? How good is Nim’s gc? Those who have written some Go and Nim, home does the code look like vs go?

Nim has multiple memory management strategies and you can pick any. A few types of garbage collectors, reference counting and manual memory management.[1]

Nim is less verbose than Go and more expressive.

[1] https://nim-lang.org/docs/gc.html

Re: Nim 1.6

#15
post #9

Earlier quoted context omitted.

Nim is the most readable language I've ever seen. I've dabbled with Go, but Nim is almost like pseudocodes+types. Highly recommend you take a look and try it out! You can use libraries like https://github.com/planety/prologue or https://github.com/treeform/pixie to create something quickly and fun(compile times are faaasst!). And Nim does not have a mandatory GC, you can go as low-level as you want, but in case you d…

Looks like you know a bit of Nim. Apart from ecosystem and IDE what are the some of the disadvantages of Nim compared to Go?

* Goroutines are probably a lot more easier to use. Work is being done to make Nim even better in that area: https://github.com/nim-works/cps but don't expect it soonish.

* I feel like Go has less 'edge cases', but the Nim compiler is steadily getting more stable, especially consider it's not backed up by a major company!

* Metaprogramming is really powerful, but not beginner friendly. The documentation says use macros when necessary, but personally I don't think that really happens in practice.

The advantages by far outweigh the disadvantages, especially if you are looking for a clean Go alternative(except maaaaaaybeee web application).

EDIT: my own wishlist, but they aren't relevant compared to Go:

* Better sum types * Builtin pattern matching

Re: Nim 1.6

#16
>Nim made its first entry in TIOBE index in 2017 at position 129, last year it entered the top-100, and for 2 months the top-50 (link). We hope this release will reinforce this trend, building on Nim’s core strengths:

I wonder if it has chances to ever enter top 20.

Re: Nim 1.6

#17
post #8

Earlier quoted context omitted.

I really like the look of Nim but every time I dig into it I find a really strange syntax decision. For example: > The json module provides the %* operator which is used to create JSON objects I'm curious what the benefits are here of an operator over some more readable syntax. I have a dislike of languages where ascii noise seems to be favoured over readable english tokens.

This way you can write json literals in the code, and it will look just like regular json. For serialization and deserialization stdlib uses `to/load/store` proc names. import std/json echo %*{ "key1": "value", "key2": 12, }

Could have just used a "JSON" keyword instead. Symbolic names are needlessly obscure and unfriendly. Hard to infer meaning, hard to pronounce, hard to search online, etc.

Re: Nim 1.6

#18
> Why use Nim? > One language to rule them all: from shell scripting to web frontend and backend, scientific computing, deep learning, blockchain client, gamedev, embedded, see also some companies using Nim.

Does that work in practice? I can't really imagine a single language that would be a good choice for "everything".

Re: Nim 1.6

#19

> Why use Nim? > One language to rule them all: from shell scripting to web frontend and backend, scientific computing, deep learning, blockchain client, gamedev, embedded, see also some companies using Nim. Does that work in practice? I can't really imagine a single language that would be a good choice for "everything".

Well no language is perfect, but Nim can be used in almost every domain because of it's compilation targets(C, C++, JS) and it's fast compile times(who needs interpretation when compile times are that fast!):

* Shell scripting, I still assume most people will just use Bash tho: https://github.com/Vindaar/shell

* Frontend: https://github.com/karaxnim/karax or you could bind to an existing JS library.

* Backend: For something Flask-like: https://github.com/dom96/jester or something with more defaults https://github.com/planety/prologue

* Scientific computing: the wonderful SciNim https://github.com/SciNim

* Blockchain: Status has some of the biggest Nim codebases currently in production https://github.com/status-im?q=&type=&language=nim&sort=

* Gamedev: Also used in production: https://github.com/pragmagic/godot-nim and due to easy C and C++ interop, you get access to a lot of gamedev libraries!

* Embedded: this is a domain I know very little about but for example https://github.com/elcritch/nesper or https://github.com/PMunch/badger for fun Nim+embedded stuff!

Most of the disadvantages come from tooling and lack of $$$ support.

Re: Nim 1.6

#20

> Why use Nim? > One language to rule them all: from shell scripting to web frontend and backend, scientific computing, deep learning, blockchain client, gamedev, embedded, see also some companies using Nim. Does that work in practice? I can't really imagine a single language that would be a good choice for "everything".

Yeah, these kind of statements feel very “empty” to me. That’s probably true that you could do everything with Nim, it’s also true that you can do everything with every language. Should you? That is another question.
Post reply on HN