Help in compiling nim on android termux

2017-03-28 Thread amedeo
Hello guys am trying to install nim on android for fun as per this tutorial [http://stisa.space/articles/compile-nim-on-android](http://stisa.space/articles/compile-nim-on-android)/ but am getting an error **undefined reference to sigtimedwait** it seems that the **signal.h** in termux does not

nim source code auto formatter / prettifier

2017-03-28 Thread treeform
Is there something that can auto format / pretty nim source code? I am looking for some thing like go format or clang-format. I basically don't want to have formatting discussions ever again. An auto mated tool should just do it all. I don't even want configuration options, just that it should l

Re: How to create, destroy, and recreate threads

2017-03-28 Thread Araq
> If anyone wants to debug this, let me know. I can put together a full > test-case (via my corporate cloud server). I have 3 test-cases: 75k, 1.4M, > and 800M. This crash happens only on the largest, but at least it happens > pretty quickly. Sure, give me something I can work with.

Re: How to create, destroy, and recreate threads

2017-03-28 Thread cdunn2001
Besides, you can see in the _gdb_ session that the seg-fault is from dereferencing `0x10101010`, which is apparently some kind of sentinel, not a real address.

Re: How to create, destroy, and recreate threads

2017-03-28 Thread cdunn2001
I don't think OOM is the problem. I watch the process in _top_. The machine has 96GB. The program crashes after 1 to 5 threads have run, and each thread uses < 1GB. In fact, when I use the full 48-thread threadpool, it takes 30 minutes to run out of real memory (because of fragmentation), while

Re: pas2nim improved

2017-03-28 Thread adrianv
should have done it a lot earlier

Inject the whole tuple into expression

2017-03-28 Thread cdome
Hi, In the template I am trying to evaluate the boolean expression that is defined in terms tuple variable names. With one variable it is clear, we have a number of examples in the standard library: mapIt, allIt, filterIt and etc. But I am struggling to extend this approach for multiple variabl

Re: How to create, destroy, and recreate threads

2017-03-28 Thread Araq
One thing to keep in mind is that Linux and OSX turn out-of-memory into segfaults thanks to the memory overcommitment.

Re: cannot assign result of a template with block argument unless surrounded by a block expression

2017-03-28 Thread evacchi
that is correct. yet template foo(p: untyped): auto = (block: 1 ) let x = foo: discard won't compile, while this will let x = (block: 1 ) in fact, this compiles as well: template foo(p: untyped): auto

Re: pas2nim improved

2017-03-28 Thread Araq
Nice. Very cool to see my old baby pas2nim receive some love.

pas2nim improved

2017-03-28 Thread adrianv
For anybody who is interested in converting object pascal to nim, I have created a fork of pas2nim [https://github.com/AdrianV/pas2nim](https://github.com/AdrianV/pas2nim) which parses and converts a big amount of object pascal code: * class is converted to ref object * class, object and re

Re: Tut Part2 Object variants confusion

2017-03-28 Thread SidewinderMan
I suppose that the manual should have a more technical explanation of how object variants work (as it is meant to become the spec, right?) and then the Tutorial should have an example or two with more user friendly explanation.

Re: Tut Part2 Object variants confusion

2017-03-28 Thread SidewinderMan
I also just noticed a typo which is that it says "As can been seen" when it should be "As can be seen". Here's what I'm proposing for those two sentences: > As can be seen from the example, another advantage to this approach is that > no conversion between different object types is needed (as w

Re: cannot assign result of a template with block argument unless surrounded by a block expression

2017-03-28 Thread mashingan
>From example, if you think that's returning something it's indeed returning >exactly `not (a == b)` but not returning a `bool` value. It's only be `bool` >after evaluated in runtime.

Re: Tut Part2 Object variants confusion

2017-03-28 Thread mashingan
Ah, yes, after you mentioned it's indeed confusing. The example given is object variant but in explanation it's written as object hierarchy. I think the intended meaning is there's no need to create a whole object isa but instead opting to object variant is clearer. Also it can throw an error if

Re: How to create, destroy, and recreate threads

2017-03-28 Thread cdunn2001
Maybe there is still a bug in Thread? I now use threads in a very simple way: for q in get_seq_data(config, min_n_read, min_len_aln): var (seqs, seed_id) = q log("len(seqs)=", $len(seqs), ", seed_id=", seed_id) var cargs: ConsensusArgs = (inseqs: seqs, seed_id:

Re: Tut Part2 Object variants confusion

2017-03-28 Thread SidewinderMan
You may read it that way, but in that case you are essentially auto-correcting the error in your head, because that has the exact opposite meaning of what's written. I just wanted to confirm the intended meaning from the author if possible.

Re: Ampersand rendering glitch in tutorial

2017-03-28 Thread SidewinderMan
Thanks hcorion, I went and got the latest version of Source Code Pro fonts and installed them on my system, and indeed the problem went away. So that's great for me, but others will likely have this same problem and not know what to do. TBH, I'm not sure how the Source Code Pro fonts ended up on

Re: How to create, destroy, and recreate threads

2017-03-28 Thread cdunn2001
@cheatfate, Wonderful! Not just a new feature, but also a fix for a dangerous bug. Independent of that, I have found that create/destroy of threads is very fast (on OSX). So araq's idea of relying of thread destruction for fast memory clean-up works beautifully. (Large memory allocation is sti

Re: Nim version of

2017-03-28 Thread cblake
@Stefan_Salewski, you can also just call the libc memchr (which is what the current memfiles does to delimit lines aka slices until string conversion). A good memchr will do the SSE/AVX internally. For example this program: import memfiles, os, times var f = memfiles.open(param

Re: How to create, destroy, and recreate threads

2017-03-28 Thread cheatfate
@cdunn2001, you are correct. If you saw my PR, then you have seen issue it fixes [https://github.com/nim-lang/Nim/issues/4719](https://github.com/nim-lang/Nim/issues/4719).

Re: How to create, destroy, and recreate threads

2017-03-28 Thread cdunn2001
@cheatfate, Interesting, and good timing. What about this bit of **test/threads/treusetvar.nim** for your new code: +for i in 0..(ThreadsCount - 1): + var thread: Thread[Marker] + createThread(thread, worker, p) + joinThread(thread) +echo p.counter Shouldn't

Re: How to create, destroy, and recreate threads

2017-03-28 Thread cheatfate
@Jehan, reusing is now possible, but if you reuse variable, you must not use joinThread(s), because it will join only last created thread for this variable.