News for hackers. Stuff that matters.
Re:Is Nim a Transpiler? by no_time on Wednesday October 20, 2021 @10:25AM (#28930993)
>High-quality gdb/lldb debug information with source stepping, type information etc

Very nice. Last time I experimented with Nim the lack of this was the single biggest dealbreaker.

Re:Is Nim a Transpiler? by dsrw on Wednesday October 20, 2021 @11:25AM (#28931830)
With the '--debugger:native' flag, the Nim debugging experience isn't too bad. Not on the level of Java or C#, but you can set breakpoints, step in/over/out of code and inspect or watch variables without having to look at C code. There are some issues with type visualization (to see the contents of a string you have to evaluate something like '(char*)variable->data') but Nim ships with a gdb plugin that should help (I haven't actually tried it).

It could definitely be better, and hopefully some day it will be, but I use Nim in a debugger quite frequently and it usually works out pretty well.

Re:Is Nim a Transpiler? by no_time on Wednesday October 20, 2021 @12:26PM (#28932635)
It was roughly 3-4 years ago the last time I tried it. Happy to hear they made good progress since then.
Re:Is Nim a Transpiler? by gavinray on Wednesday October 20, 2021 @10:45AM (#28931260)
Well there's major drawback here:

  > nlvm does not:

  - understand C - as a consequence, header, emit and similar pragmas will not work - neither will the fancy importcpp/C++ features
  - support all nim compiler flags and features - do file bugs for anything useful that's missing
One of the unique and best things about Nim (IMO) beyond being multi-target, is that you can do things like say "emit this exact C/C++ string", or "import this type from an existing header".

With this LLVM backend, that doesn't work, and it doesn't support JS (which probably isn't a big deal to most people).

That means you can't do stuff like this:

  type
    VectorIterator {.importcpp: "std::vector<'0>::iterator".} [T] = object

  # std::vector<int>::iterator x;
  var x: VectorIterator[cint]

https://nim-lang.org/docs/manual.html#implementation-specifi...

https://nim-lang.org/docs/manual.html#foreign-function-inter...

https://nim-lang.org/docs/manual.html#implementation-specifi...