For example, I cannot tell what compilation option I used but I remember I went for the max speed I could and that I used default Nim language constructs and default python constructs (no libs), the compilation was one of the most sold features so I believe I used the release mode and that there was a marginal difference in favouring of python (subsecond). Think However that python has also many optimizations for string manipulation and that under the cover all runtime objects are references whereas in compiled languages developers are naked in front of the CPU.
Knowing that you are core-dev I must say that building a language is very hard, and that by not bringing much to the state of the art and overselling too early it is easy to get compared and valued by subjective aspects or mere impressions. Heads up, keep it with the great work and do not take it personally, make the language shine in some unique aspect.
Also do not forget that my comment was just an unfavourable opinion based on some observations I made years ago; I could change my opinion on the language anytime and give it again a chance if it brings me any benefit for my development, or it is fun, or it has some solutions for the problems I need to solve.
Thanks for answering.
That said, I do agree with GP's first point, and can at least elaborate on it from my own perspective: At first I liked the implicit `result` variable, mostly just because it saved some typing. I quickly found it to be a source of confusing bugs, though, because accidental mismanagement of the feature would result in default values being implicitly returned rather than compiler errors. I think I ultimately agree with the Zen of Python here: Explicit is better than implicit.
Also, Nim has, by my count, three different ways of returning a value from a proc: The implicit `result` var, returning the value of the last expression, and explicit `return` statements. It has four if you count modifying ref arguments. That's pretty TMTOWTDI for my tastes.
import os
then both existsFile("test.txt")
and os.existsFile("test.txt")
will work whereas I prefer Python's forcing you to use the later. Nim is definitely a language for small teams where you can expect everybody to agree on sensible best practices and not get too clever.> I love these! No need for messing around with `StringBuilder` and the like.
D has immutable strings and no StringBuilder. Same with Python. Concatenating isn't exactly hard.
They are not arrays of characters until you use ASCII/KOI8 or similar encodings. So there is no point in mutating them, you need unicode normalization facilities, formatters and stuff to deal with them properly. And a proper mutable unicode string would give you a terrible performance penalty.
It's also what allows Python to do interning of strings, since they can't change.
let foo = someValue
var bar = someOtherValue
yields an immutable foo and a mutable bar for all types except strings.I'm guessing that's a detail that's lost on folks who haven't spent much time with Nim, because the way mutability and immutability work in Nim is different from how it works in any mainstream language.
By having mutable strings you lose the chance of relying on them as hashable objects and constant cost for comparison and several memory optimizations for duplicates and other optimizations when you have a runtime. There is a lot to win in the big game (or perhaps not that much if someone is thinking too much into a constrained system).
mutable string: a buffer made of chars which can be modified on demand with little memory
immutable string: some abstract data which ensures some properties that can be leveraged for many purposes
The disastrous handling of the transition python2 to python3 with UTF-8 string and the idiosyncratic nonsense like " ''.join([str1, str2]) to concat anything speaks for themselves.
Python 2 had several shortcomings, but not with strings I think. The transition to python 3 is more more a matter about a migration execution rather than a technical aspect related to strings (which I don’t find that terrible, especially given all facilities provided to make the migration easier to the new incompatible runtime).
That's political talk. In practice I never have seen a python library that do not blow up when migrated in Python 3 with a Unicode related error, because one of the dev was using python2 string as binary vector.
You should definitely give Nim another shot. It has been very pleasant to use.
> I love these! No need for messing around with `StringBuilder` and the like.
But if I get a string passed to me and want to hold on to it for later use, I can't be sure that someone else holding a reference to it won't modify it after I got it, right? So I will have to make a copy to be safe. Or does Nim solve this somehow?
> * A return variable within procedures that works in the same fashion as an assembly routine with a registry
Not sure I see the parallels between assembly and I don't understand why you think this feature is negative, can you elaborate?
> * Mutable strings
I love these! No need for messing around with `StringBuilder` and the like.
> * Mutable everything
That's simply false. You can choose between mutability and immutability, in fact you can even have an immutable `string` if you really want one: `let x = "asd"`.
Now let me discuss some of your other points:
> * Hate speech against functional concepts in the community (with all the related biases that this brings)
Communities are large. A lot of us love functional programming and are bringing more and more of it into Nim.
> * Some arrogant community members were tolerated just because they wrote popular blog posts on Nim implementing a fashionable pet project.
Can you elaborate on who this was and how/where they were tolerated?
> * no clear consistent design direction
> * too many pragmas
> * too many pascal syntax mixed with other language syntaxes
These are mostly subjective so there isn't much I can say. Perhaps Nim just isn't for you due to its syntax, but many out there love it.
> * no module namespacing
> * modules worked not much better than C libraries... (I am generalizing)
This is false too. Every imported module is in its own namespace.
> * python 3 (without any library or optimization) was faster than compiled nim to count words on a moderately large text.
Did you compile with -d:release? :)