Live data from Hacker News

Nim 1.2

nim-lang.org

71–80 of 130 posts

Re: Nim 1.2

#71

Oooo, wow collect looks so much cleaner. I can't wait to get home and play with it!

> I can't wait to get home and play with it

A. Where are you that you are not already at home??

And B. I wonder how many people are using nim at work, and what sort of workplaces that might be?

Re: Nim 1.2

#72
post #49

Earlier quoted context omitted.

choosenim is still supported :-) The idea is more like the gcc -std flag (gcc -std=gnu++11 for example). to emulate certain versions to ease upgrading.

Do you think the gcc -std flag would exist if every distribution of gcc included a command to easily download alternate versions and swap them out depending on project configuration? -std seems more like a bandaid around a difficult install/config than a feature, in my opinion. Obviously nim is free to make implement whatever options they want, but it seems to me like every second spent triaging/fixing/etc bugs about…

A newer GCC will likely have better optimizations, better safety checks, or what have you that would benefit old codebases using older versions of C's syntax. Similar deal with a newer Clang/LLVM, for that matter.

That is, if we had a GCC version manager that worked the same way things like choosenim or rustup or pyenv or rvm or what have you work, I can guarantee you GCC will ship with an -std flag, because you can bet someone needs to compile a C89 codebase and wants the latest and greatest compiler smarts to do it. Same deal for Clang, or Visual Studio, or `zig cc`, or whatever.

Great example of this (that I just had to deal with this week, lol) is Wine, which mandates C89-compliant code, and yet absolutely benefits from any compiler optimization improvements introduced with newer versions of GCC.

Re: Nim 1.2

#73
post #34

Earlier quoted context omitted.

I haven't played with nim for a few months, but only parameters with var will get mutated. I suspect you want to use someone else's cursed function and don't want to poison your blessed code

I see. I know nothing about Nim but I do see in their example they used var when declaring the function. This way seems like it's hidden to the consumer of the function but hopefully editor tooling helps with this.

You have to declare the variable as `var` as well, eg.

    var arr1 = [4, 2, 3, 6]
    sort arr1

    # Doesn't work
    let arr2 = [4, 2, 3, 6]
    sort arr2
You'll get a warning about the latter from the compiler (and nimsuggest for editors).

Re: Nim 1.2

#74
As someone who's heard of Nim, can someone who's used it tell me a little bit more about its benefits and how it compares to other common languages like JavaScript, Python, etc?

Re: Nim 1.2

#75

Earlier quoted context omitted.

Recaptcha and tracking.

Would you pay monthly if they removed it?

Perhaps I would. I've supported many projects in the past, so I think, if it was really good and did not violate my privacy, there is a fair chance I would.

Re: Nim 1.2

#76

Earlier quoted context omitted.

It uses a rather primitive garbage-collector though, right?

It really doesn't! It's GC story is pretty great, because you can choose out of several GC's, one of them being good for real-time systems: https://nim-lang.org/docs/gc.html Recent versions also use this fancy thing: http://www.gii.upv.es/tlsf/

'TLSF' sounds very interesting, I'll have to keep an eye on that project. What are the reference-counting options for though, given the absence of weak references? Under what circumstances is it acceptable to permit memory-leaks in case of cycles? Short-lived processes (i.e. arena-based memory management)?

When I say 'primitive GC', I mean Boehm, which is obviously decades behind the state of the art, but easy to get off the ground. GNU Guile uses it, for instance. Serious garbage collectors are tremendously complex, and are something less popular languages unfortunately tend to lack. I believe even D is miles behind Java.

Can't say I know much about Go's GC.

Edit Oops I misread, TLSF isn't a GC, it's an allocator. It sounds then like Nim doesn't have a proper real-time solution, does it? useRealtimeGC is actually a leaky reference-counting system?

Re: Nim 1.2

#78
post #74

As someone who's heard of Nim, can someone who's used it tell me a little bit more about its benefits and how it compares to other common languages like JavaScript, Python, etc?

The major features are: Python like syntax, Lisp like macro system, potential for C like performance (YMMV of course).

This is my person opinion here: Nim is part of the "new generation of system programming languages" from the last decade or so. Some other examples in this category include Zig, D lang, Go lang, Swift, Rust, etc...

The whole idea is to provide "modern high level" language features and ergonomics while still producing efficient low level code.

For Pythonistas, The familiar syntax is attractive to Python programmers looking for a more performant language (data science is a prime example.)

Nim is also attractive to lispers looking to move to a more traditional Algol or C like language while still keeping much of power and flexibility that they are used to from macros.

Re: Nim 1.2

#79
Irrelevant, but I spent the entire day reading this headline as NVim, i.e. Neovim.

These comments make a lot more sense now.

Re: Nim 1.2

#80

Earlier quoted context omitted.

Personally I stopped using exercism, when it started to require me to work for Google for free and would not let me log in, if I did not. It's not an ethical platform, unfortunately.

What do you mean by 'work for Google for free?' I don't see that being required anywhere on the site.

Probably it is a reference to the reCapcha hell Google may drop you into if you are deemed "suspicious"
Post reply on HN