Move ref variable ro thread

2023-11-13 Thread c4UlMu
Here is example. I get SIGSEGV: Illegal storage access. (Attempt to read from nil?) When try to access person in `printer` I used `wasMoved(param)` but still param was somehow cleaned And I don't want to make a copy import std/strformat type Person = object n

is jester now working well with nim version 2

2023-11-13 Thread Araq
@PMunch Your article is excellent, thank you!

Strange string prefix

2023-11-13 Thread mmcol
Thanks for the explanation! const many_strings = [cstring"str1", cstring"str2", ... cstring"str9"] # output is something like {"str1", "str2", ... "str9"} Run Really helpful, thanks :)

Editor inlay hints?

2023-11-13 Thread xigoi
Keep in mind that if it's unclear what an argument means, you should use the `f(param = arg)` syntax so that your code is also readable for people who don't use this feature.

`nimpkgs` the nimble.directory alternative no one asked for

2023-11-13 Thread daylinmorgan
## Links * [nimpkgs.dayl.in](https://nimpkgs.dayl.in) * [source repo](https://github.com/daylinmorgan/nimpkgs) I was bored and wanted to make something with `karax` to play with the `js` backend, so I generated an alternative front-end to `nim-lang/packages`. It's client-side only and a s

Editor inlay hints?

2023-11-13 Thread 3-2-1
Oh sweet! Looks like it's on it's way to [VSCode](https://github.com/saem/vscode-nim/pull/134) as well.

Move ref variable ro thread

2023-11-13 Thread sls1005
`isolate()` already takes a `sink` parameter. You should call it when passing the variable to the thread (Do not assign it to another variable). Also you have to ensure that there's no other reference from the current thread to the variable; if there is instead two or more, destroy them until on

Move ref variable ro thread

2023-11-13 Thread elcritch
Just use `someProc(move(myVar))`. That should work even without a sink param.

is jester now working well with nim version 2

2023-11-13 Thread isaiah
thanks

Move ref variable ro thread

2023-11-13 Thread c4UlMu
Is it possible to move ref variable to thread? I've read `createThread` and it doesn't have `sink` on `param` argument. That is why I cannot move `Isolated` variable to thread. I thought about custom wrapper around createThread, where I would get ptr of ref variable, send it to thread, add wasMo

Which tools do you use to code in Nim?

2023-11-13 Thread john-sz
choosenim + nim + nimble + gvim(nvim???) zah/nim.vim inim (Because I found it here) hello_musl (Just found it and love the static compiles...) Warning Off Topic: I'm a Python hacker looking for a "faster" alternative. I've tried the Python speedups and found them lacking. I sort of hate Rust

Memory leakage caused by the use of asyncftpclient's rter process

2023-11-13 Thread Guozy69
Why does using asyncftpclient to loop through files in the working directory of the FTP server and calling the asynchronous procedure rter to download files cause memory to rise (memory leak)? I hope to receive an answer. Thank you (I am a beginner at nim)

Should closing a stream assign nil?

2023-11-13 Thread Araq
The rationale for not doing it is that it doesn't help as you can have many variables pointing to the same stream which would not be `nil`'ed out.

Strange string prefix

2023-11-13 Thread nrk
For debugging low-level details, it's always useful to check the generated C code. e.g. echo 'echo "hello, world"' > x.nim mkdir tmp nim c --nimcache:tmp x.nim Run Now you can find the source in `tmp/@mx.nim.c`. Let's search for our string: stati

Should closing a stream assign nil?

2023-11-13 Thread mszs
I was kind of expecting `close` to assign `nil` to the stream being closed. What is the rationale for not doing this?

Strange string prefix

2023-11-13 Thread Araq
Probably caused by name mangling, there is no reason to get rid of it as you can simply stop staring at the hex codes of your executable. For more help, see here:

Strange string prefix

2023-11-13 Thread mmcol
After inspecting the compiled executable through hex editor etc, I see some weird "@" prefix in my strings. What's it? How to get rid of it? screenshot:

is jester now working well with nim version 2

2023-11-13 Thread PMunch
I created a pretty complete guide to setting up a server for deploying Nim web servers:

Compile time code optimization.

2023-11-13 Thread Araq
Fwiw both optimizations that you did are common for runtime Nim as well.

is jester now working well with nim version 2

2023-11-13 Thread ThomasTJdev
Hi @isaiah When you compile your Nim code, it generates a binary. This binary can then be moved to your server and will be exposing the Jester port (e.g. `127.0.0.1:5000`). However, when using Jester, you should put a web server in front of it (like Nginx or Apache) and route the external ports