When was Nimrod renamed to Nim?
[http://redmonk.com/sogrady/2017/06/08/language-rankings-6-17](http://redmonk.com/sogrady/2017/06/08/language-rankings-6-17)/
Re: messaging - or communicating between GUI's
Ok, a bit messy with the strings and your hard-coded msglen (4) etc, but here's where I got to: * * * There's a couple of superfluous cast[pointer] in my original, in both send and recv message. They were left over from developing (they have no effect because they were just casting pointer -> pointer), code looks a bit cleaner when just directly using the buffer pointer passed in (no cast needed). look for and change: * cast[pointer](buffer) -> buffer (two occurences) * cast[pointer](data) -> data * * * The address of a cstring var is not the same as the data location, you need the allocated memory addr at char[0], so in client prog need: data[][0].addr, # data to send * * * In the server prog I changed the type of Msg to: type Msg = array[50,char] and remove init of var b:Msg #= "ABC" * * * This gets the strings being passed across, but some more understanding and re-factoring are probably in order Hope this helps
Re: messaging - or communicating between GUI's
mmierzwa, as I'm on windows, I used Windows Named Pipes (not ipc) I adapted some example cpp code (see comments in paste) to get a basic server->client in nim. A bit of a simple hack (one direction messaging), but it worked for my needs. Here's an example, inc a basic test [server](http://pastebin.com/GJA4Q9w8) [client](http://pastebin.com/ApRqaHFc)
Re: Is it me or should this work?
Ok, thanks for the clarification I know Nim isn't python, but from a new user's perspective, all (or most of) the 'echo's in the nim manual are shown python-style eg. echo thing, not echo(thing) It would not be obvious to them (and wasn't to me) that the brackets (or implied brackets) and spacing are important. From the "Warning: a [b] will be parsed as command syntax" it is not exactly intuitive in the case of 'echo' that 'a' is the function and 'b' shown in square brackets is it's argument. (it looks more like array access) However, despite it's tone, your comment helped me gain that understanding, so thanks
Re: Is it me or should this work?
should it? [python] print (5 + 1) * 6 36 even 'echo ((5 + 1) * 6 ))' gives the 'spacing is deprecated' warning (just doesn't feel right to me, though I'm not a language professor) Oh well... thanks
Is it me or should this work?
Not exactly sure what I'm doing wrong var x = (5 + 1) * 6 # ok 36 echo (5 + 1) * 6# Error: type mismatch: got (void, int) Also, I find the new "Warning: a [b] will be parsed as command syntax; spacing is deprecated [Deprecated]" slightly confusing. Can anyone help explain, with an example? Thanks
Re: messaging - or communicating between GUI's
Success! Cobbled a client/server solution in windows using Named Pipes. Gui's can now run as separate processes with events passing between them. Thanks all, especially Mr. Ka whose links were not only interesting, but they got me to a solution.
Re: messaging - or communicating between GUI's
Thanks Ka, Varriout. Speed is not a concern as my controls gui2 is more of a designer for the 3d objects in a design mode. (sliders to manipulate a 3d objects size, orientation etc which I then need to pass/reflect in the opengl gui1) > >So its better and safer to use pipes, shared memory, fifos etc. By pipes, do you mean nim Channels? Shared memory / fifos - are there any examples? - I know I could use a seq for the messages or the nim queues module, or maybe even a one-size fits all shared struct, but it's the sharing of the struct/queue that's problematic. I will continue tinkering, many thanks all...
Re: messaging - or communicating between GUI's
Thanks Araq, yeah, I think separate processes are better, will have a look at nanomsg.
messaging - or communicating between GUI's
Hey all, I have two Nim GUI programs running and would like to know the easiest way to get them to communicate Gui 1. Is 3d physics environment using opengl, all wrapped in nim, I have the mainloop Gui 2. Is a nim IUP gui (uses nim IUP nimble package) with panels, buttons etc I would like the buttons & controls in Gui 2 to affect what's happening in Gui 1 Not sure of the best way - I can spawn gui2 from gui1, but data passing is limited to simple global vars. Ideally I would like some kind of event queue / message queue, I'm happy to write all my own event types, but not sure where to start ? There's threads, threadpool, asyncnet, sockets and all kinds of nim libs. There's also packages/wrappers for nanomsg.nim and zmq etc where to begin? what's the easiest way? I just need to pass events like eg. ['rotate', item 1, 1.5] or ['colour', item 4, 0,255,0] etc, simple stuff.. Many thanks
Re: What are concepts?
Oh I got it - the twoForOne procs are only working on a copy (not ref) of Foo. Sorry :)
Re: What are concepts?
Yeah, sorry, just spotted that..
Re: What are concepts?
This may be a silly question, but in the OderWat example above, on the two proc calls for type Foo (x), should x.v be updated in outer scope? i.e First echo shows (v: 5, s: Test), second echo shows (v: 5, s: Test) - on my system. Should the second call not then echo (v: 6, s: Test) considering x passed in as 'var' ?