Live data from Hacker News

Nim: Scripting Ease in a Compiled Language

junglecoder.com

31–40 of 169 posts

Re: Nim: Scripting Ease in a Compiled Language

#31
post #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…

In many languages, you might use one for a type name, the other for a variable.

You could ban using the same identifier with different cases, instead of treating them the same.

Re: Nim: Scripting Ease in a Compiled Language

#33
post #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.

Fortran and Ada, as well.

Re: Nim: Scripting Ease in a Compiled Language

#34

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

SQL also does it (albeit inconsistently).

Re: Nim: Scripting Ease in a Compiled Language

#35

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 spaces for indentation.

Spaces are fine. You can use as many as you want. Two, four, three, whatever. Nim doesn't care.

But Tabs? They are forbidden!

Unless you use this magic line at the top of each source file:

  #? replace(sub = "\t", by = " ")
Now you get to use tabs!

Re: Nim: Scripting Ease in a Compiled Language

#36
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'm using Nim in production (combined with NodeJS) and I really like it. Cross-compiling is so easy. Testing is easy. Syntax is easy to read. I like it.

Edit: Email me if you'd like more info.

Re: Nim: Scripting Ease in a Compiled Language

#37

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: speed, I'm seeing the Rust ecosystem get better and better; I'm also learning the language on the weekends with small projects.

But also: many many moons ago I had Matlab code that was really slow (and I wanted to run 10^LARGENUM simulations for Monte Carlo purposes) and decided to learn Fortran. It was surprisingly easy to learn, and it did cut my running time from afternoons to minutes. But in the process I found out that my Matlab performance problems were mostly due to arrays being dynamically resized all the time -- while static memory preallocation could be hacked easily in straight Matlab.

As for Python, numpy is a fast embedded minilanguage written in C; the difference between "pythonic" and "numpythonic" is not emphasized enough in bootcamps, I think.

Re: Nim: Scripting Ease in a Compiled Language

#38

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! I use Nim on macOS to build a Windows exe for bootstrapping a Windows VM. A year ago, you had to dig a little to figure out the right command line incantation, but maybe it's better now.

Re: Nim: Scripting Ease in a Compiled Language

#39
post #24

Earlier quoted context omitted.

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…

In many languages, you might use one for a type name, the other for a variable. You could ban using the same identifier with different cases, instead of treating them the same.

On the other hand, what if it's a code UI limitation? Suppose the UI for writing Nim had support for linking, editing, viewing all such alternately spelled but equivalent symbols?

Re: Nim: Scripting Ease in a Compiled Language

#40
post #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…

Nothing unusual in doing e.g. `array = Array()` (although you should probably give your variables better names than that), which would break in Nim.
Post reply on HN