Live data from Hacker News

Nim 0.13.0 has been released

nim-lang.org

51–60 of 80 posts

Re: Nim 0.13.0 has been released

#52
post #41
post #6

Earlier quoted context omitted.

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?

In Lisp, a parenthesized expression is a function call by default, if not explicitly transformed in some way (for example with `quote`). `(f 1 2 3)` would be written as `f(1, 2, 3)` in other languages, and `(f)` would be `f()`. So `(-1)` would translate to `(-1)()` which doesn't make sense. Well, not exactly, as for example in CL and Elisp you have a `1+` function[1], which... well, adds 1 to its argument. The difference is that `1+` is not a valid literal number, so it's read as a symbol, and if this symbol has a function attached to it, it is called.

In Common Lisp you can work around this by using a special syntax: `|-1|`, which forces reading the thing inside as a symbol. You can then define functions and call them this way:

    (defun |+1| (x) (1+ x))
    (|+1| 1) ;; => 2
[1] `1-` too, of course.

Re: Nim 0.13.0 has been released

#53

Earlier quoted context omitted.

I brought it up recently in the #nim irc channel, trying to get a good explanation. The creator still seemed to think it was a good idea, and I could not convince him otherwise.

Yeah, I feel your pain. This is a deal breaker for me. My OS of choice for the last 25 years has a case sensitive filesystem, all the programming languages I learned (well, except PHP) are case sensitive, it is too hard to unlearn. BTW, PHP has weird case sensitivity rules. Case sensitive (both user defined and PHP defined): * variables * constants * array keys * class properties * class constants Case insensitive (b…

Case insensitive identifiers have no bearing on using case sensitive file names. Nim's system is admittedly baroque but it is an attempt to have (mostly) insensitivity without breaking the most common forms needed for C-interop. Just use it as if it were a fully insensitive language, choosing unique identifiers, and the partial case sensitivity will rarely be a problem.

Re: Nim 0.13.0 has been released

#54

Earlier quoted context omitted.

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

This would be caught by the compiler. If you have m_insensitive declared in current scope you won't be able to define min_sensitive in this scope, the compiler would throw an error.

Re: Nim 0.13.0 has been released

#55
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`…

I can see potential problems, but have you actually tried it and found any problems in practice?

And you can always just learn another naming convention. That's not hard. Almost every language comes with its own way of naming things. For me - I'm using really a lot of languages at the same time - it's actually helpful because it makes easier to tell which language I'm writing right now...

Re: Nim 0.13.0 has been released

#56
post #41

Earlier quoted context omitted.

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

In Lisp, a parenthesized expression is a function call by default, if not explicitly transformed in some way (for example with `quote`). `(f 1 2 3)` would be written as `f(1, 2, 3)` in other languages, and `(f)` would be `f()`. So `(-1)` would translate to `(-1)()` which doesn't make sense. Well, not exactly, as for example in CL and Elisp you have a `1+` function[1], which... well, adds 1 to its argument. The differ…

Thanks for the answer. I know very little Lisp, though I find it interesting.

> `|-1|`

Is there a name for that | operator - if it is one?

Re: Nim 0.13.0 has been released

#57

Earlier quoted context omitted.

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

There were also RAF Nimrod planes, IIRC.

Re: Nim 0.13.0 has been released

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

I enjoyed starting to learn about Nim, but the worst case of NIH is the forum.

There is good forum software out there. This thing that Araq wrote in his spare time is not good forum software. It is outright painful to participate in a discussion there.

Re: Nim 0.13.0 has been released

#59
post #48
post #27

Earlier quoted context omitted.

> 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 gen…

I think the point in the "variable"/"VARIABLE" difference is that, although they visually look very different, their meaning does not. In a more practical case, if I read some code which has two variables within the same score with names "last_value" and "LAST_VALUE", I would not be able to tell what should they contain: one has the last value in a sequence (which one?), and the other... what?

Re: Nim 0.13.0 has been released

#60
post #58
post #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.

I enjoyed starting to learn about Nim, but the worst case of NIH is the forum. There is good forum software out there. This thing that Araq wrote in his spare time is not good forum software. It is outright painful to participate in a discussion there.

As somebody who has written most of the Nim Forum, I'm really sad to hear that. I appreciate good feedback though.

What would you say should be improved in the forum to make it less painful to use?

Post reply on HN