startProcess help (2)

2020-12-27 Thread Lecale
Thanks. I've been able to get started on what I wanted to do now. The main problem was that I was missing a couple of command line arguments which were essential to the process I was trying to interrogate. (oopsy!)

C++ FFI templates

2020-12-27 Thread mantielero
I think you are right. One thing that I have observed is that the [manual](https://nim-lang.org/docs/manual.html#importcpp-pragma-importcpp-for-objects) says: type StdMap {.importcpp: "std::map", header: "".} [K, V] = object Run It looks like this syntax is dis

Problem with sdl2 & nim

2020-12-27 Thread 19
Thanks for the info, the lesson and the help! I'll give it a whirl ; )

Problem with sdl2 & nim

2020-12-27 Thread Vladar
> I wonder why it doesn't do the same thing as C. Because C's switch statement is fall-through, and Nim's one is more [secure](https://nim-lang.org/docs/manual.html#statements-and-expressions-case-statement) > example project and it was leaking memory It might do such thing, the memory manageme

Problem with sdl2 & nim

2020-12-27 Thread 19
Oh hey now that fixed it! Thank you so much Vladar! I wonder why it doesn't do the same thing as C. I'll look more into the semantics. By the way, I was trying your sdl2 package's example project and it was leaking memory. Someone else tested it on the discord server and confirmed it. I don't

Problem with sdl2 & nim

2020-12-27 Thread Vladar
It seems that you are discarding KEYDOWN event, when the state is PRESSED: (1), and only checking event.key.state at KEYUP event, when the state is RELEASED (0).

Problem with sdl2 & nim

2020-12-27 Thread 19
I'm gonna keep ivestigating, I'm pretty sure I messed something up, but just wanted to share in case i was missing something. Thank you for your reply, I'll look into it.

Problem with sdl2 & nim

2020-12-27 Thread Stefan_Salewski
Nim low level event handler may need the cdecl pragma, when the handler is called from C code. But I don't know SDL2, sorry.

Problem with sdl2 & nim

2020-12-27 Thread 19
Hello, I am trying something that works in C but does not work in Nim and I can't figure it out. bool HandleEvent(SDL_Event *Event) { bool ShouldQuit = false; switch(Event->type) { case SDL_QUIT: { printf("S

Advent of Nim 2020 megathread

2020-12-27 Thread fxn
Just did, thanks for the pointer!

compiling to js but failed, generics not supported?

2020-12-27 Thread saem
If you try another generic structure like seq, etc... what happens? These errors remind me of ones I've encountered before when working with JS but my memory is fuzzy. For JS I've done [exports with a JSObject](https://github.com/saem/vscode-nim/blob/master/src/nimvscode.nim), and that might w

compiling to js but failed, generics not supported?

2020-12-27 Thread jrfondren
If something's not supported you should expect an error message about your code, not an exception from the guts of the compiler. In this case jsgen.nim#2324 is trying to read outside of an array: `resultSym = proc.ast[resultPos].sym` where `resultPos` and `proc.ast.len` are both `7`.

compiling to js but failed, generics not supported?

2020-12-27 Thread jiyinyiyong
I have a project and I wanted to compiled it to js. I tried and figured out I have to add `{.exportc.}` and then I got this error: /Users/chen/repo/others/Nim/compiler/nim.nim(119) nim /Use

Advent of Nim 2020 megathread

2020-12-27 Thread digitalcraftsman
@fxn I think your feedback can be very valuable to the project, especially from the perspective of an person new to a programming language. Did you already participated in [Nim's community survey?](https://nim-lang.org/blog/2020/12/17/community-survey-2020.html)

Advent of Nim 2020 megathread

2020-12-27 Thread jrfondren
Or better, put `{.push warning[UnusedImport]: off.}` at the top of your prelude.nim you'll still get a warning if you import it and then don't use any of its exports.

C++ FFI templates

2020-12-27 Thread xigoi
Shouldn't it be `T; ARRAYTYPE: Type` instead of `T, ARRAYTYPE: Type`, since `T` is a `typename`, not an `Array::Type`?

Advent of Nim 2020 megathread

2020-12-27 Thread xigoi
To disable unused module warnings, put `--warning[UnusedImport]:off` in your `nim.cfg`.

Advent of Nim 2020 megathread

2020-12-27 Thread fxn
I learned Nim for AoC, and had a blast. You express yourself in a very concise way. It is high-level, and at the same time very performant. Statistically typed, but with just the right amount of type inference. Read somewhere that it was not a better Python, but a better C/C++ that used whites

asynchttpserver basic-usage with error

2020-12-27 Thread miran
> The devel example works with devel Nim, but still fails against 1.4.2 Thanks, I'll investigate and backport needed stuff to 1.4.x, so it can work again in 1.4.4

asynchttpserver basic-usage with error

2020-12-27 Thread jrfondren
The `devel` example works with `devel` Nim, but still fails against 1.4.2

asynchttpserver basic-usage with error

2020-12-27 Thread miran
See the updated example in `devel` docs:

asynchttpserver basic-usage with error

2020-12-27 Thread Araq
It seems to be in incomplete backport. The code example should read: import asynchttpserver, asyncdispatch proc main {.async.} = var server = newAsyncHttpServer() proc cb(req: Request) {.async.} = let headers = {"Date": "Tue, 29 Apr 2014 23:40:08 GMT",

C++ FFI templates

2020-12-27 Thread mantielero
Yeah. The `Array::Type` is an enum. I got it like: type Type* {.size:sizeof(cuint),header: "Array", importcpp: "osg::Array::Type".} = enum ## The type of data stored in this array. ArrayType = 0, ByteArrayType = 1, ShortArrayType = 2,

C++ FFI templates

2020-12-27 Thread haxscramper_
Yes, your C++ wrapper should be working correctly

C++ FFI templates

2020-12-27 Thread haxscramper_
Most likely yes, though I'm not sure about `Array::Type` part. Can you provide definition of `Array` class too?

C++ FFI templates

2020-12-27 Thread mantielero
I have a template as follows: template class TemplateArray : public Array, public MixinVector { Run What would be the wrapping? Something like this? type Type* {.include:"myfile.hxx",importcpp:"TemplateArray".} = object TemplateArray*