Great write-up! I expected this to reference a few "normal" language features like static typing, operator overloading, or generics, but instead it was a list of some really neat off-the-beaten-track features: * Run regular code at compile time * Extend the language (AST templates and macros); this can be used to add a form of list comprehensions to the language! * Add your own optimizations to the compiler! * Bind (…
As a pythonista one thing that struck me in the code fragments is zeroes and ones appearing everywhere. It looks very easy to have off by one errors. (It is very rare to have off by one errors in Python due to the way counting and ranges work.)
What is special about Nim?
31–40 of 88 posts
Re: What is special about Nim?
#32Earlier quoted context omitted.
The idea that thisFunction and this_function are the same might be worse than the problem they're trying to solve. I cannot unfortunately have experience with larg-ish codebases in nim to tell if this would result in an actual problem or not, but the idea that I have to scan between two possible identifiers in the code can be a source of stupid bugs in the same vein as case-insensitive identifiers. On the other hand…
That seems like a really bad idea. It means that searching for an identifier requires you to allow for the possibility that there might be any number of underscores inserted anywhere. I suppose in practice you'll rely on the fact that no one will be inserting them other than at word boundaries, but it still seems horrible. (I'd worry about ambiguities of the experts exchange / expert sex change type, too, but my gues…
Either way, I still find the idea a bit weird. If the language wants to be opinionated about naming, maybe it could simply make _ illegal in an identifier or, to push it one level further, refuse to compile any identifier that is not camelCase.
Re: What is special about Nim?
#33Earlier quoted context omitted.
The idea that thisFunction and this_function are the same might be worse than the problem they're trying to solve. I cannot unfortunately have experience with larg-ish codebases in nim to tell if this would result in an actual problem or not, but the idea that I have to scan between two possible identifiers in the code can be a source of stupid bugs in the same vein as case-insensitive identifiers. On the other hand…
That seems like a really bad idea. It means that searching for an identifier requires you to allow for the possibility that there might be any number of underscores inserted anywhere. I suppose in practice you'll rely on the fact that no one will be inserting them other than at word boundaries, but it still seems horrible. (I'd worry about ambiguities of the experts exchange / expert sex change type, too, but my gues…
While this seems problematic they added some neat features to avoid problems with `uniqueness` of the name and so on.
One thing I wish at this point is to force the compiler to stop if this pattern is not uniform within a codebase.
Re: What is special about Nim?
#34Great write-up! I expected this to reference a few "normal" language features like static typing, operator overloading, or generics, but instead it was a list of some really neat off-the-beaten-track features: * Run regular code at compile time * Extend the language (AST templates and macros); this can be used to add a form of list comprehensions to the language! * Add your own optimizations to the compiler! * Bind (…
As a pythonista one thing that struck me in the code fragments is zeroes and ones appearing everywhere. It looks very easy to have off by one errors. (It is very rare to have off by one errors in Python due to the way counting and ranges work.)
proc createCRCTable(): array[256, CRC32] =
for i in 0..255:
You can write: proc createCRCTable(): array[256, CRC32] =
for i in result.low .. result.high:
Or: proc createCRCTable(): array[256, CRC32] =
for i, v in result: # index, value
Or define your own indices iterator: iterator indices(x) =
for i in x.low .. x.high:
yield i
proc createCRCTable(): array[256, CRC32] =
for i in result.indices:
I think I should propose adding indices to the standard library.Re: What is special about Nim?
#35https://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletio...
At what point does a language become noteworthy enough for a site that contains full entries for side characters in non-canonical Star Wars novels?
Re: What is special about Nim?
#36Earlier quoted context omitted.
That seems like a really bad idea. It means that searching for an identifier requires you to allow for the possibility that there might be any number of underscores inserted anywhere. I suppose in practice you'll rely on the fact that no one will be inserting them other than at word boundaries, but it still seems horrible. (I'd worry about ambiguities of the experts exchange / expert sex change type, too, but my gues…
Maybe you're thinking in terms of a text editor and not an IDE? With an IDE, you look for symbol references, not text with regexps. You could imagine that the IDE's search would be smart enough to know that if you look for foo_bar, it should also report occurrences of fooBar. Either way, I still find the idea a bit weird. If the language wants to be opinionated about naming, maybe it could simply make _ illegal in an…
(But I'm not much of an IDE-user myself. Perhaps modern IDEs have enough hooks that you really can control this stuff?)
Re: What is special about Nim?
#37A little OT: Courtesy of the Reddit discussion of the OP, a reference to the discussion on Wikipedia about Nim, or rather, the discussion to delete its Wikipedia entry: https://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletio... At what point does a language become noteworthy enough for a site that contains full entries for side characters in non-canonical Star Wars novels?
Re: What is special about Nim?
#38A little OT: Courtesy of the Reddit discussion of the OP, a reference to the discussion on Wikipedia about Nim, or rather, the discussion to delete its Wikipedia entry: https://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletio... At what point does a language become noteworthy enough for a site that contains full entries for side characters in non-canonical Star Wars novels?
Honestly, I thing a dozen Nim users should band together and register at Wikipedia to turn the vote the next time someone tries to delete the article. If the deletionists come with formalistic arguments, just synthesize a few articles on sites that fulfill their WP:RELIABLE criteria. There's got to be somebody working for a commercial (read: non-blog) website who doesn't like deletionism and would post a small articl…
Re: What is special about Nim?
#39tmp$cc -Wall -O2 test.c -o test && time ./test
real 0m1.041s user 0m0.998s sys 0m0.029s
nim-0.10.2$./bin/nim --opt:speed c test.nim && time ./test
real 0m1.943s user 0m1.894s sys 0m0.036s
Re: What is special about Nim?
#40A little OT: Courtesy of the Reddit discussion of the OP, a reference to the discussion on Wikipedia about Nim, or rather, the discussion to delete its Wikipedia entry: https://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletio... At what point does a language become noteworthy enough for a site that contains full entries for side characters in non-canonical Star Wars novels?
Honestly, I thing a dozen Nim users should band together and register at Wikipedia to turn the vote the next time someone tries to delete the article. If the deletionists come with formalistic arguments, just synthesize a few articles on sites that fulfill their WP:RELIABLE criteria. There's got to be somebody working for a commercial (read: non-blog) website who doesn't like deletionism and would post a small articl…
Your post will be seen by some wikipedians as a violation of some policy or other. (Off the top of my head there's sock puppeting http://en.wikipedia.org/wiki/Wikipedia:Sock_puppetry "Do not ask your friends to create accounts to support you.")