Re: What's the most idiomatic way to call ``execCmdEx`` in parallel?

2019-07-12 Thread OldhamMade
Thanks, I did take a look at that, but from the docs it looks like `execProcesses` doesn't allow me to get the return value of all executions. Or am I misinterpreting that?

Re: D templated codeblocks

2019-07-12 Thread bpr
I'm referring to the ability of D templates beyond the ability to write function or struct class templates, but templates over blocks that include new types and variables, almost like the parameterized module system of OCaml. Forgive me for writing D here, I'll translate it to Future Nim soon

Re: Windows 10 fails on the test code

2019-07-12 Thread Araq
Yeah, we know, but we haven't yet got a PR to fix this. (Hint, hint!)

Re: D templated codeblocks

2019-07-12 Thread Araq
To be honest, I'm not sure what you mean? Can you elaborate? Do you refer to [https://dlang.org/spec/template.html#aliasparameters](https://dlang.org/spec/template.html#aliasparameters) ?

Weird behaviour with generic type

2019-07-12 Thread vitreo12
Hello everyone! I am a new Nim user (and, I have to say, I am pretty excited about this language!) coming from Julia. I was tesing some of Nim's capabilities when coming to generic types and procs, when I ran into this code not compiling: type AbstractType = int or string

Re: Macro to create a dictionary (table) like in python!

2019-07-12 Thread zevv
Github pull request: [https://github.com/nim-lang/Nim/pull/11702](https://github.com/nim-lang/Nim/pull/11702).

Re: Macro to create a dictionary (table) like in python!

2019-07-12 Thread cblake
These association lists, often abbreviated "alist", get a lot of play in lisp, but also OCaml, Haskell, etc.. [https://en.wikipedia.org/wiki/Association_list](https://en.wikipedia.org/wiki/Association_list)

Re: What's the most idiomatic way to call ``execCmdEx`` in parallel?

2019-07-12 Thread rayman22201
@dawkot, unfortunately your implementation has a big performance flaw. the sleepAsync 5 creates a minimum bound of 5 ms on the execution time + the time it takes to run through the event loop. It's the naive solution to the problem. The more correct way to accomplish this with async is to

Re: Macro to create a dictionary (table) like in python!

2019-07-12 Thread miran
> What prevents it from being used only like this without "%", "@" or "toTable"? Just a two comments above: > `{}` is a sugar for array of tuples .

Re: Emscripten/WebAssembly GC considerations?

2019-07-12 Thread gemath
Due to the changes in emscripten you mentioned, my own WASM example code now compiles and runs fine with the following simple nim.cfg: @if emscripten: cc = clang clang.exe = "emcc" clang.linkerexe = "emcc" cpu = i386 @end Run and this

Re: What's the most idiomatic way to call ``execCmdEx`` in parallel?

2019-07-12 Thread dawkot
It would be something like this: import std / [osproc, streams, asyncdispatch] proc asyncProcess(cmd: string, args: seq[string]): Future[(int, string)] {.async.} = var p = startProcess(cmd, args=args) while p.running: await sleepAsync 5 return

Re: What's the most idiomatic way to call ``execCmdEx`` in parallel?

2019-07-12 Thread Stefan_Salewski
> I'm not particularly bothered whether it's threads or async, I just want to > execute the command in parallel rather than sequentially. Of course we know that async mean "non blocking", but not really parallel, see

Re: What's the most idiomatic way to call ``execCmdEx`` in parallel?

2019-07-12 Thread zevv
osproc execProcesses? [https://nim-lang.github.io/Nim/osproc.html#execProcesses%2CopenArray%5Bstring%5D%2Cproc%28int%29%2Cproc%28int%2CProcess%29](https://nim-lang.github.io/Nim/osproc.html#execProcesses%2CopenArray%5Bstring%5D%2Cproc%28int%29%2Cproc%28int%2CProcess%29)

Re: What's the most idiomatic way to call ``execCmdEx`` in parallel?

2019-07-12 Thread OldhamMade
In a way, yes. I'm not particularly bothered whether it's threads or async, I just want to execute the command in parallel rather than sequentially.

Re: What's the most idiomatic way to call ``execCmdEx`` in parallel?

2019-07-12 Thread OldhamMade
Thanks, I'll take a look at `asyncdispatch`. If you have time for a quick example, it would be most helpful!