oldwinapi status

2017-07-12 Thread geezer9
I noticed that **https://nim-lang.org/docs/lib.html** no longer lists **oldwinapi** My nimble copy of oldwinapi still seems to be working with nim version 0.17.0 Is that about to change? If so, what is/will the new MS windows api module called?

GObject Introspection based GTK3 high level bindings with nimble support

2017-07-12 Thread Stefan_Salewski
Well, first draft, and partial nimble support. [https://github.com/StefanSalewski/gintro](https://github.com/StefanSalewski/gintro) If you have GTK3 installed you may try. For 64 bit Linux and GTK 3.22 it should work. If "nimble prepare" commands fails, let me know. First goal is of course tha

Re: [noob] enums and index

2017-07-12 Thread LeuGim
If you'll add a type cast in inddexing, your snippet will work (either of them): echo capital[ITALY.int] And Byou can omit type in variable declaration altogether: var capital = ["Rome", "Berlin", "Lisbon"] But if the point is to just use explicit values for

Re: [noob] enums and index

2017-07-12 Thread DTxplorer
Thanks for the help Araq. The Nim enum behaves differently so I think this code reproduces better the Cpp code behaviour. const ITALY = 0 GERMANY = 1 PORTUGAL = 2 var capital: array = ["Rome", "Berlin", "Lisbon"] echo capital[PORTUGAL] Sorry

Re: [noob] enums and index

2017-07-12 Thread Krux02
I did not know this is possible. Seems very interesting.

Re: [noob] enums and index

2017-07-12 Thread Araq
No, arrays can use enums as the index type (and I use this feature all the time): type country = enum ITALY, GERMANY, PORTUGAL var capital: array[country, string] = ["Rome", "Berlin", "Lisbon"] echo capital[ITALY]

[noob] enums and index

2017-07-12 Thread DTxplorer
Sorry for the noobish question. I want to understand how using the enums like in C/C++ // Example program #include #include using namespace std; int main() { enum country {ITALY, GERMANY, PORTUGAL}; string capital[] = {"Rome", "Berlin", "Lis

Re: Nim Dynamic Libraries: exporting functions that return pointer-based types

2017-07-12 Thread Stefan_Salewski
RedFred, note that proc test_arr(): seq[int] {.cdecl, exportc} = ... return list may work better, as a seq is already a pointer. You don't want a pointer to that pointer. Of course the seq is more than a plain array internally, there is at least the size member an

Re: Error with using concepts

2017-07-12 Thread LeuGim
Just define `log(varargs[F])` before `log(Fer)`. From the error messages you see in the body of `log(Fer)` only this one `log` is known, compiler is unaware of the second.

Re: Nim Dynamic Libraries: exporting functions that return pointer-based types

2017-07-12 Thread mashingan
var p_arr = alloc(size_of(array[int, 3])) Above is incorrect syntax Do var p_arr = alloc sizeof(array[3, int]) Also [pointer arithmetic post](https://forum.nim-lang.org/t/1188#7366) should be helpful When you `alloc` something, it'll be put in heap, and untracked,

Re: Multidimesional Sequences

2017-07-12 Thread jlp765
You can combine the initialization into a single call import seqUtils var rows = 2 var cols = 3 var s = newSeqWith(rows, newSeq[string](cols)) for row in 0..

Multidimesional Sequences

2017-07-12 Thread Nimbecile
Hi, I'm trying to dynamically create a seq[seq[string]]. Below is what I came up with, and while it works, I'm wondering if it's the "right" way. At run time, the dimension sizes are known, so is an array more appropriate/efficient? Thanks for any insights you can provide. var rows

Re: Nim Dynamic Libraries: exporting functions that return pointer-based types

2017-07-12 Thread RedFred
Hi @mashingan, @Stefan_Salewski I find it impossible to allocate memory for array, as when I try to do something like: var p_arr = alloc(size_of(array[int, 3])) I get a 'type expected' error. Besides, if array is created on the stack then passing a pointer to it is meaningle

Error with using concepts

2017-07-12 Thread Xena
I am working on a structured logging library for Nim similar to [ln](https://github.com/apg/ln). I am having an issue with passing concepts to functions: import streams, strutils, tables type F* = Table[string, string] Fer* = concept x x.f() is F