Re: Nim in Action is now available!
Well then let's see if we can re-evaluate their relevance when you're going to write the second edition... ;)
Re: Nim in Action is now available!
Hello @gneu and thank you for purchasing my book. I have made a conscious decision to omit some things from the book, Nim is a large language and space is limited. Unfortunately term rewriting macros/templates didn't make the cut. The reason is that I personally haven't used them much, as such I don't think they will be used much by other people either.
Re: GTK 3.20 Nim wrapper
Stefan, do I really need -dev package?) Yes they're separate, but as I did not had to install GTK2 and GTK3 dev packages, I thought, that I will not have to install it. I'll make this in the near time (now I'm working with my teammate on game under UPBGE), after I'll correct some errors - I'll do this.
Re: GTK 3.20 Nim wrapper
> One thing I lack - RSVG Nim wrapper Let us know when you really need that. I think that lib is not that large, so it should not be much work to build the wrapper. Have you already solved your gtksourceview missing lib problem? I saw your github issue -- but one line comment that you can not load it is not enough. Is the lib available on your box at all. Maybe gtksourceview devel is a separate package for your distro.
Re: GTK 3.20 Nim wrapper
Thank you, I'll try to buy the book some time. 20 dollars is really not much. If it would be in my language - I would even ask a digital version of it. But in English it's not really good to read it. I use translator through every 2-3 sentences. I had already read tutorials and manual, I understood not all, but when I don't understand something - I re-read tutorialmanualmodule reference. If I did not understood after this - I ask in IRC or forum. I had some experience with gtk - I started making Omega Chess in Python and GTK. It was not finished (there was only board with switchable colors of cells, when you resize window - board resezed too), I learned Python and GTK through it, but I decided to learn Nim by re-writing this application to Nim and GTK. I spent many time reading API and asking questions in GTK+ IRC =) One thing I lack - RSVG Nim wrapper - in GTK IRC suggested me that if I want to keep images in RAM than to create from them GDK_Pixbuf -es, than I need to use RSVG. Without it images every window re-size are read from hard disk. I have only a little experience with compiled languages. Thank you for help.
Re: Nim in Action is now available!
@dom96: I'm a proud owner of your book since just a few minutes ago. To be honest, I did not read through this whole thread, so I'm not sure if my following remark was already discussed: What I'm missing at first look into chapter 9 is the topic "term rewriting templates". As a novice to Nim (coming from C++, Python, C# and Java), the first things I'm interested in are the metaprogramming features, cause this is where Nim seems to shine in contrast to the languages I'm familiar with. As your book is intended for readers already skilled in other programming languages, I think the metaprogramming techniques are also the most interesting part for other people. At least I struggled with my first steps in testing term rewriting templates and so would appreciate a section on this topic.
Re: GTK 3.20 Nim wrapper
When that is already a problem for you, you should ask yourself if you really need GTK. Do you have already much experience with GTK? You may know that GTK community is not very active currently, so it is very difficult to get help. The Krause book is only for GTK2, and the online API docs are fine, but it takes some time to read and understand it. And try to get the Dom book, I think you are the target audience. I already answered you in IRC -- contact Manning and ask how you can get the book in your country, 20$ is really not that expensive.. We should find a way. And read the Tutorial, it is really fine. For your question: TOPLEVEL flag is the default for newWindow(), so you do not need it. And when you want it, GTK3 flags are pure, so the identifier is WindowType.TOPLEVEL.
Re: typed values from c pointer
Thanks @Araq, I needed that code also.
Re: GTK 3.20 Nim wrapper
Can you help me to pass TOPLEVEL value to newWindow proc? [https://pp.vk.me/c638518/v638518447/89a6/sq_skFB78Js.jpg](https://pp.vk.me/c638518/v638518447/89a6/sq_skFB78Js.jpg) [https://pp.vk.me/c638518/v638518447/89af/8UirtMQnwLo.jpg](https://pp.vk.me/c638518/v638518447/89af/8UirtMQnwLo.jpg)
Re: Compile time calculated/dependend types
Ok, seems like I just did not test the cases that are not working ;) I think it has nothing to do with the wrapped types or the template at all. It is just the + operator that makes problems. And now things are getting really strange: import typetraits template myadd[L,R](lhs: L, rhs: R): auto = echo "lhs is " & $lhs.type.name echo "rhs is " & $rhs.type.name lhs # with this line uncommented and the next line commented, the code compiles #lhs + rhs # with this line uncommented and the previous line commented, the second call to myadd gives an error var r1 = myadd(2, 2.0) # => "lhs is int" and "rhs is float64" -> works with lhs+rhs in myadd var ai = 2 var bf = 2.0 var r2 = myadd(ai, bf) # => "lhs is int" and "rhs is float64" -> error with lhs+rhs in myadd (type mismatch: got (int, float64)) So at runtime, myadd tells me for both calls that it gets int and float64. However, if I uncomment the line "lhs+rhs" in myadd, then the compiler crashes in the second call to myadd (ONLY the second). At this point, I think someone with a little knowledge about how the compiler works should explain this behavior...