Live data from Hacker News

Nim 0.13.0 has been released

nim-lang.org

41–50 of 80 posts

Re: Nim 0.13.0 has been released

#41
post #6
post #2

I will definitely be keeping an eye on Nim. That aside, does anyone else find the fact that Nim treats "-1" differently to "- 1" (quotes added for clarity) a bit disconcerting?

In Lisps, this: (- 1) and this: (-1) Are completely different things (the latter is actually an error). Also in LiveScript ls> (- 2) [Function] ls> (-2) -2 Also in Smalltalk, this: -3. "=> -1" - 3. "=> Error!!!" That's off the top of my head, I'm sure there are many other languages with this characteristic. Why would that be a problem? It's just a single (or a couple) parse rules to remember (but you get other benefi…

>Are completely different things (the latter is actually an error).

Why is the latter an error?

Re: Nim 0.13.0 has been released

#42
post #32

Earlier quoted context omitted.

Why would you need to unlearn it? Simply write code as you would write it in a case sensitive language.

I've been programming Python for a living for the last 8 years or so. In Python there is a convention for naming classes with `CamelCase` and instances with `snake_case`. I could do that in a case insensitive language, but I can't do this in Nim because it is not only case insensitive, it violates the "principle of least astonishment" by normalizing variable names in a way that makes `FooBar` equivalent to `foo_bar`…

If I understand you correctly, the convention is basically the following, right?

    class FooBar(): pass
  
    foo_bar = FooBar()
The equivalent in Nim:

    type FooBar = object
    
    var foo_bar = FooBar()
Compiles and runs perfectly fine.

How can this be the case? Well, the identifier equality rules in Nim have changed a while back, to make the first letter of every identifier case sensitive. So, FooBar == Foo_Bar == Foobar, but fooBar != Foo_Bar.

Re: Nim 0.13.0 has been released

#43
post #40

I used to play around with it when it was still call "Nimrod" and it was quite good fun. It's easy to learn and the examples were good. A c like language that has a python like syntax was something I had hoped for for some time.

Why was the name changed from Nimrod to Nim? IMO Nimrod sounds better. Nim is the name of a game: https://en.wikipedia.org/wiki/Nim .

Because in America, the name "Nimrod" is almost exclusively recognized as the epithet applied by Bugs Bunny to the hapless hunter Elmer Fudd, so the name of the language sounded risible to a lot of people: https://news.ycombinator.com/item?id=8351773

Re: Nim 0.13.0 has been released

#44

Earlier quoted context omitted.

I like everything Andreas did differently from Python, except the unusual normalization rules for variable names. This is crazy: VariableName == variable_name == VaRiAbLe_NaMe

Actually, VariableName != variable_name You can write ClassesLikePython and variables_like_python in Nim. Sometimes people end up having dangerously similar variable names in the same scope, e.g. username and user_name, where an incorrect tab-completion might introduce a bug. Nim would require the developer to choose better names.

Two identifiers are considered equal if the following algorithm returns true:

    proc sameIdentifier(a, b: string): bool =
      a[0] == b[0] and
        a.replace(re"_|–", "").toLower == b.replace(re"_|–", "").toLower
So, right, looks like it is case sensitive for the first character allowing the same convention from Python. Still, I find it dangerous:

    m_insensitive == min_sensitive

Re: Nim 0.13.0 has been released

#45

my only complaint with nim is that there exists Pascal code out there that gets rotten and it is not possible to transpile it to nim. Imagine Nim using LCL (Lazarus Component Library) or mseide code. I think they should rethink it.

Maybe this could help? https://github.com/nim-lang/pas2nim

The Nim compiler was originally written in Pascal and Araq used this tool to translate it into Nim, so it should work pretty well.

Re: Nim 0.13.0 has been released

#46
post #40

Earlier quoted context omitted.

Why was the name changed from Nimrod to Nim? IMO Nimrod sounds better. Nim is the name of a game: https://en.wikipedia.org/wiki/Nim .

Because in America, the name "Nimrod" is almost exclusively recognized as the epithet applied by Bugs Bunny to the hapless hunter Elmer Fudd, so the name of the language sounded risible to a lot of people: https://news.ycombinator.com/item?id=8351773

Wow, didn't know that, thanks, though I'd read some Bugs Bunny comics as a kid.

What's up, Doc? :)

https://en.wikipedia.org/wiki/What%27s_Up,_Doc%3F

Re: Nim 0.13.0 has been released

#47
This has always been a pretty cool project. While some have said Araq has a case of NIH (probably true), I've found it very nice that Nim and the whole ecosystem around it is as polished as it is. It also means there's a good amount of example code out there.

Re: Nim 0.13.0 has been released

#48
post #27
post #22

Earlier quoted context omitted.

> Case sensitivity makes life harder for beginners I think that I disagree. In general (not all the time, but often), things that look different should be different; allowing them to be treated the same is offering beginners a short-time advantage, while preventing them from making, or even understanding, distinctions that they may want to make in the long term. Imagine, for example, a car where both pedals behave th…

> In general (not all the time, but often), things that look different should be different Case-sensitivity is the opposite though: it's making two things that look the same be different. I could maybe support a rule (or even just a linter) that each variable had to be written in a consistent case throughout the project, but two different variables that differ only in case should definitely be disallowed, IMO. > It w…

> Case-sensitivity is the opposite though: it's making two things that look the same be different.

I can see why you would say that, but (as my comment suggests) I'm with wtetzner (https://news.ycombinator.com/item?id=10932471) on this one: I think that `variable` and `VARIABLE` look different. I am willing to believe, though, that this may just be a result of my training (as a mathematician); my students often genuinely see no difference between `h` and `H` (as variables), for example, and will interconvert freely.

> I don't think people buy their cars on the basis of how easy they make it to drive someone else's car, and nor should they.

I agree, but people often learn to drive with someone else's car, and I think that's the relevant analogy here.

Re: Nim 0.13.0 has been released

#49

I've investigated whether or not Nim could have Python2 compatibility mode. I think Nim or any language's future could easily be secured by simply finding a way to carry on compatibility with Python2. I've wanted to offer the libre source community another path forward from CPython2.7. Such a huge opening there for multiple parties. Unfortunately, in my research in figuring out how to do this I found that it's actual…

I highly doubt any language would want the baggage of python 2 compat, especially when the people interested by definition are going to oppose even minor change.

Re: Nim 0.13.0 has been released

#50
post #40

Earlier quoted context omitted.

Why was the name changed from Nimrod to Nim? IMO Nimrod sounds better. Nim is the name of a game: https://en.wikipedia.org/wiki/Nim .

Because in America, the name "Nimrod" is almost exclusively recognized as the epithet applied by Bugs Bunny to the hapless hunter Elmer Fudd, so the name of the language sounded risible to a lot of people: https://news.ycombinator.com/item?id=8351773

Interesting. In the UK, the word Nimrod is recognised (if at all) as a piece of classical music by the British composer Edward Elgar (from his work Enigma Variations)

https://www.youtube.com/watch?v=sUgoBb8m1eE

Post reply on HN