11 ms·
Nim 0.13.0 has been released
- SeanDav 11y agoI 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?
- adrusi 11y agoThat depends on how good the error messages are. I can't see it being a common problem, but if there was a typo, I can imagine it being quite hard to find without an error message clearly indicating.
- RodgerTheGreat 11y agoNegative literals/negation/subtraction sharing "-" leads to odd corner cases in the grammars of quite a few languages. I'm rather fond of the J approach: -1 is the application of the negation operator to the literal one. _1 is the literal negative one. This is a very important distinction in J since you can have whitespace-delimited lists of numbers. "-1 2 3" is equivalent to "_1 _2 _3".
- oinksoft 11y agoThis is also true of Standard ML, where unary minus is ~, and APL, where unary minus is ¯
- pklausler 11y agoTo be most clear: The "high minus" in APL is not the unary negation function; it's part of the syntax for a negative numeric literal. If X is 1, "-X" computes "¯1", and "¯X" is ill-formed.
- klibertp 11y agoIn 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 benefits from it).
- PeCaN 11y agoPerhaps most notably, Haskell has the same behavior as LiveScript. EDIT: Derp, that's not true. (- 2) == (-2)
- pklausler 11y agoTo be clear: (- 2) is not a section in Haskell, it's effectively a numeric literal because '-' is Haskell's only prefix operator. Haskell has a 'subtract' function that's defined in its Prelude that is used where a section for (-) would be useful. It's a minor wart, and probably never going to be fixed. EDIT: clarified
- vram22 11y ago>Are completely different things (the latter is actually an error). Why is the latter an error?
- klibertp 11y agoIn 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.
- JadeNB 11y agoA moment's thought failed to turn up examples—which is almost certainly my fault. What is a context in which both could appear? In that context, what other languages treat them identically? EDIT: Ah, the documentation mentions: > This also means that `-1 is always parsed as prefix operator so code like `0..kArraySize div 2 -1` needs to be changed to `0..kArraySize div 2 - 1`.
- jboy 11y agoFor anyone who's interested in learning more about Nim, here is Andreas Rumpf (the creator of Nim)'s talk at the OSCON 2015 conference: https://www.youtube.com/watch?v=4rJEBs_Nnaw https://www.youtube.com/watch?v=4rJEBs_Nnaw ; and here's a longer, more-technical talk at the first Nim Workshop in November 2015: https://www.youtube.com/watch?v=zb3Sqs7lNJo https://www.youtube.com/watch?v=zb3Sqs7lNJo Here's the official Nim tutorial: http://nim-lang.org/docs/tut1.html http://nim-lang.org/docs/tut1.html And here is the very approachable "Nim by Example", which offers a series of short, simple lessons about the main Nim features: https://nim-by-example.github.io/ https://nim-by-example.github.io/
- dom96 11y agoGreat links! Also be sure to get in touch with us if you get stuck. We're usually pretty active on IRC [1] and the Nim Forum [2], but feel free to also ask questions on Twitter [3], StackOverflow [4] or Reddit [5]. 1 - http://webchat.freenode.net/?channels=nim http://webchat.freenode.net/?channels=nim 2 - http://forum.nim-lang.org/ http://forum.nim-lang.org/ 3 - http://twitter.com/nim_lang http://twitter.com/nim_lang 4 - http://stackoverflow.com/questions/tagged/nim http://stackoverflow.com/questions/tagged/nim 5 - http://reddit.com/r/nim http://reddit.com/r/nim
- desireco42 11y agoThis is really great little language. I really enjoy using it and executables I get from it can be very small which brings smile to my face.
- scardine 11y agoI like everything Andreas did differently from Python, except the unusual normalization rules for variable names. This is crazy: VariableName == variable_name == VaRiAbLe_NaMe
- keypusher 11y agoI 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.
- scardine 11y agoYeah, 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 (both user defined and PHP defined) * functions * class constructors * class methods * keywords and constructs (if, else, null, foreach, echo etc.)
- dom96 11y agoWhy would you need to unlearn it? Simply write code as you would write it in a case sensitive language.
- scardine 11y agoI'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` or `F_o_O_b_A_r`. If you can't see the trouble with this, I rest my case.
- KirinDave 11y agoNim's approach to parallelism is, for the general industry, basically groundbreaking and inspiring work. I really wish that this language got more attention. It can fill many of the same holes that Go fills without all the awkward dependency non-management and bad error handling. Similar story for Rust, it's got a lot of similar benefits without an ownership and extent model many people find confusing.
- elcapitan 11y agoI 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.
- vram22 11y agoWhy 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 https://en.wikipedia.org/wiki/Nim .
- telotortium 11y agoBecause 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 https://news.ycombinator.com/item?id=8351773
- vram22 11y agoWow, 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 https://en.wikipedia.org/wiki/What%27s_Up,_Doc%3F
- chestnut-tree 11y agoInteresting. 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 https://www.youtube.com/watch?v=sUgoBb8m1eE
- vram22 11y agoThere were also RAF Nimrod planes, IIRC.
- BuckRogers 11y agoI'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 actually fairly difficult to provide CPython2 compatibility. I do wish Nim the best and hope that it gains traction. More languages, more choices are always better.
- throwaway2048 11y agoI 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.
- patates 11y agoGreat news! I wish they invested a bit more to the concepts though.
- zyxley 11y agoThe way macros and dot operators work in Nim is super neato. Lots of interesting possibilities for DSLs and the like.
- xena 11y agoOne of the coolest i've seen in a while is Emerald: https://flyx.github.io/emerald/ https://flyx.github.io/emerald/
- andrewchambers 11y agoI had a play with nim and it wasn't totally to my taste. Another language that is worth checking out is myrddin http://eigenstate.org/myrddin/ http://eigenstate.org/myrddin/. If you haven't heard of it before, I would describe it as C with generics, type inference and pattern matching.
- fithisux 11y agomy 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.
- dom96 11y agoMaybe this could help? https://github.com/nim-lang/pas2nim 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.
- Mikeb85 11y agoThis 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.
- rspeer 11y agoI 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.
- dom96 11y agoAs 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?
- lobster_johnson 11y agoNot the parent, but: I disagree and think it's very good — much better than your average phpBB ugliness. But I would cut down on the pagination. 10 comments per page is insane on even small devices. A 70-comment thread (not long even by HN standards) means 10 page jumps. Those really mess with your ability to follow anything. I've not participated, but if I reply to something, do I then "follow" that thread, so I can get reply notifications?
- dom96 11y agoThank you for the feedback. Glad to hear that you think it's good :) Will definitely cut down on the pagination. Reply notifications are still not implemented but are on my todo list.
- rspeer 11y agoAh, sorry that I assumed it was all Araq's doing. Here's my feedback: I see no way to keep track of threads I've posted in, or threads I am interested in, or get notifications when people reply. That would be the most important thing. Maybe I'm missing something, because right now I read down the list of subjects for threads I'm interested in, and look for whether the most recent responder is different from who I remember. Writing forum comments in ReStructuredText is not friendly. Anyone who is not wise to the ways of the forum is going to fail the first time they try to post code, and I still have to look up a ReStructuredText reference, because I never use RST for anything else. Just use GitHub-flavored Markdown, the markup language of least surprise for developers. As another person responded, reading a thread longer than 10 messages is unnecessarily awkward. The navigation buttons -- which must be used frequently -- are not particularly prominent on a computer screen, and on a phone they're like a millimeter in diameter. Interface elements are strange. Why is someone's username a link if the page behind it doesn't do anything useful such as list their posts? Why does the timestamp have a dotted line under it? What am I supposed to be able to do with the timestamp? I would expect from other places that it would be a permalink, but it seems to just be nothing.
- flavoie 11y agoDo they have a clear roadmap to reach 1.0?
- jonathonf 11y agoLinked at the bottom of the homepage: https://github.com/nim-lang/Nim/wiki/Roadmap https://github.com/nim-lang/Nim/wiki/Roadmap