Show and tell: RPC on embedded devices

2020-10-12 Thread juancarlospaco
`--opt:size -d:strip -d:noSignalHandler` Theres also a program named `sstrip`, that you can try.

Redirect stdout for certain execution

2020-10-12 Thread tmsa04
Pakku redirects stdout after forking in src/utils.nim, that's with Linux. I've also been trying to gain a better understanding of this recently. The Nim language osproc functions like startProcess capture stdout, I think they use pipes to save the output as a variable and avoid files, not sure w

It's time to make Nim known ! ✊✊✊✊

2020-10-12 Thread shirleyquirk
tu peut parler francais au #francais discord

Redirect stdout for certain execution

2020-10-12 Thread AyJayKay
So, I fiddled around a little. First things first: I found dup and dup2 in the MingW sources. Is this why it is working out of the box when compiling from MacOS to Windows? Anyways, your solution - with importing the dups - does the thing for windows, too :) Consider the lovely phrase from the

Show and tell: RPC on embedded devices

2020-10-12 Thread Yardanico
Do you use `-d:release` or `-d:danger` (makes smaller binaries than release) or only `--opt:speed` (or size?)? Also there's `--panics:on` to convert some exceptions to unrecoverable errors. Also of course you should do `strip -s` on a Nim binary after compilation

It's time to make Nim known ! ✊✊✊✊

2020-10-12 Thread wintonmc
I have thought the same for this reason I made a video on YouTube and shared it on Facebook groups. When I did this, I realized that there is a huge percentage who do not know about the existence of Nim since they began to ask me about the language.

It's time to make Nim known ! ✊✊✊✊

2020-10-12 Thread torarinvik
In addition to facebook I think using youtube, reddit,stackoverflow is vital for spreading the word. There is a guy on stackoverflow that everytime he answer a question about programming he mentions how great Smalltalk is. He is relentless in his mission to get people to use it, that is how I di

Show and tell: RPC on embedded devices

2020-10-12 Thread elcritch
P.S. The standard ESP32 wifi example `smart_config` results in a binary that's `664kB`. The Nim WiFi + RPC version () above results in a binary that's `736kB`. That means the entire Nim runtime and all the standard

Show and tell: RPC on embedded devices

2020-10-12 Thread elcritch
Just showing off some work I did this weekend porting some internal code to the `nesper` library. It's an RPC library taken from `nim-json-rpc` but with async support cut out -- shout out to the Status-IM Folks for the handy rpc macros! It supports either JSON or MessagePack as the transport mec

Double for loops

2020-10-12 Thread pietroppeter
or maybe you want to loop over the tail of the sequences. here is this option compared with @araq's way in a simple example ([playground](https://play.nim-lang.org/#ix=2Auy)): var seq1 = @[ 1, 2, 3 ] seq2 = @[ 1, 2, 3, 4, 5, 6 ] for index in countdown(min(se

It's time to make Nim known ! ✊✊✊✊

2020-10-12 Thread archnim
We can create facebook groups in different languages, but with similar names (like nimlang_fr, nimlang_es, nimlang_it). Because some people would like to ask their questions on this forum, but they don't speak English. Even me, I find English hard, because I'm Francophone. Those groups will serv

It's time to make Nim known ! ✊✊✊✊

2020-10-12 Thread archnim
Hello world ! Everybody here loves Nim very much. But the fact is that our common baby is one of the less known languages. It's only used by a very low percentage of programmers. I'm sure that, if more people heard about it and its advantages, they would choose it. I'm also sure that, if we join

Standard formatting for documentation comments?

2020-10-12 Thread cblake
I _almost_ said "plus a few markdown". lol. Anyway, the only thing really missing from @symb0lic's perceived needs is a _convention_ of table-like per-parameter/return value doc formatting which he is already free to do for his own code. Might be too bureaucracatic/verbose to be popular.

Double for loops

2020-10-12 Thread cblake
It sounds like you want a generalization of [sequtils.zip](https://nim-lang.org/docs/sequtils.html#zip%2C%2C) (perhaps that takes a closure iterator that could go backwards like your example and metadata like expected iteration ranges). In Nim nothing stops you from just writing that and using

Double for loops

2020-10-12 Thread Araq
Sometimes a tiny amount of math does the trick: var seq1 = @[ #[First seq's content]# ] seq2 = @[ #[Second seq's content]# ] for index in countdown(min(seq1.len, seq2.len)-1, 0): echo(seq1[index] + seq2[index]) Run

arraymancer function apply

2020-10-12 Thread shallowHal
Thank you both for the quick reponses. This is very helpful

Double for loops

2020-10-12 Thread inventormatt
I believe what you are look for is zip which can be found in sequtils . it only works for two openarrays at a time but it should do what you are asking for.

Double for loops

2020-10-12 Thread archnim
Hello world. I was trying this morning, to loop on two seqs at the same time, but in a reverse order. For example: var seq1 = @[ #[First seq's content]# ] seq2 = @[ #[Second seq's content]# ] for index in countdown(seq1.len, 0): echo (seq1[index] + se

Understanding inject pragma

2020-10-12 Thread slonik_az
@exelotl: Thanks a lot! `{.dirty.}` solved the problem, indeed. Moreover, when I make both templates "dirty", I do not need `{.inject.}` any longer.

How to statically link libraries?

2020-10-12 Thread Yardanico
You just write your library normally (of course with adding exportc to the stuff which will be exported) and then use --app:staticlib

Understanding inject pragma

2020-10-12 Thread exelotl
Hi! I encountered this recently myself too, you can find some discussion and workarounds here: [#15314 Injected symbols aren't resolved properly in expression passed to inner template](https://github.com/nim-lang/Nim/issues/15314) The most general fix seems to be using the `{.dirty.}` pragma:

Understanding inject pragma

2020-10-12 Thread slonik_az
Hi ALL, I am trying to understand how `inject` pragma works and the following behavior is very surprising let xx = "global xx" template tt_outer(code: untyped): untyped = block: let xx {.inject.} = "(tt_outer) xx"

How to statically link libraries?

2020-10-12 Thread archnim
Hello world. What if I want to create my own static lib in Nim, how can I achieve that ?

Redirect stdout for certain execution

2020-10-12 Thread AyJayKay
Damn it, you are right. I can't compile for windows. With some pointer errors... I will look a little deeper into this when I've got some time.