Re: Subtle memory management error found

2017-09-14 Thread Stefan_Salewski
Yes, better to avoid all the conversions between int and uint. Nim compiler does not really like uint, but can use it. Note that your Nim arithmetics are not identical to C arithmetic. For example in Nim code you have uint(k-Kn) So you use signed values for substraction, and

Re: Subtle memory management error found

2017-09-14 Thread Araq
None of these listings can be compiled. The only thing I can say is that I would never use `uint` for these kind of computations. Much too prone to silent over- and underflows.

Subtle memory management error found

2017-09-14 Thread jzakiya
I have identified a very subtle memory management error that took me weeks to characterize. I'm directly translating a working C++ program to Nim. The problem seems to be that the Nim code erroneously addresses the **seg** array beyonds its bounds, because the **k** values used to update the

Re: Cygwin almost perfect... Nimble pathing help

2017-09-14 Thread ggibson
"solved" Here's my hack, but it would be great to have a good way to specify that you're in a posix-like environment for pathing despite being on windows, and to use the cygpath utility as needed. I modified the source of nimble (src/nimblepkg/download.nim) in the doClone() function I

Cygwin almost perfect... Nimble pathing help

2017-09-14 Thread ggibson
Hi there, I finally got my cygwin+mingw32 environment to build nim. Everything works nicely except nimble barfs when trying to install anything. Is there a way I can tell it exactly what path to use or force nimble to use *nix pathing? Programs I write with nim work with *nix style paths on my

Re: Set of enums -- some caution is needed

2017-09-14 Thread Araq
Possible. The compiler dislikes enums that try to outsmart/override its chosen native representation.

Re: Generating custom C code - mixin doc?

2017-09-14 Thread Araq
There is little you cannot do with `emit`: template notSure(x, y) = {.emit: "kernel<<", x, ", ", y, ">>();".} notSure(1, 1)

Re: Containers of generic types

2017-09-14 Thread Tiberium
cdome: but one problem - vtrefs are not implemented yet

Re: Containers of generic types

2017-09-14 Thread cdome
vtref of concepts will do that. You can define a union type if you want to. There are other options, I don't see a problem here

Re: Containers of generic types

2017-09-14 Thread dawkot
Yes, I'm talking about storing different type values in one container, but in a safer way than by casting/storing raw pointers to values. In some other languages you can use interfaces for that, but if that's not possible in nim that would mean this feature is based on a VM?

Re: Containers of generic types

2017-09-14 Thread LeuGim
Probably you're asking about what here is discussed: [https://forum.nim-lang.org/t/3150](https://forum.nim-lang.org/t/3150); that is, on storing different (concrete) type values in one container. You have to choose between casts, object variants, refs to objects + dynamic dispatch (methods),

Re: Containers of generic types

2017-09-14 Thread Araq
No idea what you're talking about.

Re: Nim on Android

2017-09-14 Thread sdwfrost
I see that building csources on termux now works: pkg install libandroid-glob-dev libandroid-glob git clang nodejs pcre pcre-dev libsqlite git clone https://github.com/nim-lang/Nim cd Nim git clone --depth 1 https://github.com/nim-lang/csources cd csources sh

Re: List comprehension compilation error

2017-09-14 Thread sdwfrost
Ah, I see. I didn't know that I had to import math to get power, and I wasn't familiar with the syntax of binary operators to be able to interpret the error message appropriately. Thanks!

Containers of generic types

2017-09-14 Thread dawkot
Right now it's impossible to use containers based on generic types. Is it going to change, or is there some alternative?

Re: Running setCommand in a loop

2017-09-14 Thread RedFred
After some more experimentation I went with his: task test, "Runs the test suite": configForTests() var dir_list = listDirs("test") dir_list.add("test") keepItIf(dir_list, it != "test/nimcache") for dir in dir_list: for file in listFiles(dir):

Re: Nim-Chess4 with high level, gobject-introspection based GTK3 GUI (gintro package) is available

2017-09-14 Thread Stefan_Salewski
I have just uploaded latest version of gintro to github. The two reported bugs should be fixed now. And automatic memory management should work for the GTK boxed types also now. Chess board and the demo apps compile fine with Nim v 0.17.2 on Linux 64 bit. Now we have to do more testing and