Re: Is it possible to tune C output to be truly human readable?

2019-08-22 Thread mratsim
I think the main issue would be the use of gotos :P

Re: typedesc with subtype won't compile when returning objects

2019-08-22 Thread LeuGim
And one step further from @lucian's template, returning procs: type SomeObject*[T: SomeNumber] = object val : T #ex3 proc test3impl[T : SomeNumber]: SomeObject[T] = # all actual code here echo "type is " & $T template test3*(T : typ

Re: Is it possible to tune C output to be truly human readable?

2019-08-22 Thread treeform
Have you seen what the generated C/C++ code looks like? Nim generated C code will use nim's seq and string implementation. I don't think you well get that passed C/C++ reviewers...

Re: typedesc with subtype won't compile when returning objects

2019-08-22 Thread GordonBGood
@: You can make your code trying to limit the contained type T inside your "SomeObject" container to SomeNumber successfully compile by the following, which forces the typedesc to appear to the compiler as a type; however, as shown, it doesn't accomplish what you desire in limiting the type to

Re: NumericalNim, a basic ODE and integration library written in Nim

2019-08-22 Thread hugogranstrom
Released version 0.2 which included Gauss-Legendre Quadrature, with 20 different methods with increasing accuracy ranging from 1 to 20 function evaluations per sub-interval.

Async net, what am I doing wrong?

2019-08-22 Thread blmvxer
import threadpool, asyncnet, nativesockets, random, strutils, asyncdispatch from os import sleep var sshVer = "" sock = newAsyncSocket(AF_INET, SOCK_STREAM, IPPROTO_TCP) proc genAddr(): string = randomize() var ip0 = rand(1..255) ip1 = rand(255) ip2 = rand(255) ip3 = rand(255) retur

Re: Nim vs. Python & Groovy (string splitting): Why is string splitting so slow in Nim?

2019-08-22 Thread brentp
hi @markebbert, re Zstd and htslib, see: [https://github.com/samtools/htslib/issues/530](https://github.com/samtools/htslib/issues/530) ping me if you have any questions on hts-nim.

Re: typedesc with subtype won't compile when returning objects

2019-08-22 Thread lucian
My take at limiting the `T` inside the `SomeObject` definition type SomeObject[T : SomeNumber] = object val: T #ex3 template test3(typ: typedesc = float) : untyped = echo "type is ", $typ let res = 10.typ SomeObject[typ](val: res)

Re: Nim vs. Python & Groovy (string splitting): Why is string splitting so slow in Nim?

2019-08-22 Thread markebbert
Thanks @jyapayne. It's nice to have this code I can look back on for future use. @brentp, fancy seeing you around here. I blame you for starting me on this little journey. :-P Thanks for pointing me towards the multi-threaded `.gz` decompression in `hts-nim`. I will definitely use that. Did you

Re: Data Structure Interpretation techniques

2019-08-22 Thread mratsim
Also my research code on writing a symbolic evaluator + compiler for computation graphs in Nim macros (extensible for JIT compilation): * [https://github.com/numforge/laser/tree/master/laser/lux_compiler](https://github.com/numforge/laser/tree/master/laser/lux_compiler) And the experiments

Re: Nim vs. Python & Groovy (string splitting): Why is string splitting so slow in Nim?

2019-08-22 Thread jyapayne
@markebbert Good catch! Thanks for debugging :P Now that you mention it, the whole section if data[last] == '\l': buffer.add data[pos+1 ..< pos+bufSize] else: buffer.add data[pos ..< pos+bufSize] Run can just be replaced with buffer.add da

Re: Nim vs. Python & Groovy (string splitting): Why is string splitting so slow in Nim?

2019-08-22 Thread brentp
just to add my 0.02 here as I happened on this and I have avoided using gzip stuff from nim as it is too slow. Mark (hi!), I know you linked to [hts-nim]([https://github.com/brentp/hts-nim](https://github.com/brentp/hts-nim)) but that will give you multi-threaded decompression for bgzipped files

rumpkernel or baremetal runtime to run Nim program standalone

2019-08-22 Thread dponyatov
Are any projects or tutorials exists on using Nim for programming rump kernels or bare metal programs? [http://rumpkernel.org](http://rumpkernel.org)/ What minimal API and POSIX libraries must be provided by the background C runtime to make Nim works?

Re: typedesc with subtype won't compile when returning objects

2019-08-22 Thread vitreo12
Thanks for the answer. I tried your example and it indeed works, even though I would prefer the simpler syntax of `T : typedesc[SomeNumber] = typedesc[float]` to work. In any case, I also came across this other error, when trying to limit the `T` inside the `SomeObject` definition:

Re: Back to Nim vs V

2019-08-22 Thread moigagoo
OP sounds like a professional offendee. Surely the term "fascism" was used in a broader sense than you're sticking to. Replace it with "totalitarianism" if you feel better this way. Anyway, that’s cheap word picking irrelevant to the topic discussed. I believe the thread should be removed, and

Re: Back to Nim vs V

2019-08-22 Thread SolitudeSF
medvednikov is a lowtier scammer and nobody should give him attention or respect. maybe araqs remark was a bit inappropriate, but freaking out over non issue isnt helping anybody.

Back to Nim vs V

2019-08-22 Thread Tristano
Since the [Nim vs V language](https://forum.nim-lang.org/t/4758) thread was locked, I'll post here my comments, for I just came across it. @Araq: > Or maybe it's because Nim is more effective than V at solving the problems it > was designed to solve. Not everybody believes in programming **lang

Re: Data Structure Interpretation techniques

2019-08-22 Thread Araq
Byte code interpreting is done in the Nim compiler itself: [https://github.com/nim-lang/Nim/blob/devel/compiler/vmdef.nim#L25](https://github.com/nim-lang/Nim/blob/devel/compiler/vmdef.nim#L25) [https://github.com/nim-lang/Nim/blob/devel/compiler/vm.nim](https://github.com/nim-lang/Nim/blob/deve

Re: Data Structure Interpretation techniques

2019-08-22 Thread Araq
Byte code interpreting is done in the Nim compiler itself: [https://github.com/nim-lang/Nim/blob/devel/compiler/vmdef.nim#L25](https://github.com/nim-lang/Nim/blob/devel/compiler/vmdef.nim#L25) [https://github.com/nim-lang/Nim/blob/devel/compiler/vm.nim](https://github.com/nim-lang/Nim/blob/deve

Re: Is it possible to tune C output to be truly human readable?

2019-08-22 Thread Araq
Well it's still C code, you can submit it for review and see what happens. ;-)

embedded development tutorial

2019-08-22 Thread dponyatov
What blogs or tutorials good as the intro to embedded development in Nim for MIPS/ARM (Linux targets, and bare metal)?