Idiomatic way to run a process in the background and close it when appropriate?

2021-05-03 Thread codic12
These look like good approaches. Thanks for the replies!

global var & thread

2021-05-03 Thread Neodim
true but how?) let say we have a core thread computing some data and side thread servicing an interface part per instance serial port, asynchronously. Obviously they should exchange some data. Using global vars leads to GC-unsafe errors. Well, it could be gotten around with {.cast(GCsafe).} prag

Nim packages and LTS Nim

2021-05-03 Thread Araq
We know from the Nim survey that most of our users are on 1.4 -- and for good reasons: ARC became useful with 1.4 and is considered to be critical for Nim's future. Lots of libraries (threading support?) can be done significantly better with ARC. In other words, we need a new LTS that makes ARC

global var & thread

2021-05-03 Thread jasonfi
In general I would say that the variable needs to be owned by one of the threads, then find a way to share this variable with the other threads. I'm not sure of the best way to do this in Nim though.

Nim packages and LTS Nim

2021-05-03 Thread halloleo
Reading thread [Nim 1.2.6 and Nim 1.0.8 are out! - Nim forum](https://forum.nim-lang.org/t/6625#41095) I noticed that we have a LTS version of Nim. How great is this! But how does the Nim's eco system relate to this? If 1.0.x is the LTS version, why are quite a few packages requiring pretty new

File IO for the JS backend on node

2021-05-03 Thread halloleo
> Does your project really needs Nim 1.3.5 ?. What Bug stop you from upgrading?. It's not a bug, it is just that our sysadmins/devops do not like to upgrade things "unnecessarily". But as said, I managed to convince them this time. :-) However, I think it is a bit of a general problem in the Nim

File IO for the JS backend on node

2021-05-03 Thread halloleo
> The newest nim is 1.5.x The tarball from Nim's download page is 1.4.6.

How to make Nim more popular

2021-05-03 Thread dom96
> I think thats something we all can do that literally needs $0, add ".nim" to > your nicknames on all your online profiles!. Awesome idea! Wanna make a thread dedicated to this to encourage more people to do? :)

Idiomatic way to run a process in the background and close it when appropriate?

2021-05-03 Thread dom96
There are two approaches: * Either use `spawn` and essentially watch the process in a separate thread, or... * Use `asyncproc` from the `asynctools` package () and watch the process asynchronously. I use the la

global var & thread

2021-05-03 Thread Neodim
well, it will work only at the start of the thread. But what is generally proper way to make variable accessible for a few threads working at runtime?

Generating code coverage with Nim 1.4.0

2021-05-03 Thread giaco
Today I've faced my first experience with code coverage outside python world, and it went nice by mixing some examples I've found online into a nimble task. There are probably better ways to achieve the same, but this is quick and easy to understand. It does the same coco does, but streamlined.

Issue with defaults for mutable generic function parameters

2021-05-03 Thread Hlaaftana
For default arguments, there is always a workaround: var v: Nothing proc myFunction(paramA: int, paramB: float, info: var InfoOrNothing): int = ... proc myFunction(paramA: int, paramB: float): int = myFunction(paramA, paramB, v) Run

Idiomatic way to run a process in the background and close it when appropriate?

2021-05-03 Thread jyapayne
You can look [here](https://github.com/halonium/halonium/blob/master/src/haloniumpkg/service.nim#L297) for an example in my halonium project. It currently will block until the webdriver process is connectable, but you'd have to find a way to determine that in your own code based on the executab

Idiomatic way to run a process in the background and close it when appropriate?

2021-05-03 Thread codic12
I do not want to use the shell, but run it directly.

Idiomatic way to run a process in the background and close it when appropriate?

2021-05-03 Thread codic12
I need to execute a child process while my main Nim code is running.

Issue with defaults for mutable generic function parameters

2021-05-03 Thread tsojtsoj
I'm trying to solve a little problem I have. I have a function `myFunction(paramA: int, paramB: float): int` that calculates something. In some situation I want to get additional information from inside this calculation like this: `myFunction(paramA: int, paramB: float, info: var Info): int`. B

Idiomatic way to run a process in the background and close it when appropriate?

2021-05-03 Thread codic12
I am fairly sure my code is not idiomatic, as it is directly using std/posix, with execl and fork; basically what you would do in C

How to make Nim more popular

2021-05-03 Thread xigoi
I don't think this would work for me… “xigoi.nim” is not any more mysterious than “xigoi”.

How does Nim ARC/ORC compare to Rust?

2021-05-03 Thread ynfle
This fragmentation is pretty common (in nim and other languages). We are a smaller community so we should be able to coordinate our efforts.

How to make Nim more popular

2021-05-03 Thread reversem3
Thats a great idea , I changed on matrix and irc but nim forum doesn't allow that functionality.

How to make Nim more popular

2021-05-03 Thread juancarlospaco
I remember in Python on the old 2.x days, the community was a lot smaller, organized to do simple things that had an effect online, we used to add ".py" at the end of the nicknames on all social profiles, that got people thinking and investigating "whats this .py they are into". I think thats s

nim-1.4.6_x64.zip/bin/nimble.exe reports as Trojan:Win32/Zpevdo.B

2021-05-03 Thread zulu
Malware authors could probably just pack the whole compiler into the binary for some cool metamorphic malware.

"TypeError: c_1455079.charCodeAt is not a function" on jsfs' readFileSync

2021-05-03 Thread halloleo
Done

How to make Nim more popular

2021-05-03 Thread xigoi
I'd say Nim's main strength is getting things right instead of making dumb decisions and then poorly trying to work around them. Unfortunately, that's a very generic thing and it's not going to convince developers with the “languages are tools for a specific thing” mentality.

How to make Nim more popular

2021-05-03 Thread Lecale
I use nim in the company I work for, but I'm not supposed to - to paraphrase "If you're scripting, you should be using python."

"TypeError: c_1455079.charCodeAt is not a function" on jsfs' readFileSync

2021-05-03 Thread juancarlospaco
Report Bugs in the repo.

File IO for the JS backend on node

2021-05-03 Thread juancarlospaco
Does your project really needs Nim 1.3.5 ?. What Bug stop you from upgrading?.

How to make Nim more popular

2021-05-03 Thread juancarlospaco
This can be a good topic for the next meeting. ;P

Idiomatic way to run a process in the background and close it when appropriate?

2021-05-03 Thread demotomohiro
What is "run it in the background" means? Do you run a console program but don't want it output stdout/stderr on the terminal? Or do you want to run a GUI program but dont want it show window? How do you send something to the child process? Using Command line argument? Pipe? socket? environment

Idiomatic way to run a process in the background and close it when appropriate?

2021-05-03 Thread juancarlospaco
To say if the code is idiomatic or not, you have to show code first.

Question about templates / macros

2021-05-03 Thread DomoSokrat
Small correction: functions are injected by default, so calling the first template twice will cause a redefinition error for `localFunc`, even without `{.dirty.}`. Dropping the `proc localFunc` as in the second version is the easiest solution. Another posibility is to put the template body insi

Question about templates / macros

2021-05-03 Thread marcomq
Thx! {.inject.} actually makes the sample code running. This helps a lot. Not sure why it didn't work in my other program earlier... Seems that it could have been an issue as I was using generics too. Avoiding the localFunc unfortunately isn't an option as I need to get values from JsonNode...

learn Nim regular expressions - regex, re , NRE

2021-05-03 Thread Araq
Done:

File IO for the JS backend on node

2021-05-03 Thread ynfle
The newest nim is 1.5.x

How to make Nim more popular

2021-05-03 Thread Willyboar
Karax moved to its own organization for this reason. Dom said that he is thinking to do the same with jester.

Question about templates / macros

2021-05-03 Thread PMunch
This is simply caused by template hygiene. In case `values` was defined in the scope you called `runWithBody` it would throw an error if `values` got redefined there. The solution is to mark `values` as injected, that was Nim makes it visible to the `body` port of your code: var ca

How to make Nim more popular

2021-05-03 Thread alexeypetrushin
>From the listed solutions, the "make more Nim videos" (especially recording >and publishing Nim Conferences) seems like the easiest option :)

learn Nim regular expressions - regex, re , NRE

2021-05-03 Thread alexeypetrushin
> I think it would be inconsistent to mark re as deprecated and advise to use > regex instead The message could be changed to something more consistent, like: NOTE: The `re` package is outdated, but going to be kept for backward compatibility reasons, please use github.com/nitely/nim-regex inst

Question about templates / macros

2021-05-03 Thread marcomq
Hi! I'm beginning to write some templates and I'm just not sure how to properly use them in the right way. Macros might be an option too, but they look much more complicated and I would have no idea how to solve it with macros. Anyway - I want to have some "callback" function that can be called

How to make Nim more popular

2021-05-03 Thread hankas
In my opinion, the success of a programming language is about finding and focusing on the unique core values. Go is a very productive language. It is designed to scale. One can switch teams and get everybody up to speed with the project easily. The code remains nice as the project grows, both i

learn Nim regular expressions - regex, re , NRE

2021-05-03 Thread Symb0lica
Yes. You can use **nimble search regex** to verify this

How does Nim ARC/ORC compare to Rust?

2021-05-03 Thread b3liever
There were multiple attempts to bring safe multithreading to nim: * * * * We could coordinate, right?

How does Nim ARC/ORC compare to Rust?

2021-05-03 Thread Araq
> Unfortunately, this doesn't work well for multi-threaded access due to > refcounts not being atomic. It requires unnecessary locking or requires > making local copies to avoid to avoid corrupting refcounts. All it takes is to _move_ the strings/seqs into the shared table. Would be helpful if

learn Nim regular expressions - regex, re , NRE

2021-05-03 Thread halloleo
For the uninitiated (like me): The current home of the library is [github.com/nitely/nim-regex](https://github.com/nitely/nim-regex), right?

How does Nim ARC/ORC compare to Rust?

2021-05-03 Thread Sixte
You want to ensure temporary immutability. You can try... the Pony language tried to do that. It requires a lot of view types. And, being made immutable, data have to stay immutable.

How to make Nim more popular

2021-05-03 Thread jasonfi
Many less well known languages gained traction because they had web frameworks that people wanted to use. Right now Jester is Nim's go-to web framework, but Jester itself could use a popularity boost. Jester should have its on website to promote it. This would help people to find and use it, an

File IO for the JS backend on node

2021-05-03 Thread halloleo
I was able to convince our DevOps to install the newest Nim! :-)

"TypeError: c_1455079.charCodeAt is not a function" on jsfs' readFileSync

2021-05-03 Thread halloleo
I'm trying `nodejs/jsfs` and get a node runtime error " _TypeError: c_1455079.charCodeAt is not a function_ ". Her my little program `read_try.nim`: import nodejs/jsfs requireFs() let data = readFileSync("sometext.txt") echo $data Run and I compile it

learn Nim regular expressions - regex, re , NRE

2021-05-03 Thread Araq
Assuming regex's author agrees to move it to the stdlib, we would lose the git history of the project and all clients who had `requires regex` in their .nimble file would need to update the dependencies. Maybe not immediately, but eventually. Not to mention that everybody has to migrate from re/

File IO for the JS backend on node

2021-05-03 Thread ynfle
1.3.5 is an unreleased version. All odd ones are

Idiomatic way to run a process in the background and close it when appropriate?

2021-05-03 Thread ynfle
Try [this](https://nim-lang.org/docs/osproc.html#execCmdEx%2Cstring%2Cset%5BProcessOption%5D%2CStringTableRef%2Cstring%2Cstring)

This Month with Nim: April 2021

2021-05-03 Thread miran
If you want to include your project for the next month (it doesn't have to be a new project), follow the instructions [here](https://github.com/beef331/website).