Article series on multitasking in Nim, first installment: async

2021-09-07 Thread Yardanico
There's 'all' in std/asyncfutures and, if you don't need to care for the return value, you can also use asyncCheck

Article series on multitasking in Nim, first installment: async

2021-09-07 Thread geohuz
I'm wondering does nim have the facility like Promise.all() in javascript which can trigger multiple await in parallel and improve the performance of multiple async execution? For example, I have A request which takes 4 sec to finish, B request 5 sec, I want to have them running in parallel so I

Behavior of {.global.} variable for assigning to const

2021-09-07 Thread solo989
This works proc magicalProc(): int = var counter {.global compiletime.}: int result = counter counter += 1 block: const a = magicalProc() b = magicalProc() echo a echo b let a, b = magicalProc() ech

Article series on multitasking in Nim, first installment: async

2021-09-07 Thread deech
This was well written and I learned a lot! Can anyone comment on how Nim's async compares to Rust's in terms of static safety and perf?

Behavior of {.global.} variable for assigning to const

2021-09-07 Thread PMunch
Just for completeness sake, this also works: proc magicalProc(): int {.compileTime.} = var counter {.global.}: int result = counter counter += 1 block: const a = magicalProc() const b = magicalProc() echo a # Prints 0 echo b # Prints

Destroying ref objects

2021-09-07 Thread elcritch
> What in my eyes looks wrong is the fact that destroy is invoked for the > parent whenever the x.parent.children.delete(pos) is invoked, although it is > already nil. Tried what I could to inhibit with .nodestroy - no success (v > 1.5.1 orc/arc with/without --experimental). Perhaps I understan

Destroying ref objects

2021-09-07 Thread SFR0815
For the sake of completeness: > Your doParent is odd since it’s calling “parent destroy” twice but not at the > end. Had another look at this item. It's because I am using `discard` (& I shouldn't). Double call at the end is avoided by: proc doParent() = var parent

Accessing object properties where objects are in a sequence

2021-09-07 Thread Stefan_Salewski
Thanks. There are some more still: Will fix them soon, or replace by others :-)

Nim 1.6.0 RC1

2021-09-07 Thread pietroppeter
> There is no equivalent of the old `nimble develop`. It would be nice to have it back in some way or if it cannot be done it should be documented very explicitly ( _starting from version nimble develop does not anymore do…_ ). To be honest I have still not understood what is the purpose of dev

Accessing object properties where objects are in a sequence

2021-09-07 Thread xigoi
You have a typo in the book: `s/type save/type safe`

Nim 1.6.0 RC1

2021-09-07 Thread reversem3
Not able to update to 1.6 using choosenim choosenim update self [12:21:21] Updating choosenim Info: Already up to date at version 0.7.4 choosenim update devel [12:21:44] Updating devel Downloading Nim 2021-09-06-devel-30d28bcefcad0da8900cfa231be9d77bb98c5097 from GitHub [#

Nim 1.6.0 RC1

2021-09-07 Thread bobeff
> Isn't running nimble install once then nimble develop equivalent to the "old" > nimble develop ? It is not equivalent. There is no equivalent of the old `nimble develop`. Now the develop mode dependency packages are per project. There are no global development mode packages.

Nim 1.6.0 RC1

2021-09-07 Thread Clonk
> You should also be able to run choosenim to restore the links after you > delete the .nimble folder. On Linux, default choosenim installation (at least it is for me) is `$HOME/.nimble/bin/choosenim` , so deleting the `$HOME/.nimble/` folder delete choosenim; but yes this is what I did, I jus

Nim 1.6.0 RC1

2021-09-07 Thread bobeff
> Since updating, I've also found that nimble develop for local package will > not function properly if you haven't done nimble install first (which I don't > think was the case before). How the package develop mode is working is entirely changed. Please look at the [documentation](https://gith

Accessing object properties where objects are in a sequence

2021-09-07 Thread Neil_H
Hi Stefan, yes, object variants could be a solution however i am not sure that each instance taking the same ram as the largest one bodes well for my use case since certain objects may need to hold a sizeable amount of text (say 500 chars) where as other instances may only need to hold 1 charact

Nim 1.6.0 RC1

2021-09-07 Thread dom96
> but if you don't want to delete the entire directory you can simply delete > the nimbledata.json file, pkgs directory, and the links to binary packages > from the bin directory. You should also be able to run `choosenim ` to restore the links after you delete the .nimble folder.

Accessing object properties where objects are in a sequence

2021-09-07 Thread Neil_H
You have convinced me to have a look at Object variants first.

Article series on multitasking in Nim, first installment: async

2021-09-07 Thread Niminem
I think this series should be added to the tut section of nim-lang <3

Accessing object properties where objects are in a sequence

2021-09-07 Thread Stefan_Salewski
> certain objects may need to hold a sizeable amount of text (say 500 chars) > where as other instances may only need to hold 1 character. Note that a Nim string is a value object with a data buffer allocated on the heap for the actual text data. So sizeof(myStringInst) should be a small value,

Reading stream data only when there is data available

2021-09-07 Thread jasonfi
Thanks for the info. In the end I couldn't get it working, I'll just use a log file.

Nim 1.6.0 RC1

2021-09-07 Thread pietroppeter
I find very useful the `nimble develop` command and it is not clear to me if the new version is able to provide the same functionality. In the old documentation: > The develop command allows you to link an existing copy of a package into > your installation directory. This is so that when devel

Nim 1.6.0 RC1

2021-09-07 Thread bobeff
> Since updating, I've also found that nimble develop for local package will > not function properly if you haven't done nimble install first (which I don't > think was the case before). How the package develop mode is working is entirely changed. Please look at the [documentation](https://gith

Nim 1.6.0 RC1

2021-09-07 Thread bobeff
> It is really not clear to me what it is the purpose of the development mode > and where the nimble.develop file resides (global or package specific?) and > how it is used The develop file is package-specific and user-specific. It contains paths to packages or other develop files included in i