Hello,
I dabbled with Nim for a few days and I really love a lot about it. I love the syntax, I love the speed (although I had trouble getting very very simple SDL2 progs to run at constant 60 FPS). I love how simple it is to start with the language and how concise it is where it matters and I love how easy it is to use C stuff (although I had some trouble finding addr). But I miss the tools support and somehow I don't have confidence in such a new language that I will get things done without good debuggers and other tools and without hiccups. Debugging was a big problem for me. I would love to have more understandable generated C code for that.
I will check back from time to time and I am really sorry that I don't have the energy to contribute.
Keep up the great work!
Just thought I would add my similar experience:
I just started writing a smallish 3d game in this and its pretty amazing so far. Speed is great (so far) and I love being able to write lots of my small data structures as tuples and then create procs for them. I do something similar with namedtuples in python but this is much slicker.
I also had some difficulty getting an array of floats loaded into opengl as a matrix. Even after digging into the reference manual it was not very clear. The syntax I figured out is still miles better than C# or other high level languages that try to support low level memory access.
Thanks for building this great language :)
robohamburger: I also had some difficulty getting an array of floats loaded into opengl as a matrix. Even after digging into the reference manual it was not very clear.
The big gotcha here is Nim's (excellent) choice of defaulting Int and Float types to pointer-size/platform-fastest, meaning they're both 64bit on x86_64 architecture (32bit on x86 and ARM). Nim has specific types for interfacing with C functions: cint, cfloat, cstring, ect.. Using an array[SIZE, cfloat] is what you want for passing data to OpenGL or SDL (using float32 works too, but IMO using the c-types makes your intention clearer). You may have figured that out already, I'm just stating it here for completeness.
@robohamburger: I presume you saw Urhonimo? Just so you are aware :) Its a complete Nim wrapper for the Urho3D game engine which is very, very nice:
https://github.com/3dicc/Urhonimo
@kragil: As Araq said, if you compile with those two options then you can debug the executable using gdb which in turn means you can also use any of the slick C/C++ IDEs that use gdb. I have tested several of these successfully (should write an article) - on Linux I would recommend KDevelop or QtCreator. You can also get Nim syntax highlighting in QtCreator (and IIRC KDevelop) using:
https://github.com/PhilipWitte/NimKate
Note that this means you can do proper Nim source level step over/into/out of etc with breakpoints and all of it - not C/C++ generated source.
Is it possible to debug Nim in Visual Studio with --debuginfo --lineDir:on?
A screencast would add much to my confidence in this.
@novist: I told ya :) But yeah, it works on any IDE using gdb (and OderWat confirms it also works with lldb).
BUT... for VS there is a different solution I think, the VS plugin. Don't know much about it but I think Araq uses it?
although I had trouble getting very very simple SDL2 progs to run at constant 60 FPS
Make sure you're using -d:release or --opt:speed. It does work with debuginfo and linedir:on.
I couldn't get anywhere with the VS plugin, but you can definitely load the generated .c files, along with the .nim files, into a VS C/C++ project. Using the lineDir option, and ensuring you use cc=vcc in nim.cfg, you can set and hit breakpoints in the .nim files.
I don't know how useful it is. You can see variable values for fundamental types. Use the exportc pragma on desired vars/procs to bypass name mangling.
I've been pondering making a VS package to support Nim, aiming for code completions, watches, and hopefully some form of expressions, but my Nim skills are not (yet) up to the task.
I took three screenshots of the above that probably helps, and the one from when I am debugging:
http://files.krampe.se/nim/qtcreator/
So... yes, you can then build, run, debug just fine from within QtCreator. :)
@gokr: That is awesome!
Sadly I am now spending all my time fighting with 3 different IDEs instead of codeing. And for some odd reason I cant get the qt creator to run a custom executable (its always greyed out).
Perhaps there are more nim newbs on windows out there that would love to have a great debugger with qtcreator for their nim projects. Perhaps we could create sticky forum posts with step by step how to set up a working environment like the one you have. And perhaps together create project files that let you get started quickly. And with the DOtherSide QT for nim project, it might turn out to be something very usefull.
But a short writeup on how to get QTCreator up and running as a debugger for a nim project at least I would need. Including what debugger/compiler/platform you are using.
In case you find the energy and time. :)
NOTE: I also tried just attaching QTcreator to the running executable and it sais that its not a debug build. (I am running with --debuginfo --lineDir:on)