Hi! You bought me. I'm a new Nim user.
I have C/C++ (5 + 8 years) and C# (12 years) background. And a year ago I felt that is the high time to change C# to something more portable (I bought Android smartphone and I didn't want to write my software twice :). It was long year of learning almost every modern programming language. I was very disappointed about most of them (including go, rust - big disappointment - too simple). I wanted something that has at least the same features as C# + async/await is a must + macroprogramming + functional programming + very fast + portable + small executables. It is a perfect language for me (at least until I learn something new I cannot live without).
Finally I narrowed my choice to Vala, Haxe and Nim.
https://www.evernote.com/shard/s112/sh/62c451e1-8a65-41ba-a025-5570c0e5cabf/0c8ccb1b6fed4cca
Haxe scared me with hackish way of hxcpp implementation and Nim scared me with syntax (my mistake, I know). I refreshed Vala plugin for MonoDevelop. Now I'm in half way with plugin for Intelli-J. And I stopped. I wasn't happy without macroprogramming. And I didn't like the idea of porting gobject to Android.
So I came back to Haxe. The good point was I was able to test it on Windows and Android out of the box. And it has a good IDE support (IntelliJ / FlashDevelop). But then again. I couldn't stand the hackish way the hxcpp translator is made. That it is not main target language and may have bugs. That generics are compiled to dynamics. That it's only 0.5 or worse of the speed of C++. That "1 / 2" gives 0.5f and the best workaround is to convert float to int in the next step!! That compiled code is pretty big (however acceptable - but that's why I lost faith in IL2CPP at the beginning and QT as a framework for portable apps - I don't want a simple app to be 50MB). I hate that haxe's implementation of async / await macro is a some kind of joke and there are no libraries for it. I was looking at all of it this weekend and I was extremly happy when I realized that there was WWX2015 to watch online. But when I heard that Haxe users have huge problems with utf-8 strings and GC may be leaking memory I though - that's enough. It's totally crazy! Haxe is too big Hack for me...
I felt like I won on lottery when I read that today is online screencast on O'Reilly about Nim. Good to here that you are trying to adverties it!
So I started looking at Nim syntax. I started to evaluate - do I want to rewrite async/await macro (Haxe, and I did it once for Nemerle - I like Nemerle too, but it's only CLR) and stay with hackish language or to write plugin for IntelliJ (Nim) and stay with solid language. Fortunatelly async/await is implemented correctly in Nim. I thought - foregin syntax - maybe that's better - additional effort for my brain :) And this raised my excpectations of my perfect language even more. Now I added "ability to express great looking DSL" inside source code to my list. I now I really love that, too. And I love the macroprogramming design. The example of go's channels from Stefan ensured me it is a good choice.
Now I know that Nim is the only one language in the whole world that meets my requirments at fundamental level. For a moment I thought that I will have to start new one. And you know what? I don't care that it is not popular. It is completely unreasonable that other programmers skip it because they think if the development of it will stop they will be doomed. It's not true. It is more useful right now than other languages. And I'm a programmer. If there is a bug I can just fix it. What's the problem.
My plans are to have a plugin for IntelliJ (but maybe later, I expect more troubles with expressing grammar than it was with Vala). And work on multiplatform libraries. I want to achieve something like WPF / MVVM experince, write once run on Windows, Linux & Android. I want to write UI that is declarative, with bindings, with lookless controls with compositions (every control can be part of every control), fully stylable with animations. Guess what. There is exactly the same situation like with languages. I feel that everybody gets it wrong. I have enough of UI libraries with events, callbacs and setText calls with the only way of customisation by implementing new control and onDraw method..... grr..... Am I living in the 21st century or in the middle ages....? All the good ideas are there. They are not mine. And still it seems to me like nobody is willing to use them at all. New projects still use deprecated techniques.
DSL and metaprogramming support in nim will be perfect for me. For instance, I can fully express views in Nim :)
So I just wanted to say - thank you very much that at least I will not have to start writing my own language. Believe me I would love to do it, but life's too short. I still don't get why I'm disallowed to use tabs but I forgive you /actually I always thought that instead of text, source control should keep tokens and all the formatting should be done by editor regarding to user settings/ ;) Everything else is really solid. Thanks!!!!!!!!!!! Keep that good work!!!!!
TL;DR; Thanks for the best language.
Welcome Marek!
It's nice to hear that you like my async await implementation :)
"That "1 / 2" gives 0.5f"
Same in Nim, but there's 1 div 2.
"huge problems with utf-8 strings"
Nim is based on bytes and so is UTF-8, so as long as you're dealing with whole strings things are fine, but as soon as you deal with individual characters it's easy to write naive code that is broken for unicode. This includes the Nim lexer, which tries to get away with not knowing about unicode, but it treats any initial byte with hi bit set or any byte with hi bit set following an identifier char as an identifier char, and any byte with hi bit set following an operator char as an operator char. This means that a unicode operator immediately following an identifier will be treated as part of the identifier, and a unicode identifier immediately following an operator will treated as part of the operator. To do it right, the lexer needs to parse UTF-8 sequences and distinguish between code points based on their category. (This can be done O(1) with a table of ~16000 bytes, as opposed to the O(logn) binary search used by the unicode module.)
Marek: Sounds like you come from a similar place - I've been looking to replace C++ for 16 years (since I started with it ;-) and I was finally at a place in time now where I had the opportunity to spend some time looking around. I narrowed it down more and more, trying and evaluating all the options. And Nim was a bit of an Eureka. So far it seems like the best option, with the most future potential (there are things to iron out.. - but that's why we code on it ourselves, right! :-).
filcuc: I have an app in Qt, not QML, but the 'hard' stuff, is that something I'll be able to use in Nim - because I'd really like to port the whole app to Nim if Qt is available. There's a Qt Widget used in it that's of main importance, and I haven't found an alternative. (Sorry OT..)
Marek: "I still don't get why I'm disallowed to use tabs but I forgive you /actually I always thought that instead of text, source control should keep tokens and all the formatting should be done by editor regarding to user settings/"
There is a huge discussion about this somewhere on this forum, I also believe that storing code logic in the appearance of the code is a BAD idea, but hopefully you always attache your project to a SCM to be able to revert if something bad happens.
Anyway, Welcome to Nim.
Thanks to all!
@filcuc: Yes. I know QML and I like it very much. I like it on Linux with shared libraries. It will be great to use it with nim instead of C++!! Thanks! On Windows/Android the case is not the same for me because of the size of simple apps. Hm... maybe I care too much about it.
@dom96: I like your async/await implementation because you see difference between asynchronous and parallel code. You created future, dispatcher and use epoll / IO Completion Ports / select. Some people used to think that await is about creating threads... Having asyncfile, asyncnet, etc. already there is also very nice.
@jibal: "Same in Nim, but there's 1 div 2". Hm.. I didn't know yet. I've decided to switch to nim this week :) But thats's ok (it's more Pascal like language). In haxe (which is more C like language) there is no integer div operator at all and the best you can do is to write Std.int(a/b) which does three type conversions in the runtime.
"unicode operator immediately following an identifier will be treated as part of the identifier, and a unicode identifier immediately following an operator will treated as part of the operator" - wow - you impressed me :) However, I don't use unicode characters for identifiers (English is world standard here) but for localized strings (which is better to move outside source code anyway). I don't know what exactly problems they had in Haxe (I think it was about treating strings as ANSI strings) but watching WWX2015 I heard that TiVo company had to fork source codes because of localization needs and made changes for most of the libraries and said it was a plenty of work and they didn't contribute back this. They also fixed bugs in GC and speeded up it 7 times (that's what thay say) and didn't contribute it back. And probably they won't (they used excuse of incompatible API) - it's their adavntage over other game companies. And after all this fixes I still would be not satisfied with the speed of hxcpp generated code. Nim looks like it has less now, but it is much easier to add missing things to it and I hope the result will be better.
@ozra: I totally agree. The situation with UI libraries is exactly the same as with languages. There are plenty of them but only a few are worth attention. QML and WPF are the only ones I like today.
@xyz32: "There is a huge discussion about this somewhere on this forum" - I'll read it. Maybe I'll learn something new. For me it's simple - I don't use spaces to make code better looking (like for aligning variable intializers etc.) - it's waste of editing time. So different tab settings don't make my source code looking bad. And it's always better to insert/delete one tab than 2-4 spaces (I know there are editors for that). And everyone can set tab to any space he likes. With spaces if I decide to use 20 spaces you will all see 20 spaces, hahaha :D
@xyz32 how you manage to mess it up? Because copying example code works perfectly for me. maybe your editor thinks it is too smart and messes things up. Maybe it for instance expects 4-space indentation while examples use 2-space indentation?
Regarding tab width - it is set as number of spaces, not pixels. meaning tab width = space width * number of spaces.
Some of the IDEs convert it to spaces (and I would avoid those ones) but for example QtCreator keeps tabs as tabs, and you select how big the gap to be.
As for the formatting, once the indentation information is gone, the only way one can recover is by manual labor. I use kate editor with the nim support for it, and I thing there is a bug in there. Anyway this was just a demo if you lose the indentation information in nim, you lose the logic.
It's nice to hear that you like my async await implementation :-)
@dom96, So do I!
Always when I read about tabs vs spaces I wonder what "tabs" people mean, cause for me a "tab" is only useful as tab-stops which is like the next position in a grid like structure.
Originally the tab stops even had no unified spacing between them. I could have a tab stop in col 5 and one in col 11 the next in col 13 and a tab just jumps to the next tab-stop. This can never be expressed by a fixed number of spaces anyway.
So all you talk about is about using "even spaced tab-stops" for indenting and if you mix tabs and spaces you need to make sure that the tab(-stop position aka size is never changed or to never use tabs mixed with spaces.
IMHO an editor which makes "tab" into a fixed size of spaces is just plain wrong!
It's nice to hear that you like my async await implementation :-)
@dom96, So do I!
@cdunn2001, thanks!
This thread has really gone offtopic. Could we create a new thread for this tabs vs. spaces war?
@HOLYCOWBATMAN To be fair, though, tabs are pretty much silently shunned in Python code.
The only language I've seen mandate tabs in the style guide is Go.