Re: Help understanding proc()

2020-04-16 Thread lscrd
Sorry, but your second example is no more valid than the first one. In both cases, as @Hlaaftana said, you need to declare the proc before referencing it.

Nim version of Flask Web Framework

2020-04-16 Thread drifter
Hello, Flask seems to be a popular python web framework. I was wondering if there was something similar for nim. I know of jester and rosenkrantz, but I am looking for something a bit more "batteries included". Anyone working on anything like this?

Re: Help understanding proc()

2020-04-16 Thread Hlaaftana
You can forward declare procs to reference them before they are defined. type Something = object act*: proc() name*: string proc someaction*() var something = Something(act: someaction) proc someaction*() = something.name = "boo"

Re: How to wait for all futures to complete

2020-04-16 Thread quetzalb
Looks like you need the `all` function from `asyncfutures` module [https://nim-lang.org/docs/asyncfutures.html#all%2Cvarargs%5BFuture%5BT%5D%5D](https://nim-lang.org/docs/asyncfutures.html#all%2Cvarargs%5BFuture%5BT%5D%5D)

Re: Idea: Nim Online Conference

2020-04-16 Thread stefantalpalaru
Until when can we procrastinate with talk submissions?

Re: How to wait for all futures to complete

2020-04-16 Thread adnan
I am basically looking for Nim's alternative to Go's `WaitGroup` package main import ( "fmt" "sync" "time" ) func main() { messages := make(chan int) var wg sync.WaitGroup // you can also add these one at

Re: v1.2 fails to compile "==" for standalone & gc=none

2020-04-16 Thread foldl
Here it is: [https://github.com/ingchips/ING918XX_SDK_SOURCE/blob/master/examples-nim/smart_home_hub/src/panicoverride.nim](https://github.com/ingchips/ING918XX_SDK_SOURCE/blob/master/examples-nim/smart_home_hub/src/panicoverride.nim) I can't test it at present. Even through, why 1.0.x is OK?

Re: Nim version of Flask Web Framework

2020-04-16 Thread SolitudeSF
https://github.com/planety/prologue

How to wait for all futures to complete

2020-04-16 Thread adnan
In my code I kept making calls to async functions that return future types from inside a loop. How can I prevent the main thread from finishing before all of those futures to finish? Note that it's inside a loop that creates are multiple futures that need finishing. proc main()

Help understanding proc()

2020-04-16 Thread Pixeye
## INVALID type Something = object act* : proc() name*: string var something = Something(.act : someaction) proc someaction*()= something.name = "boo" Run ## VALID type Something = object act* :

Re: how to properly release memory?

2020-04-16 Thread jyapayne
@jxy I've used deallocHeap in the past: deallocHeap(runFinalizers = true, allowGcAfterwards = false) Run

Re: I think we can really do better...

2020-04-16 Thread brianwil2727
Nim is a state of the art programming language well suited for systems and application programming Its clean Python like syntax makes programming easy and fun for beginners, without applying any restrictions to experienced systems programmers. Nim combines successful concepts from mature

Re: v1.2 fails to compile "==" for standalone & gc=none

2020-04-16 Thread foldl
No, it does not work for me with your `panicoverride.nim`. nim -v Nim Compiler Version 1.2.0 [Windows: amd64] Compiled at 2020-04-03 Copyright (c) 2006-2020 by Andreas Rumpf git hash: 7e83adff84be5d0c401a213eccb61e321a3fb1ff active boot switches: -d:release

Re: v1.2 fails to compile "==" for standalone & gc=none

2020-04-16 Thread foldl
> Each time there a pain in Nim, always look for a cure in C. I have to get rid of "==" and call `memcmp` for a cure.

Re: How to wait for all futures to complete

2020-04-16 Thread adnan
That seems to expect a `vararg`. I don't exactly know how many times I will be calling a new coroutine before the loop. The best I can do is add the future to a seq everytime I call a coroutine: futures: seq[Future[void]] for node in parseJson(j)["posts"]: if

Re: How to wait for all futures to complete

2020-04-16 Thread leorize
> Is there any way to convert a seq to vararg? Array types can be implicitly converted to `varargs`: [https://play.nim-lang.org/#ix=2ilk](https://play.nim-lang.org/#ix=2ilk) In fact, `varargs` is a syntactic sugar for `openArray` :) > A `varargs` parameter is an `openarray` parameter that

Re: v1.2 fails to compile "==" for standalone & gc=none

2020-04-16 Thread leorize
`--os:standalone` has been deprecated I think, the replacement is now `--os:any`: [https://nim-lang.org/docs/nimc.html#nim-for-embedded-systems](https://nim-lang.org/docs/nimc.html#nim-for-embedded-systems)

Re: Compile-time string obfuscation

2020-04-16 Thread juancarlospaco
This cool code worth a package IMHO.

Re: v1.2 fails to compile "==" for standalone & gc=none

2020-04-16 Thread PMunch
It seems like your issue is elsewhere, I tried myself with your cfg and code, and with this panicoverride.nim: proc rawoutput(s: string) = discard proc panic(s: string) = discard Run

Re: String constant concatenation

2020-04-16 Thread juancarlospaco
This is a bug Python never fixed, because on Python it can implicitly concatenate different strings, like F-Strings, non-Unicode strings, Raw strings, ASCII strings, etc, often a crash at run-time is the result.

Re: generate c++ code from .nim file

2020-04-16 Thread juancarlospaco
You can use a C++ code beautifier, like astyle, and skip the mangling with exportc pragma, but for reading only not for code thats actually used.

Re: Iterate over fields

2020-04-16 Thread Vindaar
If all of your procs are going to look like newFooBar above there, it's possible to generate with a macro. import macros, tables type Tensor[T] = object discard Model = object field1: string field2: string field3: int

Re: Idea: Nim Online Conference

2020-04-16 Thread miran
Applications are now officially open, please register via [this form](https://forms.gle/6TKMiRZ2bP5DyUyZA).

Re: Iterate over fields

2020-04-16 Thread Vindaar
> I'll look into your solution since I may need to adapt a few things (I've > simplified the real uses cases to summarize it into a single problems). The > goal is also to learn Nim's macro as well. I've now spent probably as much > time on macros than it would have took to write the solution

Re: generate c++ code from .nim file

2020-04-16 Thread minimisthupper
ok, big thanks for answering so fast! :)

Re: Iterate over fields

2020-04-16 Thread Clonk
> If all of your procs are going to look like newFooBar above there, it's > possible to generate with a macro. Yes, it's exactly what I'm looking for. A way to generate several procedure that follow a pattern. I've been trying my hand at writing macros that generate proc but there is a lot to

How to use wait for a Future to finish

2020-04-16 Thread adnan
I have an `AsyncHTTPClient`. It 1\. Gets content from a server that returns a json formatted string 2\. From that string, my script looks for specific json nodes that describes the media the `AsyncHTTPClient` should download. And then the client downloads the file. Now I am using the await

Re: How to use wait for a Future to finish

2020-04-16 Thread geotre
var j: string = getContent(webClient, link) Run should be j: string = await getContent(webClient, link) Run

Re: How to use wait for a Future to finish

2020-04-16 Thread adnan
Oh... Thanks might as well delete the thread. This is why I was talking about having a newbie section