News for hackers. Stuff that matters.
Re:Learning Programming with Nim by germandiago on Sunday June 17, 2018 @11:56PM (#17335938)
Yes, I am genuinely interested. So I am going to ask a bit more. I am open to new and better tools :)

> I was actually talking about it from that direction, i.e. using C++ libraries in Nim. You can wrap pretty much any C++ feature in Nim: destructors, namespaces, you name it.

Is there any documentation about how to wrap my C++ code into Nim? I do get I can generate C++ from Nim, but I am not sure how it would look to use C++ from Nim. In D for me it is quite clear (with extern (C++) and there is a clear mapping for interfaces and other things. I do not need anything spectacularly fancy, just smooth. Y' know, I am a person who likes to finish things without getting too lost on the details.

You also mentioned many people consider Nim "production-ready". My question here is, if I start to try it, how many breakages can I expect? 4-5, in the tens? Until version 1.0 I mean.

And my last question: how does it compare to D if I have to:

- use a well-mantained GUI library in at least one system (multiplatform would be a big plus)

- how mature is the standard (and other libraries also if that is easy to add) library for: json handling, binary serialization, algorithmic code (a la range-v3 or ranges in D. Something along the lines of python iterators, functools, comprehensions and itertools also ok).

- would I be able to use Nim in embedded if I do a port of some software? Namely, would I be able to remove the GC?

One thing that worries me is that I am much more familiar with metaprogramming in C++ and D's metaprogramming is much closer than Nim's I guess. If you could refer me to good (as in up-to-date) Nim style I would highly appreciate it, specially in the areas of how to manage runtime polymorphism and metaprogramming with an eye on generative programming (basically I want to generate a bunch of things from 3 or 4 basic building blocks in arbitrary combinations).

Thanks for your time!

> Apologies. I just saw you reiterating the line I challenged without replying to me and was wondering what happened. Was just asking, not blaming :)

No problem, I just did not mean to make anyone offended :)

Re:Learning Programming with Nim by dom96 on Tuesday June 19, 2018 @06:02AM (#17345175)
> Is there any documentation about how to wrap my C++ code into Nim?

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

> My question here is, if I start to try it, how many breakages can I expect? 4-5, in the tens? Until version 1.0 I mean.

Depends which features you are using. The newer features (concepts for example) will likely have more breakages than the rest of the language. We already have a lot of code written in Nim and a book published (which we are committed to keep compatible with 1.0) so breakages should be minimal (unforeseen circumstances of course may happen).

> how does it compare to D if I have to: > > - use a well-mantained GUI library in at least one system (multiplatform would be a big plus)

I'm not sure about the status of GUI support for D. Nim has bindings to GTK/QML/libui and some other more experimental GUIs rendered using pure OpenGL (nimx). They are all cross-platform (although GTK on macOS is a PITA).

> - how mature is the standard (and other libraries also if that is easy to add) library for: json handling, binary serialization, algorithmic code (a la range-v3 or ranges in D. Something along the lines of python iterators, functools, comprehensions and itertools also ok).

JSON handling is very mature.

I don't think we have binary serialisation in the stdlib.

Algorithmic code - sequtils is what you're after I guess: http://nim-lang.org/docs/sequtils.html

> - would I be able to use Nim in embedded if I do a port of some software? Namely, would I be able to remove the GC?

Sure, but you won't be able to use a lot of the stdlib.

> One thing that worries me is that I am much more familiar with metaprogramming in C++ and D's metaprogramming

I suppose Nim by Example is a good place to look, it has some good metaprogramming examples: https://nim-by-example.github.io/

Also my book has a chapter on metaprogramming :) https://book.picheta.me/

Hope that answers your questions!

Re:Learning Programming with Nim by germandiago on Thursday June 21, 2018 @01:45PM (#17367481)
I must say that, even if unfamiliar to me, I am quite impressed about the C++ interoperability :)
Re:Learning Programming with Nim by germandiago on Thursday June 21, 2018 @01:41PM (#17367424)
Thanks for all the info! Really grateful :)