Hello all,
I have been thinking about Nim v2 lately and after speaking with @Araq about it I think we can be a lot more ambitious with what we change for this major release. The original plan is to change the default GC, but we can do much more (time permitting of course).
I wanted to create this thread to gather ideas. I think it would be brilliant to hear what everyone in our community would like to see changed. It's likely we won't all agree but I personally am very curious. Seeing as I will have some free time over the coming months I'd love to implement some of these ideas.
I have submitted one of my ideas as an RFC already:
If we were to talk about v2 changes, I hope the compiler will finally see some work on refactoring and making it more accessible to other developers. There's a hard Nim fork called Nimskull (yes, yes, "forbidden" word, I know :P) that has some good ideas, but I don't agree with their radical solution of hard forking.
Even tooling can't be made better because it all relies on the compiler - e.g. nimsuggest, nim check, etc.
If we were to talk about v2 changes, I hope the compiler will finally see some work on refactoring and making it more accessible to other developers.
That's something that can always happen without breakage. Let's focus on language/stdlib changes that need breakage :)
And please, please, let's remove all the backwards-compatible switches/deprecated procedures/etc for v2.
Definitely agree here. That sounds like an easy win too. Just need everyone's help to clean all this!
I would also like using tabs for indentation without the #? replace(sub = "\t", by = " ") first-line-stunt.
I agree, that mixing tabs and spaces (like Python allows) is bad, but using solely one kind of indentation character in the whole file should be allowed.
I don't want to go into a discussion about why two spaces are better than one tab -- I was all for 4 spaces 20 years ago myself when I started learning Python, but despite using this style for several years, I find myself being converted into a one-tab-per-indentation-level guy.
So please allow both, just not in the same file.
An idea:
Within your config.nims, maybe implement a macro within something like:
when defined(forceCaseSensitivity):
# do stuff
This macro could maybe loop through your project's non-stdlib and non-nimble modules, building a registry of identifiers and when there's a match it checks the sensitivity. Then do what you will with that information... you could have it rewrite the identifier, raise an error with a nice description of the line number, whatever.
You can totally do something like this if it's really that much of a problem.
If it's an issue with other projects, again, something can be written where it loops through stdlib and nimble packages updating the identifiers.
There are ways to solve this and force case sensitivity but as others mention when you actually sit down to write Nim it's a non-issue.
I mean that
var fooBar = 12
echo foo_bar
echo foobar
will not compile with --styleCheck:error option.
As always, having fooBar, foo_bar and foobar be 3 different things is a huge code smell and will eventually cause problem in a code base.