Live data from Hacker News

Nim: Scripting Ease in a Compiled Language

junglecoder.com

21–30 of 169 posts

Re: Nim: Scripting Ease in a Compiled Language

#21

Looks cool already but is it easy to cross-compile? I can copy a Python script from my Linux machine and run it on both Mac and Windows PCs. Can Nim build executables for other platforms nearly as easy?

In addition to compiler switches that allow you to cross compile from the nim compiler [0], you can compile to c or c++, and then invoke whatever cross-compilation toolchain to compile to more esoteric platforms.

[0] https://nim-lang.org/docs/nimc.html#cross-compilation

Re: Nim: Scripting Ease in a Compiled Language

#22

One thing I find annoying about Nim is the case insensitivity [0]. There was no strong reason for this "feature" and literally no mainstream language does it. Moreover it makes code search a pain. [0] https://nim-lang.org/docs/manual.html#lexical-analysis-ident...

You can use nimgrep [0] to find symbols that match each other with case insensitivity, but yeah it is unusual. [0] https://nim-lang.org/docs/nimgrep.html

nimgrep's alright. I was thinking of code search on, say, github. I feel the additional complexity was unnecessary in an otherwise well designed language.

Re: Nim: Scripting Ease in a Compiled Language

#23

One thing I find annoying about Nim is the case insensitivity [0]. There was no strong reason for this "feature" and literally no mainstream language does it. Moreover it makes code search a pain. [0] https://nim-lang.org/docs/manual.html#lexical-analysis-ident...

VB.net is case-insensitive, and probably more popular than you think[1].

I think that case insensitivity actually does make sense when working with symbolic identifiers. I've seen justifications for "Foo" and "foo" being distinct symbols; personally, I find that playing with casing like that reduces my ability to read code quickly.

Case insensitivity does have its downsides, but usually it's not as noticeable in VB.net because most development is done in VS, which automatically re-cases symbols to match the original definition.

[1] Number 6 based on search engine popularity according to https://www.tiobe.com/tiobe-index/ Also, anecdotally, it's used quite a bit in industrial automation.

Re: Nim: Scripting Ease in a Compiled Language

#24

One thing I find annoying about Nim is the case insensitivity [0]. There was no strong reason for this "feature" and literally no mainstream language does it. Moreover it makes code search a pain. [0] https://nim-lang.org/docs/manual.html#lexical-analysis-ident...

As an admittedly amateur programmer, I think the reasoning is solid. Its difficult to read and understand code that does things like myvalue = myValue. I think they made the right tradeoff, in that value != Value (the case of the first letter is used), so if you really need to have to values with the same name, you can still do it.

As an aside, is there some reason that using the same identifier with different cases is desirable?

Re: Nim: Scripting Ease in a Compiled Language

#25

Looks cool already but is it easy to cross-compile? I can copy a Python script from my Linux machine and run it on both Mac and Windows PCs. Can Nim build executables for other platforms nearly as easy?

If cross-compilation is important to you, and you like Nim's level of abstraction, you might have a look at Haxe, which can compile to [lots of different targets](https://haxe.org/documentation/introduction/compiler-targets...).

Re: Nim: Scripting Ease in a Compiled Language

#26
post #3

Is there anyone using Nim either in side projects or in production that can comment on how they like it? I keep hearing about Nim and it sounds interesting, but I'm not sure I have the mental capacity right now to do a deep dive into the language and build something with it. I'd like to at some point soon though.

I've been using Nim in side projects for the past year or so. I really love the language, to the point where its replaced Python/Node as my language for utilities. Some of the qualities I like:

1) Its really easy to get started with. The default runtime has a GC for memory management, and the typing system is pretty similar to other popular languages. You can pick up the syntax in a day, the basic semantics in a weekend, and the more advanced semantics in a month.

2) Its fast and reliable. If the code compiles, it probably works, and it's probably a tier faster than a scripting language. Maybe not as bulletproof as Rust, but the ease of use is worth it for me. It can even reach C speeds, but that does require some advanced knowledge. Again, the default runtime is probably fast enough.

3) Powerful language features. I know there are a lot of people out there happy using C. I'm glad that works for them, but features like case objects, generics, and closures are part of the abstraction tools that I use to get stuff done. Nim also boosts what might be the best macro system for a static typed language, which is very helpful for framework developers.

Re: Nim: Scripting Ease in a Compiled Language

#29
How do data scientists feel about Nim? It feels very pythony, but way faster - could be a really cool language for them, similar to what Julia is trying to be.

Curious if anyone in a DS role has tried it out. I'm certainly tempted to try it out, I'm sure I'm losing lots of performance in parts of my analytics pipeline due to Python being garbage slow.

Re: Nim: Scripting Ease in a Compiled Language

#30

One thing I find annoying about Nim is the case insensitivity [0]. There was no strong reason for this "feature" and literally no mainstream language does it. Moreover it makes code search a pain. [0] https://nim-lang.org/docs/manual.html#lexical-analysis-ident...

SQL, BASIC, HTML.
Post reply on HN