Re: Setting up a FreeBSD VM for Nim development

2020-05-21 Thread refaqtor
I used to follow a similar path on FreeBSD and derivatives. But, if you're not needing to monkey with the nim compilers/tools and just want to code in nim, you can simply `pkg install nim` `pkg install nimble` I have, for a few recent FreeBSD installs, had version 1.2 installed

Re: raise error using zig as cross compile

2020-05-21 Thread zhouhaiming
Is there a way to transfer "\--release-small --strip" of zig to nim?

Re: raise error using zig as cross compile

2020-05-21 Thread zhouhaiming
You are completely correct, I am so sloppy ^_^ ^_^ # nim c -d:danger --opt:size --cpu:mipsel --cc:clang --clang.exe="zigcc" --clang.linkerexe="zigcc" --passC:"-target mipsel-linux-musl" --passL:"-target mipsel-linux-musl" gencfg.nim Hint: used config file

Re: Write Nim in Matlab/Julia style using macros while still deploy to Cloud/PC/GPU/embedded?

2020-05-21 Thread eyes
Thanks! Yes I did notice Arraymancer - it looks very exciting. Also I noticed Neo. I haven't tried them yet - will do that in the next few weeks. For plotting I am most used to Python's matplotlib and Julia's PyPlot wrapper. I am also playing with gnuplot since it's supported by almost any

Re: raise error using zig as cross compile

2020-05-21 Thread zhouhaiming
# nim c -d:danger --opt:size --cpu:arm --cc:clang --clang.exe="zigcc" --clang.linkerexe="zigcc" --passC:"-O2 -target mipsel-linux-musl" --passL:"-O2 -target mipsel-linux-musl" gencfg.nim Hint: used config file '/root/nim/config/nim.cfg' [Conf] Hint: used config file

Re: Write Nim in Matlab/Julia style using macros while still deploy to Cloud/PC/GPU/embedded?

2020-05-21 Thread mratsim
You're welcome to join the SciNim chat: [https://gitter.im/SciNim/community](https://gitter.im/SciNim/community) Regarding embedded and metaprogramming example, you might be interested in my [Synthesis](https://github.com/mratsim/synthesis) repo. It's a state machine generator implemented as a

Faster and Safer Raytracing in Nim

2020-05-21 Thread mratsim
So while looking for visual examples to showcase Weave, I went a outside of my comfort zone and tried my hand at graphics programming, in particular raytracing. # Faster I was pleasantly surprised to see Nim consistently faster than C++ on single-threaded code:

sl command of nim

2020-05-21 Thread jiro4989
I wrote `nmi` command. `nmi` display animations aimed to correct users who accidentally enter `nmi` instead of `nim`. `nmi` is heavily inspired by `sl`. [https://github.com/jiro4989/nmi](https://github.com/jiro4989/nmi)

Re: raise error using zig as cross compile

2020-05-21 Thread Yardanico
Well I don't think that's a Nim bug, but one thing you might try is to pass -O2 in --passC and --passL (it helped me in the past where by default i was getting SIGILL)

Re: arc and mimalloc

2020-05-21 Thread mratsim
Mimalloc is a dropped experiment to plug Nim's GC into Mimalloc provided hooks to amortize GC cleanups by running them as the same time as Mimalloc cleanups. Arc is different.

Re: raise error using zig as cross compile

2020-05-21 Thread zhouhaiming
Thanks, you are partial OK # uname -a Linux archlinux 5.6.4-arch1-1 #1 SMP PREEMPT Mon, 13 Apr 2020 12:21:19 + x86_64 GNU/Linux # nim --version Nim Compiler Version 1.3.5 [Linux: amd64] Compiled at 2020-05-20 Copyright (c) 2006-2020 by Andreas Rumpf

arc and mimalloc

2020-05-21 Thread sdwfrost
Dear All, Is the arc GC a rewrite of mimalloc? araqsgc is based on mimalloc ([https://github.com/Araq/araqsgc](https://github.com/Araq/araqsgc)) but I don't know whether it's the same as arc...

Re: How mature is async/threading in Nim?

2020-05-21 Thread Araq
> I may very well be missing something, ... Read mratsim's post from the same thread then, [https://forum.nim-lang.org/t/6352#39200](https://forum.nim-lang.org/t/6352#39200)

Re: Setting up a FreeBSD VM for Nim development

2020-05-21 Thread euant
Note: One thing I purposefully missed out is assigning more CPUs to the VM. By default, VirtualBox seems to assign a single CPU on my machine, but my machine has plenty of resources to share some more, so I tend to ramp it up a bit in the VM settings to 4 cores.

Setting up a FreeBSD VM for Nim development

2020-05-21 Thread euant
This post was requested by @timotheecour on [GitHub](https://github.com/nim-lang/Nim/issues/13166#issuecomment-631905175). In it, I’ll walk through my process of setting up a [FreeBSD](https://www.freebsd.org) Virtual Machine for the purposes of working on the Nim compiler and standard

Re: Write Nim in Matlab/Julia style using macros while still deploy to Cloud/PC/GPU/embedded?

2020-05-21 Thread eyes
Biased, yes; but also most qualified to answer this question. :-) Thanks for the confirmation! Right now the scientific/numerical computing ecosystem of Nim is still tiny compared to Matlab/Python/Julia. However, since there is no fundamental limit to reach from cloud to PC to GPU & embedded

Re: How mature is async/threading in Nim?

2020-05-21 Thread dom96
> I have limited experience with nim mobile apps. But knowing what I know don't > think I would use async on the client. Async is great if you are doing tons > of http style requests. But really a mobile client? Just regular threads are > probably better if you are just writing and reading from

Re: Write Nim in Matlab/Julia style using macros while still deploy to Cloud/PC/GPU/embedded?

2020-05-21 Thread Araq
> But is this within Nim's capabilities? Well yes, I think so. But maybe I'm a little biased. ;-)

Re: How mature is async/threading in Nim?

2020-05-21 Thread dom96
All this talk of `--gc:arc` makes me a little bit frustrated, I feel like @andrea has a similar reaction. The fact is that I have so far seen no evidence that `--gc:arc` makes mixing concurrency and parallelism in Nim easier (I may very well be missing something, so please educate me with

Re: raise error using zig as cross compile

2020-05-21 Thread shashlick
I compiled nimterop/toast with zigcc and it built fine like above but crashes at runtime in regex and cligen. We might need some testing on this configuration before people can start relying on it. Traceback (most recent call last) toast.nim(231) toast

Write Nim in Matlab/Julia style using macros while still deploy to Cloud/PC/GPU/embedded?

2020-05-21 Thread eyes
I am a newbie in Nim, impressed by its powerful yet easy-to-understand grammar, high performance, and low resource usage. Compiling to C is also brilliant in order to target numerous platforms with minimal reinventing-the-wheels effort. I've been a user of Julia since end of 2013. It has laser

Re: raise error using zig as cross compile

2020-05-21 Thread Yardanico
You need to first create a script like "zigcc" and put it somewhere in your PATH, the contents of the script being: #!/bin/bash zig cc $@ Run That is needed because Nim right now doesn't accept compiler commands if they have spaces in them (since it quotes the

Re: How to implement observer (publish/subscribe) pattern?

2020-05-21 Thread Kosteg
Thank you! Works great: import tables type EventEmitter = ref object eventsMap: Table[string, seq[proc(event: string)]] proc subscribe(emitter: EventEmitter, event: string, callback: proc(event: string)) = if not emitter.eventsMap.hasKey(event):

Re: How mature is async/threading in Nim?

2020-05-21 Thread jasonfi
I've tried to summarize the state of Nim's concurrency and parallelism in this blog post: [https://onlinetechinfo.com/concurrency-and-parallelism-in-nim/](https://onlinetechinfo.com/concurrency-and-parallelism-in-nim/). Some of it was based on this discussion.

Re: raise error using zig as cross compile

2020-05-21 Thread zhouhaiming
I actually want to compile the program to a static arm version

Re: raise error using zig as cross compile

2020-05-21 Thread zhouhaiming
# nim c -d:release --opt=size --passL:'-s -static -target arm' --cc:clang --clang.exe=clang --clang.linkerexe=clang hello.nim Hint: used config file '/root/nim/config/nim.cfg' [Conf] Hint: used config file '/root/nim/config/config.nims' [Conf] Hint: system [Processing] Hint:

Re: raise error using zig as cross compile

2020-05-21 Thread SebastianM
Try with Nim devel as zig support was implemented about April 25. It sould work there (as I'm using it) and for me it works but only with --cpu:arm not arm64.

Re: raise error using zig as cross compile

2020-05-21 Thread Araq
_shrug_ Not our bug. :-)

Re: raise error using zig as cross compile

2020-05-21 Thread zhouhaiming
# nim c --cpu:arm --cc:clang --clang.exe=zig --clang.linkerexe=zig hello.nim Hint: used config file '/root/nim/config/nim.cfg' [Conf] Hint: used config file '/root/nim/config/config.nims' [Conf] Hint: system [Processing] Hint: widestrs [Processing] Hint: io [Processing]

Re: raise error using zig as cross compile

2020-05-21 Thread Araq
It's `cc:clang`.

Re: Using generic objects and inheritance at the same time.

2020-05-21 Thread gemath
> Inheritance WITHOUT generics: use "method" not "proc" or it will fail. > Inheritance WITH generics, use "proc" not "method" or it will fail. And no, I > don't know why. Not sure whether I understand that correctly: does it mean that the third code example wouldn't work with `method sayFeet`?

Re: raise error using zig as cross compile

2020-05-21 Thread zhouhaiming
# nim --cpu:arm --cc:zig --zig.options.linker: "-target arm-linux-musleabihf" --zig.options.always: "-target arm-linux-musleabihf" c ./hello.nim command line(1, 2) Error: unknown C compiler: 'zig'. Available options are: gcc, switch_gcc, llvm_gcc, clang, bcc, vcc, tcc, env, icl, icc,

Re: closure procs with the javascript backend

2020-05-21 Thread Araq
That's a bug in `dom.nim`, fix is in the works.

Re: raise error using zig as cross compile

2020-05-21 Thread Araq
You should use `--cc:clang --clang.exe=zig`.

Re: raise error using zig as cross compile

2020-05-21 Thread SebastianM
You forgot to provide architecture for code generation. Please add --cpu:arm just after nim command: nim --cpu:arm --cc:zig --zig.options.linker: "-target arm-linux-musleabihf" \--zig.options.always: "-target arm-linux-musleabihf" c ./hello.nim