<< 02-05-2021 >>

00:26:13*teal joined #nim
00:27:04*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
00:27:24*njoseph joined #nim
00:32:37*NimBot joined #nim
01:19:00*SofarUpYa joined #nim
01:37:53ForumUpdaterBotNew thread by RainbowAsteroids: How does Nim ARC/ORC compare to Rust?, see https://forum.nim-lang.org/t/7905
01:49:40*SofarUpYa left #nim (#nim)
02:02:58reversem3<FromDiscord "<ElegantBeef> nixfreak i've neve"> https://github.com/filcuc/nimqml/blob/master/examples/connections/main.nim
02:03:53*teal quit (Quit: food)
02:08:47*abm quit (Read error: Connection reset by peer)
02:27:53*hyiltiz quit (Ping timeout: 240 seconds)
02:30:38*hyiltiz joined #nim
02:30:38*hyiltiz quit (Changing host)
02:30:38*hyiltiz joined #nim
02:33:58ForumUpdaterBotNew thread by Adnan: How to make Nim more popular, see https://forum.nim-lang.org/t/7906
02:57:50FromDiscord<codic> is it safe to rely on an experimental feature like codereordering?
02:58:30FromDiscord<Rika> i would argue no
02:59:28FromDiscord<ElegantBeef> Well code reordering i believe is an exception since it's eventually going to be no longer needed as Nim will by default figure out how to layout the code as needed
02:59:45FromDiscord<ElegantBeef> Atleast i think that's the goal
03:00:45*wasted_youth2 quit (Quit: Leaving)
03:01:18leorizeyou should not rely on it now
03:01:41leorizethe current implementation is horrible and a proper one requires IC to be completed
03:15:00FromDiscord<codic> ah ok
03:15:15FromDiscord<codic> so i'll just forward declare for now then
03:44:05ForumUpdaterBotNew thread by Masiarek2: File - copy Line by line - error , see https://forum.nim-lang.org/t/7907
03:47:56*spiderstew joined #nim
03:50:41*spiderstew_ quit (Ping timeout: 240 seconds)
04:06:48FromDiscord<codic> If I'm fairly certain that I'm not going to have my own cyclic structures should I use `arc` instead of `orc` for that speed boost? I don't think I'll run into speed performance but in my project (an init system) speed is critical. I might have non-blocking services, so I'm leaning towards `orc`
04:07:08FromDiscord<codic> But as for the implementation of those non blocking services I'm not sure if I should use regular threads, which I'm more familiar with, or async
04:07:57FromDiscord<ElegantBeef> Well if you know it doesnt have cyclical structures Arc seems fine to my dummy knowledge
04:08:02leorizethere is no speed boost from using arc if your project is full of acyclic structure
04:08:06*thomasross quit (Ping timeout: 240 seconds)
04:08:25leorizeyou can tag your types with `{.acyclic.}` and orc will work like arc on those structures
04:08:41FromDiscord<ElegantBeef> Yea Orc falls back to the cycle collector when it has to
04:08:44leorizewe have benchmarks on this, orc is not slower than arc
04:11:47FromDiscord<codic> i wonder if the optimizer does that automatically
04:11:55FromDiscord<codic> in that case i'll just use orc
04:12:03FromDiscord<codic> but should I use threads or async?
04:24:24leorizeit depends on the problem you're tackling
04:24:31leorizeif it's computational, use threads
04:24:43leorizeif it's I/O based, use async
05:24:56*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
05:32:08*Gustavo6046 joined #nim
06:02:46*vicfred quit (Ping timeout: 240 seconds)
06:32:25*kayabaNerve quit (Remote host closed the connection)
06:32:53*kayabaNerve joined #nim
06:37:52*kayabaNerve quit (Ping timeout: 240 seconds)
06:39:15FromDiscord<codic> well I'm not really doing any work, I'm just spawning a child process
06:39:20FromDiscord<codic> so I guess that's I/O
06:39:23FromDiscord<codic> probably async then
06:40:40FromDiscord<codic> or well maybe threads?
06:40:42FromDiscord<codic> I have no idea
06:40:48FromDiscord<codic> i don't need futures or anything else async has
06:41:20*kayabaNerve joined #nim
06:41:32*kayabaNerve quit (Remote host closed the connection)
06:41:35FromDiscord<Rika> Async if I/O, threads if computation
06:41:58FromDiscord<Rika> In reply to @codic "or well maybe threads?": Why did you think to use threads here?
06:41:58*kayabaNerve joined #nim
06:42:16FromDiscord<Rika> What exactly are you doing?
08:14:30ForumUpdaterBotNew Nimble package! crowngui - Web Technologies based Crossplatform GUI Framework, see https://github.com/bung87/crowngui
09:20:04*kayabaNerve quit (Remote host closed the connection)
09:23:19*kayabaNerve joined #nim
09:38:37ForumUpdaterBotNew Nimble package! nimothello - A teminal othello (reversi) in Nim., see https://github.com/jiro4989/nimothello
09:57:13*clyybber joined #nim
10:00:25*Tlangir quit (Ping timeout: 265 seconds)
10:33:56*wasted_youth2 joined #nim
11:01:12*lritter joined #nim
11:02:01*rockcavera is now known as Guest55743
11:02:01*Guest55743 quit (Killed (weber.freenode.net (Nickname regained by services)))
11:02:01*rockcavera joined #nim
12:19:07*zidsal joined #nim
12:22:22FromGitter<offbeat-stuff> Hi, I have a nimscript that I want to run with the dir of where the nimscript is located regardless of where it is actually located
12:38:12FromDiscord<Rika> uh, what
12:38:16FromDiscord<Rika> i dont understand
12:41:17FromDiscord<Solitude> he wants paths to be relative to executable, not cwd
12:42:18FromGitter<offbeat-stuff> actually got it working
12:42:30FromGitter<offbeat-stuff> let relDir = splitFile(paramStr(2)).dir
12:42:57FromGitter<offbeat-stuff> it should work always because i run it like ../run.nims
12:43:03FromGitter<offbeat-stuff> first line of it is
12:43:11FromGitter<offbeat-stuff> #!/usr/bin/nim e
12:58:33*fredrikhr joined #nim
12:59:50*fredrikhr quit (Read error: Connection reset by peer)
13:00:12*fredrikhr joined #nim
13:21:15*gangstacat quit (Ping timeout: 260 seconds)
13:47:25*vsantana joined #nim
13:50:56*xet7 quit (Remote host closed the connection)
13:55:02*gangstacat joined #nim
14:15:21*xet7 joined #nim
14:52:25*thomasross joined #nim
14:57:24*thomasross quit (Quit: Leaving)
15:00:55*thomasross joined #nim
15:01:18*thomasross is now known as Guest71323
15:05:24giacowhy does strformat doesn't work with float subrange type?
15:08:08giacohttps://play.nim-lang.org/#ix=3lBP
15:10:27*Guest71323 quit (Quit: Leaving)
15:10:44*Guest71323 joined #nim
15:11:26*thomasross_ joined #nim
15:11:26*thomasross_ is now known as thomasross
15:12:04*thomasross quit (Remote host closed the connection)
15:12:06*Guest71323 quit (Read error: Connection reset by peer)
15:12:09reversem3Ok so slots is a macros for qobjects using nimql A QObject is made of :
15:12:09reversem3slots: functions that could be called from the qml engine and/or connected to Qt signals
15:12:20*thomasross joined #nim
15:12:29reversem3* Ok so slots is a macro for qobjects using nimql A QObject is made of :
15:12:29reversem3slots: functions that could be called from the qml engine and/or connected to Qt signals
15:22:37reversem3Damn that’s a lot to unpack creating Qt apps.
15:36:06giacohttps://nim-lang.org/docs/parsexml.html example uses an undefined "=?=" operator
15:37:45FromDiscord<Rika> It’s defined in example 2
15:42:28giacooh! you're right, damn I need a coffee
15:54:50*vsantana quit (Read error: Connection reset by peer)
16:00:04*guelosk[m] quit (Quit: Idle for 30+ days)
16:01:25*Jesin joined #nim
16:36:23ForumUpdaterBotNew thread by Masiarek2: Wikipedia: nim reference - regex engines - comparison , see https://forum.nim-lang.org/t/7908
16:53:24*natrys joined #nim
17:06:26ForumUpdaterBotNew thread by Masiarek2: Regex , see https://forum.nim-lang.org/t/7910
17:19:17*zidsal quit (Ping timeout: 260 seconds)
17:38:02FromDiscord<matf> 👋Anyone have a good guide or intuition for when to use `object` vs `ref object` ?
17:43:47FromDiscord<dom96> hm, I have an intuition, hard to put it into words
17:44:04FromDiscord<exelotl> yeah, I want to say use object by default, unless you need to keep a lasting reference to the object
17:45:18FromDiscord<matf> Oh no. Googling around I was coming to the conclusion I wanted `ref object` most of the time. Heh. I'm glad I'm asking
17:45:25FromDiscord<dom96> I would say: start with `object`, if you find yourself writing `var T` everywhere for that object it could be time to use `ref`. There are also situations where `ref` is a must, if you for example have an object that needs to reference itself.
17:47:04FromDiscord<matf> @dom96 That makes sense. in that way, I'm saying `object` is generally immutable. if I'm var T'ing it all over the place, I probably just want to be updating the actual object rather than copying instead. Correct intuition there?
17:47:48FromDiscord<haxscramper> `object` vs `ref object` is not immutability, it is about heap/vs stack allocation
17:48:21FromDiscord<haxscramper> `ref` object has reference semantics so it can be viewed as "generally mutable",
17:48:27FromDiscord<haxscramper> but that is only a consequences
17:49:32FromDiscord<haxscramper> If you find yourself writing `var T` everywhere it might be a time to use `ref`, but you can also simplify code with `using` statement
17:50:31FromDiscord<haxscramper> https://github.com/nim-lang/Nim/wiki/Lesser-known-Nim-features#using-statement
17:52:07FromDiscord<haxscramper> So `objects` vs `ref object` decision also might include considerations like: ↵- how often do you plan to copy it? Copying `ref` is just incrementing counter, copying `object` might be costly
17:52:26FromDiscord<matf> Hrm. Still trying to figure out a heuristic to use. "small object, rarely updated" -> object. "big object, rarely updated" -> object. "big object, updated often" -> ref object.
17:52:36FromDiscord<matf> (edit) "Hrm. Still trying to figure out a ... heuristic" added "(rough)"
17:52:37FromDiscord<dom96> meh, I would avoid using "lesser known features" 🙂
17:52:39FromDiscord<haxscramper> no "rarely updated" part
17:53:03FromDiscord<haxscramper> In reply to @dom96 "meh, I would avoid": `using` is the single best thing I've learned in the long time
17:53:55FromDiscord<haxscramper> Maybe if you substitute "experimental" instead it would make sense, but "lesser known"? probably not
17:55:41*natrys quit (Ping timeout: 240 seconds)
17:57:18FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3lD2
17:59:34FromDiscord<matf> Thanks
18:00:16FromDiscord<haxscramper> More intricate intuition comes after you sorted our this stack/heap difference I guess
18:00:24FromDiscord<haxscramper> (edit) "our" => "out"
18:02:29*natrys joined #nim
18:03:02FromDiscord<matf> Coming from scala/haskell where I don't ever really think about stack vs. heap (it's been a while). In jvm land all my objects are heap I guess, stack is just pointers and methods.
18:03:25FromDiscord<matf> (edit) "Coming from scala/haskell where I don't ever really think about stack vs. heap (it's been a while). In jvm land all my objects are heap I guess, stack is just pointers ... and" added "to objects (I never see these directly)"
18:04:13FromDiscord<matf> that's probably wrong. strings are probably somewhere weird. Just trying to get the old brain working this morning.
18:05:05FromDiscord<haxscramper> strings have value semantics
18:05:31FromDiscord<haxscramper> But yes, internally they are implemented as pointer-to-data-and-size
18:05:40FromDiscord<haxscramper> no SSO
18:07:12FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=3lD9
18:09:43FromDiscord<exelotl> but if course it can't do that for `let bar = foo`, the value semantics mean it has to copy in that case
18:10:20FromDiscord<exelotl> (edit) "if" => "of"
18:11:01FromDiscord<haxscramper> Also default passing behavior can be overridden with `.bycopy.` (always copy to argument) or `.byref.` (always pass by reference)
18:11:24FromDiscord<matf> This is where I lose the thread slightly again. Since x isn't being modified, by would `let` make `total` be a copy?
18:11:34FromDiscord<matf> (edit) "be" => "cause"
18:12:47FromDiscord<matf> Oh wait. Sorry I read that wrong. `let bar = foo` is not in the example above yes that makes sense why it's ac opy.
18:13:04FromDiscord<matf> total shouldn't matter if it was by value or by reference, since `x` isn't modified right?
18:13:14FromDiscord<exelotl> yep exactly
18:14:07FromDiscord<matf> Ok. I'm going to get my head back down into the editor and mess around a bunch. Thanks for this. It has helped.,
18:14:08FromDiscord<matf> (edit) "helped.," => "helped."
18:23:53FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=3lDd
18:36:07FromDiscord<jtiai> Looks like nim tries to use my `Device`-type `read(device, uint16)` from `device.nim` but it should use one from `Bus`. Why that happens?
18:50:25*clyybber quit (Quit: WeeChat 3.1)
18:51:41*clyybber joined #nim
18:57:09*leorize quit (Ping timeout: 240 seconds)
18:59:40*leorize joined #nim
19:03:21FromGitter<bung87> how to parse a proc signature ? I want generate to another string representation for its return type params type
19:06:27*xet7 quit (Read error: Connection reset by peer)
19:11:41FromGitter<bung87> guess I need procs conveter called from marocs
19:35:01FromDiscord<queersorceress> @haxscramper any major progress on your orgmode parser?
19:35:14*blackpawn joined #nim
19:37:33*leorize quit (Ping timeout: 240 seconds)
19:40:11FromDiscord<haxscramper> No major progress except for realization that I need to refactor several things. Right now I'm finishing my work on core haxdoc implementation and will focus on the org-mode parser more as I need to for documentation comments.
19:40:35FromDiscord<haxscramper> Since last time I've only added XML export support and some serialization helpers
19:43:25FromDiscord<haxscramper> And nim RST importer
19:43:36FromDiscord<queersorceress> maybe i should try finding an implementation in javascript i like
19:43:47FromDiscord<queersorceress> hahaha
19:44:50FromDiscord<queersorceress> did i mention the reason i am going with org is cuz i tried using nim's docutils rst renderer and found it lacking for my needs?
19:45:21FromDiscord<queersorceress> so i totally know what you are going through there
19:45:49*arecaceae quit (Remote host closed the connection)
19:46:07FromDiscord<haxscramper> Well, I'm actually just spending a lot of time on background work, it is not that org-mode parser itself is complicated
19:47:13*lritter quit (Ping timeout: 240 seconds)
19:47:28*arecaceae joined #nim
19:47:31FromDiscord<haxscramper> Like I've spent several days on implementing serialization library that would allow me to tweak output manually
19:47:45*leorize joined #nim
19:47:59FromDiscord<haxscramper> Which resulted into deep `typed` AST dive and we all know how things are there
19:48:34FromDiscord<queersorceress> it's true, though i've promised myself to not write more parser/lexers if i can avoid it, and the stdlib parser/lexer utils are really bare bones to work with.
19:50:29FromDiscord<haxscramper> They are good but in the end I almost always fall back to char-by-char parsing, especially with org-mode
19:51:08FromDiscord<haxscramper> By the way, you plan to use it on the JS backend, correct?
19:51:31FromDiscord<haxscramper> I need to make sure it works there too, because I haven't tested anything but default target so far
19:53:50FromDiscord<queersorceress> no, it'd be client side javascript if i go that route, otherwise it's server side nim.
19:56:15FromDiscord<queersorceress> if i do use an existing javascript library for parsing and rendering my orgfiles then it will probably be handwritten javascript to save on size rather than nim using js backend.
19:57:41FromDiscord<queersorceress> the order of magnitude is just too great afaict to do that. if it were run locally or in node then that'd be different.
19:58:58FromDiscord<queersorceress> it i do it in another language like python or something then it'd have to be server side and i'm back with my resource contention problem.
20:29:41*natrys quit (Ping timeout: 240 seconds)
20:41:12FromDiscord<codic> does spawnProcess run the given process in the background, or do I need to explicitly `spawn` it?
20:41:27FromDiscord<codic> startProcess
20:41:40FromDiscord<jtiai> `let c = ula.bus.read(ptrDisp)` why Nim this thinks that `read` should have `Device` (ula is inherited from Device) as parameter and not `bus`? Is dotted path treated differently than I think?
20:42:56FromDiscord<ElegantBeef> Do you have a read that takes an explicit bus type?
20:42:56*natrys joined #nim
20:43:08FromDiscord<jtiai> I have several reads...
20:43:33FromDiscord<ElegantBeef> @codic yes i believe it is non blocking
20:43:33FromDiscord<jtiai> One which takes Bus, one which is base class Device and few that are inhertied from Device.
20:43:50FromDiscord<ElegantBeef> Ok so then the answer is yea
20:44:03FromDiscord<ElegantBeef> Is that read exported and accessible from the current module
20:44:17FromDiscord<ElegantBeef> Finally does the compiler agree with the issue or is it just the editor lying?
20:44:44FromDiscord<jtiai> Nope. Compiler doesn't like me 🙂
20:45:06FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=3lDB
20:45:38FromDiscord<jtiai> And yes read is accessible and exported....
20:46:52FromDiscord<ElegantBeef> oh it's a method
20:46:59FromDiscord<ElegantBeef> did you mark the method with `{.base.}`
20:47:14FromDiscord<jtiai> I have base method in Device.
20:48:22FromDiscord<jtiai> This worked fine with my "Memory" device which is very simple. Now I'm adding another device which also reads the bus (memory) and now the problem popped up.
20:48:58FromDiscord<ElegantBeef> Considering the error i can only imagine the issue is that the bus read isnt accessible
20:49:19FromDiscord<jtiai> Must be because CPU emulation uses that...
20:49:27FromDiscord<ElegantBeef> Is the base object accessible in this scope?
20:49:34FromDiscord<jtiai> Yes.
20:49:48FromDiscord<ElegantBeef> Then yea with only the error and behaviour i cannot say much
20:50:16FromDiscord<jtiai> I could push this mess to github...
20:51:00FromDiscord<ElegantBeef> Can just make a branch then destroy it afterwards if you so wish
20:54:34FromDiscord<jtiai> <https://github.com/jtiai/nimoric>
20:54:41FromDiscord<jtiai> Well there. It's in the main branch.
21:01:39FromDiscord<ElegantBeef> So your issue was not importing bus, followed by a recursive dependancy
21:02:58*NimBot joined #nim
21:03:35*Guest94576 joined #nim
21:04:20FromDiscord<jtiai> Thank you. And then tons of other errors.
21:04:34FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3lDG
21:05:27FromDiscord<ElegantBeef> Well you can clean it up by peeking it's exit code every so often then calling close
21:05:48FromDiscord<codic> hmm...
21:05:52FromDiscord<codic> doesn't seem like the cleanest of solutions
21:06:13FromDiscord<ElegantBeef> Well it's for non blocking processes afaik
21:08:54FromDiscord<codic> it looks like there is a process option `poDaemon` which does it non-blocking, but then I'm not sure when to close still
21:11:00FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3lDH
21:13:31FromDiscord<ElegantBeef> Nah you dont want to defer
21:13:44FromDiscord<ElegantBeef> cause it'll just start the process then close it
21:14:21FromDiscord<codic> so I have to poll?
21:16:13FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=3lDI
21:16:16FromDiscord<ElegantBeef> And yes do yourself a favour and use named parameters 😛
21:16:30FromDiscord<codic> hm ok
21:17:31FromDiscord<ElegantBeef> Might be able to use async or a watching thread for this but idk
21:17:53FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3lDJ
21:18:20FromDiscord<ElegantBeef> Well you have to get rid of the Nim resources
21:18:28FromDiscord<ElegantBeef> And system resources
21:22:06*Guest94576 quit (Quit: Guest94576)
21:23:58FromDiscord<codic> well the polling approach works
21:24:01FromDiscord<codic> i'll wrap it in a thread
21:24:32FromDiscord<ElegantBeef> You can just alias the start thread with your variation that throws it into the procPool then have 1:1 api
21:24:39FromDiscord<ElegantBeef> (edit) "thread" => "process"
21:25:12FromDiscord<codic> true
21:27:11ForumUpdaterBotNew thread by Alexeypetrushin: Why async server fails with "Too many open files"?, see https://forum.nim-lang.org/t/7911
21:29:49FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3lDL
21:30:35FromDiscord<codic> and if I did a mutable iteration and tried doing p.close...
21:30:38FromDiscord<codic> huh, it still works
21:30:43FromDiscord<codic> is it then modifying a local copy?
21:30:55FromDiscord<ElegantBeef> Nah it's cause `Proccess` is a ref
21:31:38*vicfred joined #nim
21:31:46FromDiscord<ElegantBeef> Didnt realize that was teh case before hand
21:31:50FromDiscord<ElegantBeef> (edit) "teh" => "the"
21:32:04FromDiscord<codic> oh so that should work anyways then
21:32:20FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3lDM
21:32:26FromDiscord<ElegantBeef> Also worth noting you may want to iterate the collection backwards so you can remove elements
21:32:41FromDiscord<ElegantBeef> Well if you use the default GC the threads have seperate heaps
21:33:39FromDiscord<codic> oh yeah I need to remove them too
21:34:20FromDiscord<codic> and I can't just x.delete x.find y
21:34:26FromDiscord<codic> because it's immutable
21:35:55FromDiscord<ElegantBeef> Well if you use `orc` you can do this rather easily
21:37:36FromDiscord<codic> i am using gc=orc yes
21:39:00FromDiscord<ElegantBeef> I believe this should work then https://play.nim-lang.org/#ix=3lDN
21:39:38FromDiscord<ElegantBeef> Orc shares the heap so aslong as you lock and override the thread analysis for the "unsafe" stuff you're fine, dont know if the cast is actually needed here
21:41:43FromDiscord<creonico> Does 0 count as nil or false in a boolean expression?↵`if not something: echo "something is 0"`
21:42:10FromDiscord<ElegantBeef> the only falsely value is `false`
21:42:22FromDiscord<ElegantBeef> You can write converters or explicitly compare
21:42:30FromDiscord<creonico> what about nil?
21:42:36FromDiscord<ElegantBeef> Like i said
21:42:45FromDiscord<ElegantBeef> `isNil` exists
21:42:51FromDiscord<ElegantBeef> and `!= nil`
21:43:05FromDiscord<ElegantBeef> You can write converters for this
21:43:22FromDiscord<ElegantBeef> But it's not very idiomatic and isnt overly readable
21:43:37FromDiscord<creonico> ok, thank you
21:44:51FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=3lDP
21:45:05FromDiscord<codic> oh thats a better solution
21:45:08FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3lDQ
21:45:08FromDiscord<ElegantBeef> I mean
21:45:15FromDiscord<ElegantBeef> No reason to cast
21:45:22FromDiscord<ElegantBeef> you can do `1.bool`
21:45:47FromDiscord<ElegantBeef> or `bool(1)` If you prefer
21:45:53FromDiscord<ElegantBeef> Yes
21:45:55FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3lDR
21:46:14FromDiscord<codic> (edit) "https://play.nim-lang.org/#ix=3lDR" => "https://play.nim-lang.org/#ix=3lDS"
21:47:16FromDiscord<codic> hmm, when I tried your earlier example (had to change to `spawn pollProcs()` I got `'spawn' takes a GC safe call expression`
21:47:47FromDiscord<ElegantBeef> add `{.gcsafe.}` to the procedure, and you probably can remove the casting after then
21:48:00FromDiscord<ElegantBeef> so `proc pollProcs{.gcSafe.} =`
21:48:20FromDiscord<codic> yeah, but then it complains that it is not actually GC safe because it accesses procPool which is using GC'd memory
21:48:27FromDiscord<ElegantBeef> Even with the cast?
21:48:36FromDiscord<ElegantBeef> I've never used spawn so dont know what it requires
21:49:26*natrys quit (Quit: natrys)
21:49:43giacowhat's the point of using "var T" when T is a ref type? https://nim-lang.org/docs/xmltree.html#mitems.i%2CXmlNode
21:50:22FromDiscord<ElegantBeef> Well it allows reassigning of the input value, so in this case, more dangerous code possibly 😄
21:50:34FromDiscord<ajusa> (you can change what the variable refers to basically)
21:50:48FromDiscord<ajusa> (edit) "what" => "which reference"
21:50:50FromDiscord<codic> I kinda feel like this is a bit overkill to spawn a process in the background and close it when it's done; can't I just close all the processes at the end of my program or will that have some consequences?
21:50:51FromDiscord<ElegantBeef> It's pointless here unless the input has to be `var` for the output to be `var`
21:50:53FromDiscord<codic> and yeah, with the cast
21:51:27FromDiscord<ElegantBeef> Yea just use `startProcesses`
21:51:45FromDiscord<ElegantBeef> Sorry exec
21:51:47*gangstacat quit (Ping timeout: 260 seconds)
21:52:05FromDiscord<codic> oh
21:52:06giacok thanks
21:52:11FromDiscord<codic> well
21:52:21FromDiscord<codic> i should have read the docs page for osproc lol
21:52:32FromDiscord<codic> but do I still have to close when I am done?
21:53:02*gangstacat joined #nim
21:53:06FromDiscord<codic> i don't believe so
21:55:19FromDiscord<ElegantBeef> Dont think so
21:55:44FromDiscord<ElegantBeef> You can always look at the source 😛
21:56:15FromDiscord<ElegantBeef> Yep calls close
22:25:05*sagax quit (Remote host closed the connection)
22:44:12FromDiscord<codic> I wonder why execProcesses doesnt block but execprocess does
22:45:48FromDiscord<codic> > Executes the commands cmds in parallel. Creates n processes that execute in parallel.↵> ↵> countProcessors: -> number of cores↵what if you have more processes than cores?
22:49:39FromDiscord<ElegantBeef> Well it does block but does each process in parallel
23:00:21*leorize quit (Ping timeout: 240 seconds)
23:03:43*leorize joined #nim
23:04:52FromDiscord<codic> oh ok
23:05:10FromDiscord<codic> I think I might ask on the forum, maybe I'll get some more responses on how to do this in an idiomatic way there
23:08:28FromGitter<awr1> @ElegantBeef `isNil` is preferred iirc, there are some silly edge cases where `!= nil` will type mismatch
23:13:19*blackpawn quit (Ping timeout: 252 seconds)
23:14:05*xet7 joined #nim
23:17:25ForumUpdaterBotNew thread by Codic12: Idiomatic way to run a process in the background and close it when appropriate?, see https://forum.nim-lang.org/t/7912
23:18:49FromDiscord<carpal> @Matt_ lol
23:25:52*ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
23:27:11*ehmry joined #nim
23:31:21FromGitter<awr1> @codic use `startProcess`for non-blocking
23:31:56FromGitter<awr1> then use either `waitForExit` or poll using `running`
23:34:07FromGitter<awr1> the docs for osproc aren't clear but because, e.g. `execProcesses` return the exit code and not a process handle it will wait for that process to finish
23:35:22FromGitter<awr1> if you want you can use a future on top of this, e.g. https://forum.nim-lang.org/t/5001#31394
23:36:47FromGitter<awr1> `asynctools` might be preferable, as also mentioned in that thread
23:58:53FromDiscord<creonico> Are custom pragmas a thing?