Nim Community Survey 2021 Results
nim-lang.org
nim-lang.org
(Snark time) Is there someone that gets paid for protection? Maybe a "contribution" to security research efforts at one of these places? Or is there just an "I'm not a virus" flag Nim is forgetting to set.
Edit: Got a reply:
> Thank you for contacting CrowdStrike’s public AV scanner team! If you have not done so yet, please upload a sample of the file in question to Hybrid Analysis at https://www.hybrid-analysis.com/. Furthermore, please make sure that your request contains the SHA256 hash of the file.
I look forward to them no longer flagging one specific Nim binary produced just as an example.
At this point anti virus companies are the virus, slowing down peoples computers, mining bitcoin, false advertising, hard to cancel payments etc...
The things that were difficult were 1) Remembering which objects were initialized with "newThing" and which needed "initThing," 2) I never quite figured out what the restrictions on writing an "iterator" are and why, and 3) It's not clear whether a uniform error/exception handling approach has been figured out. I'm also not a fan of canonicalizing variables so you can write them any way you want to, since it harms grepping and the consistency of code.
Otherwise, the language was really enjoyable, and code tends to be both surprisingly terse while remaining readable, and fast to compile and run. Being able to turn the GC off is a pretty cool feature, and I love the default "result" variable in functions.
Right now it feels like a "better Go," but I always watch any language that gives me hope that I will someday stop having to use C++.
Perhaps surprisingly, the opposite is true. You can enforce a style and a library that uses another style doesn't pollute yours and mix it all over the place.
There's also `nimgrep` (never needed this in >5 years on this language), or `nimpretty` to normalise styles.
> someday stop having to use C++
Nim can compile to C++ so you get ABI compatibility, and control over performance should be just as fine tuned. Nim should be able to run at the same speed as C/C++ since they both offer the same level of hardware access and portability. Depending on your needs it should be possible.
> code tends to be both surprisingly terse while remaining readable, and fast to compile and run.
This is one of Nim's most powerful features. Easy to read productivity. Prototypes end up being good enough, and it's got the teeth when you need them.
The language default is 'fast and safe', all the fancy stuff is opt in when you need it. E.g., variables are put on the stack by default, heap GC is attached to the type rather than instance (static lifetime + RC/optional cycle collector). Variables are initialised to zero, but there's `{.noInit.}`, access raw pointers but with strong typing and construct/destroy hooks, and so on.
Things like this: https://nim-lang.org/docs/manual.html#pragmas-linearscanend-... and the below computed goto pragma add even more control should you need it.
Then there's the god-tier metaprogramming that lets you have optimisations that would be impossibly onerous to write, let alone maintain, manually, and give them the sweetest syntax you like. Full compile time VM in the native language, and type safe AST macros. Just standard Nim code, processing syntax trees with the standard library, say, outputting a framework from some data in a file, or providing a deep learning DSL that generates code for optimised matrix operations. It's like going from 1D to 2D.
But as @arc776 it’s actually handy for making your code based more consistent. Python was always a bit of a pain where different libraries would be either snake or camel case causing your code to have a weird mix.
It's not best editor, lacks features but for command completion and syntax highlight is good.
Object variants could support this need. But I was already amazed by those Haskell features.
I like ML and Python syntax.
Why use Rust over Nim in this case?
Is it Rust's static lifetime constraints? Is there some feature you would miss if you used Nim instead? Or would you prefer to use Rust because more organisations are using it?
[0] https://nim-lang.org/docs/manual_experimental.html#concepts
[1] https://nim-lang.org/blog/2021/03/10/fusion-and-pattern-matc...
It's interesting to know what the perceived weaknesses and strengths are. Nim does have pattern matching but it's rarely used, whereas it seems to be used a lot in Rust (probably because of the prominence of enums). Nim has static lifetime management, but it's mainly used for eliding and thread safety (for now). Traits are an interesting feature, and make a good example of why I'm so bullish on Nim: someone has already replicated them with a macro: https://github.com/haxscramper/nimtraits
The popularity critical mass thing is mainly getting eyes on the language, but I think Nim has a slight advantage in that it's incredibly cooperative with its compile targets and FFI. Like Python, it's great for good glue code and 'scripting' without the performance penalty, and I hope that helps it meld into people's toolboxes over time.
Is modern JS attractive to you as a previous CoffeeScript user? A think a lot of why CoffeeScript died is that they brought the big features into JS.
a bad aspect of CoffeeScript I see is "it's not an industry language". too flexible, insufficient integrations with standard tools, slow fixes and new features. The industry definitely need as lot of features for pushing and also controlling work.
(Yes, I'm aware of Jester/Karax be development has slowed down on those)
I wish discovery of community libraries was higher, I'm constantly discovering libraries that do amazing things 'hidden' away. I know there's https://nimble.directory/ and https://github.com/xflywind/awesome-nim but most of the time I end up using a search engine for something specific only if I think of it.
I'll take a better look at the DO version specifically as I'd like something equivalent for Vultr and Hetzner.