Hi, I'm still trying to figure out async/await. I am writing a script that
parses a json returned by a forum API and tries to download all the files
described by the json. Writing a synchronous downloader script was a breeze:
[https://play.nim-lang.org/#ix=2gcb](https://play.nim-lang.org/#ix=2gc
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 langua
> 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.
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
> 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 addit
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 node
`--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)
@jxy I've used deallocHeap in the past:
deallocHeap(runFinalizers = true, allowGcAfterwards = false)
Run
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)
Until when can we procrastinate with talk submissions?
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.
https://github.com/planety/prologue
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
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"
## INVALID
type
Something = object
act* : proc()
name*: string
var something = Something(.act : someaction)
proc someaction*()=
something.name = "boo"
Run
## VALID
type
Something = object
act* : pro
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?
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?
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() {.a
Oh...
Thanks might as well delete the thread. This is why I was talking about having
a newbie section
var j: string = getContent(webClient, link)
Run
should be
j: string = await getContent(webClient, link)
Run
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 key
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.
Applications are now officially open, please register via [this
form](https://forms.gle/6TKMiRZ2bP5DyUyZA).
> 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 it
> 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
ok, big thanks for answering so fast! :)
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
This cool code worth a package IMHO.
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.
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
30 matches
Mail list logo