Thanks a lot!
Didn't notice this post, sorry.
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
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
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
**@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
**@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
> 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
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
> 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
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.
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)
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
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
13 matches
Mail list logo