Re: Nim in Action book

2017-08-01 Thread IronHawk
Thanks a lot! Didn't notice this post, sorry.

Nim in Action book

2017-08-01 Thread IronHawk
Hi all! Every month the book is delayed to next month. Now delayed to August and the date of publication is still estimated. The question is mainly to Dominik but (I hope) many people interested in answer to this: [what's a current situation with the

Re: Nim in Action is now available!

2016-08-23 Thread IronHawk
Hi @Stefan_Salewski! > In a book that makes absolutely no sense. >... > For Nim -- use one of the > many editors with great nimsuggest support. I now consider Nim for writing fast server-side scripts. And we have a park of headless servers with ssh-only access. So you can imagine how uneasy

Re: Nim in Action is now available!

2016-08-23 Thread IronHawk
Hi @dom96! Just ordered the book. Thank you for the discount! * * * Probably it would be good to have in the book some short reference of Nim's collections API. Because now to understand which methods for example the seq type supports the fastest is to use Internet search. `setLen` is in

Re: spawninig of more than 8 threads problem

2016-08-10 Thread IronHawk
**@wiffel, @Araq:** Thanks a lot! I really missed that it's impossible to use spawn with closures. :( So the sample should look like below one. It's much more verbose, but it works properly. import unicode, locks, os proc lenU*(s: string): int = result = s.runeLen

Re: spawninig of more than 8 threads problem

2016-08-10 Thread IronHawk
**@euant:** > I believe the below code does the same thing as you're trying to achieve, > though I think I might be misunderstanding your aim - as it stands, there > seems to be no reason to use threads whatsoever? The idea was: check how easiy (or hard) is to write in nim the app calling

Re: spawninig of more than 8 threads problem

2016-08-09 Thread IronHawk
> Well, I'm done with ideas. If you want to investigate further, I guess gdb or > lldb would be able to help you see what's happening. Anyway thank you for this discussion! Yes I also have no ideas. The C code produced is quite big: 23982 lines compiled, hmm... And I'm unfamiliar with

Re: spawninig of more than 8 threads problem

2016-08-09 Thread IronHawk
Hi flux! Thank you for your interest to this problem. Well... All you write is almost perfect, but in practice if we execute 10-20 threads then scheduler wakes up these T1, T2, ... T19 in cycle and even if we don't sleep or sleep 1ms it would work. You are right that when scheduler tries to

Re: How to obtain parameters and their types of akProc?

2016-08-09 Thread IronHawk
> Yes, you can do this. You need to store proc address somewhere and it's args > in simple case. > Essentially, you need to wrap this code into nice macro: > > ... Thank you for the answer. Yes, it's possible to call functions with predefined argument types/count. My question is more about the

Re: spawninig of more than 8 threads problem

2016-08-09 Thread IronHawk
Interesting addition: I just tested the same in Ubuntu 16.04 under VirtualBox with **2 virtual CPUs**. And it works for string lengths up to 5. With strings having 6, 7, 8 ... characters it hangs in 100% of cases.

Re: How to obtain parameters and their types of akProc?

2016-08-08 Thread IronHawk
Good, thank you! I'll try macros. But is it possible (in principle) to call the _testProc_ using its name and "parameter description"? I want to implement a procedure _callProc_ looking like: callProc("testProc", encodedParams)

spawninig of more than 8 threads problem

2016-08-07 Thread IronHawk
Playing with threads I found strange behaviour of _spawn_. I made a simple test of multi-threading: there is the routine proc multithreadedPrint(sMsg: string, nCount: int) which prints the specified string _nCount_ number of times. And each character of the string is printed

How to obtain parameters and their types of akProc?

2016-08-07 Thread IronHawk
Hi! If I have for example the code like this: import typeinfo proc testProc(s: string) = echo "do something with ", s var a = testProc var anyProc = toAny(a) echo(kind(anyProc)) ??? What should I use in place of ??? to get the parameters