Live data from Hacker News

Nim: Scripting Ease in a Compiled Language

junglecoder.com

111–120 of 169 posts

Re: Nim: Scripting Ease in a Compiled Language

#111
post #51

Earlier quoted context omitted.

Do you mean compile times for Nim or a project? It's accurate to test it yourself since it's free.

Projects of any note are notoriously hard to test for yourself since they often use build systems. Golang is nice in this respect, pretty easy and fast.

Nim projects typically use `nimble` that ships with the install. So all you would need to do is `nimble build` in the root folder and voilà! Of course that also pulls the dependencies from the package manager, so you might want to just extract the build step from the `.nimble` file if you wanted to time just the compilation.

Re: Nim: Scripting Ease in a Compiled Language

#112

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...

IIRC a study on beginners learning Python found that case sensitivity was the biggest source of errors/confusion. So I'm all for new languages being case-insensitive.

Re: Nim: Scripting Ease in a Compiled Language

#113

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...

Not true. Powershell is mainstream and case insensitive. Never ran into an issue with it or heard of people complaining about it.

Re: Nim: Scripting Ease in a Compiled Language

#114

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...

It's shocking how people whine about case insensitivity without bothering to try using Nim for a while.

Case insensitivity is a feature and it's meant to allow easy interfacing with C.

And it also encourages clean code.

With other languages you can have variables called "startdate", "start_date" and "startDate" in the same scope leading to bugs - especially when using completion in an editor - and poor readability.

In Nim the compiler tells you that you are redefining the same variable in 3 different places and you can go and give them more meaningful names.

Re: Nim: Scripting Ease in a Compiled Language

#115

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?

Yes, Nim is cross-platform.

It also targets C, C++, Objective-C and Javascript, making it possible to run on platforms where using C is not the preferred choice.

Re: Nim: Scripting Ease in a Compiled Language

#116

What're compile times like?

For me, I'm seeing compile times averaging around 5-10 seconds, with outlier builds taking up to 40 seconds if the files in question aren't cached. It feels faster than Go, but I think part of that is down to Nim's compile output being verbose by default.

Nim's compilation is much faster than Go.

Re: Nim: Scripting Ease in a Compiled Language

#117

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...

This. I like many of the things that Nim is doing, but I refuse to take it seriously if it's going to make basic things like tag search and grepping difficult. inb4 a Nim linter is written to force a consistent naming style throughout a codebase.

you can compile with `--stylecheck:error/hint` for enforcing consistent naming.

Re: Nim: Scripting Ease in a Compiled Language

#118

Earlier quoted context omitted.

> for example, it is very natural to name them "a,A,b,B" And just to clarify once again, since I'm not sure who will read which reply: those are NOT the same identifiers in Nim! let a = 11 b = 22 A = 99 B = 88 echo a == A # false echo b == B # false Run the code in the Nim Playground if you don't believe: https://play.nim-lang.org/#ix=20kr

great! then I don't really understand nim's case insensitivity rules

Only the first char is case sensitive. The rest is case and underline insensitive;

Re: Nim: Scripting Ease in a Compiled Language

#119
post #49

Earlier quoted context omitted.

Sounds like a nightmare.

Sounds like a pointless misfeature that will only generate mandatory "do not @#$$ do this" entries in future Nim coding style documents, and Nim linting programs that find and flag abuses. The motivation is good, if the intent is to get rid of ___unwanted___crap___ like this. But if I, as a language designer, wanted to ban such identifiers, I would just go ahead and ban them, rather than making them equivalent to one…

This is incorrect.

Nim does not allow variables starting with underscore.

Also, the compiler errors cannot if any of "useHTTP", "usehttp" or "use_http" is acceptable or unwanted, but it can error out with a clear warning if you are trying to define different variables with those names in the same scope.

Re: Nim: Scripting Ease in a Compiled Language

#120

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...

It's not just case insensitive, it's underscore insensitive. So MyNimName, mynimname, MY_NIM_NAME, My_Nim_Name, __MYNIM___name_, and any other variation you can think of are all the same name! Most search tools have the option of case sensitive or insensitive search, but a search that does that and ignores underscores? Not too many of those outside the Nim world. An interesting contrast is Nim's policy on tabs and sp…

No tabs? Guess I won't be using nim.
Post reply on HN