141 points · by andybak · 10y ago · 79 comments
Here's the official Nim tutorial: 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/
1 - http://webchat.freenode.net/?channels=nim
2 - http://forum.nim-lang.org/
3 - http://twitter.com/nim_lang
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.
VariableName == variable_name == VaRiAbLe_NaMeI 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 the same, and where the actual function is determined by smart traffic-analysis sensors in the car. It would certainly be easier for beginners, but I imagine that it would produce worse drivers; for example, you couldn't drive anyone else's car.
> would you really want to have two different variables called VariableName and variable_name in scope?
Yes, sometimes! (Not that particular example, but there have definitely been cases when I have wanted variables with the same letters in their names but different capitalisations.)
Personally I believe code is harder to read than to write, so I favor languages that are easier to read.
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.
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_sensitiveMy 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.)http://blog.codinghorror.com/the-case-for-case-insensitivity...
(- 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).EDIT: Derp, that's not true. (- 2) == (-2)
It's a minor wart, and probably never going to be fixed.
EDIT: clarified
Why is the latter an error?
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.If X is 1, "-X" computes "¯1", and "¯X" is ill-formed.
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`.
What's up, Doc? :)
Another language that is worth checking out is 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.
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.
What would you say should be improved in the forum to make it less painful to use?
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.
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?
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.
Imagine Nim using LCL (Lazarus Component Library) or mseide code.
I think they should rethink it.
The Nim compiler was originally written in Pascal and Araq used this tool to translate it into Nim, so it should work pretty well.