<< 09-11-2020 >>

00:12:09FromGitter<gogolxdong> I learned someone worked on video processing got 200times real-time compression from raw byte stream by GPU hard-coding.
00:12:26FromDiscord<stu002> I'd like to create a library using Nim concepts, but I get the impression they're likely to change quite a bit?
00:13:14FromDiscord<cabboose> Hey y'all, I'm having some trouble getting authentication to work with a web scraping project I have; I'll be happy to pay someone up to $50 AUD if they can team view me in about ~12 hours (8pm GMT + 8) and run me through it. Would anyone be interested or know where I can find assistance with it? The scripts run with Mechanize in python but web scraping is definitely not my domain.
00:14:27FromDiscord<cabboose> dm me if you want to see the website in question
00:15:18FromDiscord<cabboose> hell ill pay up to $100 AUD if someone can just get the damn authentication part working with persistence
00:16:29Zoom[m]Huh, why do I get `Cannot create a flowVar of type: Option[system.string]` with some of the GCs?
00:25:30FromDiscord<ElegantBeef> @stu002 the amount they will change isnt too much with all the RFCs combine, so go have fun!
00:26:21FromDiscord<ElegantBeef> If curious read about the RFCs here https://github.com/nim-lang/RFCs/issues?q=is%3Aissue+is%3Aopen+concepts
00:28:59FromDiscord<stu002> @ElegantBeef thanks -- sounds interesting.
00:30:44FromDiscord<ElegantBeef> Like when/if those rfcs come through you'll have to rewrite the concepts, but overall the way they work isnt going to change afaik
00:35:39Zoom[m]Ok. So I've managed to use threadpool to spawn my `execProcess`es and now most of them end up Zombie. Any tips?
00:41:07*Aethylia joined #nim
00:42:02AethyliaI have a situation where a.foo[int]() doesn't work, but foo[int](a) does. I'd like to understand this. Can anyone point me to the documentation explaining when this might happen?
00:43:48FromDiscord<ElegantBeef> A code example would go a long way
00:43:55FromDiscord<ElegantBeef> Or the compiler error
00:44:04AethyliaSure thanks
00:44:57Aethyliaproc foo[T](a: AsyncSocket) : T = return avar a = newAsyncSocket()discard a.foo[int]()
00:45:35AethyliaSorry that seems to have lost the formatting xD
00:45:41FromDiscord<ElegantBeef> https://play.nim-lang.org/
00:46:03Aethyliahttps://play.nim-lang.org/#ix=2DtM
00:46:11Aethyliathanks
00:47:47FromDiscord<ElegantBeef> How do you expect it to convert an AsyncSocket to an int?
00:48:25AethyliaNo sorry I over simplified there
00:48:26*abm quit (Read error: Connection reset by peer)
00:49:48*Tanger quit (Remote host closed the connection)
00:49:54Aethyliahttps://play.nim-lang.org/#ix=2DtN
00:49:57Aethyliaokay this one
00:51:11FromDiscord<ElegantBeef> Yea it's with how generics work i believe to support the ufcs you need to do `[:T]` like so https://play.nim-lang.org/#ix=2DtO
00:51:48FromDiscord<ElegantBeef> It's talked about here https://forum.nim-lang.org/t/6988
00:51:54AethyliaAh I see, thanks I've never seen that syntax
00:52:04AethyliaSorry for the messy example
00:52:08FromDiscord<ElegantBeef> It's fine
00:52:13FromDiscord<ElegantBeef> You quickly corrected yourself 😄
00:54:23Aethyliahaha, I'd been trying to figure it out for hours I got mixed up the first time. Thanks so much for the help. I think this could use adding to the tutorial
00:55:23*opal quit (Ping timeout: 240 seconds)
00:55:24FromDiscord<ElegantBeef> Yea i agree the tutorial tends to lack a few key things
00:57:28*opal joined #nim
00:59:24Zoom[m]So, spawning multiple threads for `execProcess` seems to work relatively well only with markAndSweep gc, arc and orc end up with stuck zombie threads
01:00:01Zoom[m]Can anyone read this at least? :)
01:03:23*kinkinkijkin quit (Remote host closed the connection)
01:03:59*opal quit (Remote host closed the connection)
01:04:44PrestigeWe can see your message if that's what you're asking
01:05:08*opal joined #nim
01:08:06Zoom[m]Prestige: yep, just not sure if bridging's working
01:09:40Aethyliaah sorry, I wasn't quite sure if you meant read it in a 'consider it' kind of way or not
01:10:22Zoom[m]Sorry, too late here, worded it awkwardly.
01:11:03Aethylia1am here too but I have the morning off tomorrow so irc lurking it is
01:11:10Zoom[m]With markAndSweep I still get lots of zombie processes, but they get reaped evenetually. Wouldn't say soon enough, though
01:12:03FromDiscord<cabboose> anyone tried dynamic wrapping of python modules with python3? is it worth the effort?
01:12:15Zoom[m] * With markAndSweep I still get lots of zombie threads, but they get reaped eventually. Wouldn't say soon enough, though
01:15:55FromDiscord<ElegantBeef> @cabboose https://nimble.directory/search?query=python
01:16:07FromDiscord<ElegantBeef> Idk what you're looking for exactly but something is bound to be similar there
01:17:45*theelous3 quit (Read error: Connection reset by peer)
01:19:30Zoom[m]Anyway, even with markAndSweep most of the threads are sleeping, some are zombie and just 3-5 are running for most of the time. MaxPoolSize was set to 128. Any ideas on that strange behaviour? Am I hitting some user limits?
01:19:57FromDiscord<ElegantBeef> Are you capable of peeking their code?
01:20:09FromDiscord<ElegantBeef> https://nim-lang.org/docs/osproc.html#peekExitCode%2CProcess
01:21:57FromDiscord<cabboose> @ElegantBeef I did mean the python3 pckg by matkuki; i'll give it a shot and see for myself i suppose
01:22:00FromDiscord<cabboose> thanks
01:23:15*Tanger joined #nim
01:25:43Zoom[m]ElegantBeef, I'm using execProcess ATM so I get no handle to the launched processes, will change the code to use execCmdEx
01:26:00Zoom[m]Probably not tonight, though
01:27:27*Aethylia quit (Remote host closed the connection)
01:37:34*a_chou joined #nim
01:39:23*a_chou quit (Remote host closed the connection)
01:40:43*Jjp137 joined #nim
01:59:09FromDiscord<Avatarfighter> @ElegantBeef what does the `:` do in `[:T]` in that code you spent earlier
02:02:45FromDiscord<ElegantBeef> It allows you to use ufcs with generics afaik
02:02:51FromDiscord<ElegantBeef> So it sets the T i guess
02:03:06FromDiscord<ElegantBeef> It resolves the `[]` so it can be used in a UFCS
02:03:10FromDiscord<Avatarfighter> ok so lets backtrack a tiny bit
02:03:14FromDiscord<Avatarfighter> tf UFCS stand for
02:04:43FromDiscord<Rika> Universal function call syntax
02:04:47FromDiscord<Avatarfighter> oh
02:04:58FromDiscord<Avatarfighter> thanks rika
02:10:35FromDiscord<ElegantBeef> The issue being that when doing `a[T].` it can be resolved as a `proc [](a : T, A: typedesc)` as i understand it
02:22:19*apahl quit (Ping timeout: 272 seconds)
02:23:17*rockcavera joined #nim
02:23:54*apahl joined #nim
02:49:40*mmohammadi9812 quit (Ping timeout: 272 seconds)
02:51:55FromDiscord<𝙼𝚊𝚝𝚜𝚞𝚖𝚘𝚝𝚘> How to get MAC address of current active interface on windows in nim? I'm new to nim so any help will be appreciated.
03:00:42FromDiscord<ElegantBeef> https://github.com/PMunch/getmac seems like a package that supports it on all platforms
03:04:04FromDiscord<ElegantBeef> @𝙼𝚊𝚝𝚜𝚞𝚖𝚘𝚝𝚘 just to make sure you see the above
03:06:07*mmohammadi9812 joined #nim
03:06:46*muffindrake quit (Ping timeout: 244 seconds)
03:09:10*muffindrake joined #nim
03:46:36*clouds joined #nim
03:53:51*clouds left #nim ("WeeChat 1.9.1")
03:53:53*clouds joined #nim
04:03:45*clouds left #nim ("WeeChat 1.9.1")
04:05:31*NimBot joined #nim
04:06:01*supakeen quit (Quit: WeeChat 2.9)
04:06:36*supakeen joined #nim
04:15:04*Cthalupa quit (Ping timeout: 246 seconds)
04:17:37*Cthalupa joined #nim
04:20:23*leorize quit (Ping timeout: 240 seconds)
04:22:33*leorize joined #nim
04:23:04*apahl quit (Ping timeout: 240 seconds)
04:24:09*apahl joined #nim
04:32:00FromDiscord<Gyllou> hulloh
04:32:43*leorize quit (Ping timeout: 240 seconds)
04:33:16FromDiscord<Rika> Hello.
04:34:56FromDiscord<Gyllou> whats happenin
04:36:24FromDiscord<Gyllou> looks like its been pretty quiet tonight
04:37:21FromDiscord<Rika> Well most people are probably asleep or busy at work because most of us here are European or American, save for me of course
04:37:41FromDiscord<Gyllou> yea thats fair
04:37:43FromDiscord<Gyllou> lol
04:37:58FromDiscord<Gyllou> im still up coding, i should probably goto bed but then work will come sooner
04:38:17FromDiscord<Rika> Lol, do you have any questions about nim or something?
04:39:56FromDiscord<Gyllou> eh not really im working on a package for nim rn
04:40:04FromDiscord<Gyllou> still learning my way around arraymancer
04:41:02FromDiscord<Rika> First time with nim and already at arraymancer?
04:41:33disruptekgyllou: how'sit goin' with the hashing?
04:41:33FromDiscord<Gyllou> eh not ive been around the block with tensor libraries
04:41:53FromDiscord<Rika> Is it me or is gyllou new I don’t know someone fill me in
04:42:08FromDiscord<Gyllou> pretty well, i imported a few of those packages and ive been benchmarking them
04:42:34FromDiscord<Gyllou> well working on benchmarking them, im also getting acquainted with what dimensions arraymancer can handle as well as its api in general
04:43:02FromDiscord<Gyllou> im reasonably new to nim but ive been popping in here for the past few weeks as I learn
04:43:16FromDiscord<Rika> Oh I see
04:43:20disruptekrika: gyllou is doing some ai graph stuff.
04:43:26FromDiscord<Rika> Cool stuff
04:43:37FromDiscord<Gyllou> yea im excited about it
04:43:57disruptekme too.
04:44:11disruptekactually, i'm just excited to have electricity.
04:44:18FromDiscord<Gyllou> i wish arraymancer had more documentation though
04:44:26FromDiscord<Gyllou> thats always a good thing!
04:44:35FromDiscord<Gyllou> why wouldnt you? outages?
04:44:44FromDiscord<Rika> Maybe living in the woods
04:45:05disruptekyeah, i'm in an rv.
04:45:20FromDiscord<Gyllou> gotcha
04:45:32disrupteki was working on incremental compilation and then *bzzt*.
04:45:42FromDiscord<Gyllou> that sucks jesus
04:45:54FromDiscord<Gyllou> do you have any servers in there?
04:46:27disrupteknah. i have a nas box but everything i care about is in the cloud.
04:46:40FromDiscord<Gyllou> oh okay thats good an all
04:46:41disruptekwhat's amazing is how shitty btfs is on the san, though.
04:47:07disruptekit's just terrible. feels like i roll back snapshots every other time i crash.
04:47:14disruptekand i crash multiple times per day.
04:47:32Prestigewhy do you crash so much?
04:47:32disrupteki switched another lun to ext4 and it's rock-solid.
04:47:34FromDiscord<Gyllou> thats a headache
04:47:47FromDiscord<Gyllou> ive never really messed with ext4
04:47:49disruptekyeah, it's a pita.
04:48:04FromDiscord<Gyllou> is it worth it over ext3?
04:48:15disruptekbcachefs is finally entering mainline, so that's what i'm pinning hopes upon.
04:48:27disruptekext4 is quite a large improvement over ext3.
04:49:04FromDiscord<Gyllou> interesting, had to look that one up
04:49:11FromDiscord<Gyllou> yea i should probably migrate to that
04:49:21disruptekwhenever the neighbor uses her microwave, i lose power.
04:49:24FromDiscord<Gyllou> just not enough hands for everything
04:49:33disrupteki know the feeling.
04:49:44disrupteki've been meaning to replace my cron daemon for like, a year.
04:49:51disruptekit's ridiculous.
04:50:14FromDiscord<Gyllou> theres always something
04:50:15*leorize joined #nim
04:50:22FromDiscord<Gyllou> we have so much data rn
04:50:44FromDiscord<Gyllou> and with only a handful of people its pretty cumbersome to manage
04:50:56disruptekwell, i told you to hire me.
04:51:18*rockcavera quit (Remote host closed the connection)
04:51:20FromDiscord<Gyllou> haha we need to be profitable first
04:51:40disruptekhmmph.
04:51:46FromDiscord<Gyllou> well we primarily concerned with taking a conservative approach to growth rn
04:52:06FromDiscord<Gyllou> i do kinda like not having any business types all up in my science
04:52:20disrupteki feel that.
04:52:28disruptekeverything is complicated with money.
04:52:44FromDiscord<Gyllou> yea, i started this because i love robotics and research
04:53:02FromDiscord<Gyllou> i dont want have it turn into spreadsheets and zoom calls
04:53:19FromDiscord<Gyllou> (edit) "i dont want ... have" added "to"
04:54:05disruptekwhat a retarded edit result. why can't the bridge just perform the edit and color it appropriately?
04:54:19disruptekYardanico: get on that shit please.
04:55:10FromDiscord<Gyllou> lol
04:55:26disruptekwell i'm always trying to get him to write some nim.
04:55:38disruptekhe's just stubborn about it for some reason.
04:55:59FromDiscord<Gyllou> im really enjoying it. it kinda brings back alot of what I like about programming.
04:56:12FromDiscord<Gyllou> sometime C can really suck it out of me
04:56:52disruptekyeah, it's like that.
04:58:13disruptekthe best part about it is that whatever you have to do, it's likely no slower than the fastest code out there.
04:58:52disrupteki mean, it's always the case that i'm writing something else like C# and i just know that if i do something elegant, it's going to be slow.
04:59:17disruptekand that's just not a problem in nim. that makes elegance free, and that's a big deal.
04:59:38FromDiscord<Gyllou> yea that bugs me, i like c# alot but i agree
04:59:52FromDiscord<Gyllou> same with the jvm langs
05:00:10disruptekright. i love clojure as a concept but i'm just not able to accept the performance.
05:00:25FromDiscord<Gyllou> ive gottten to where i can write pretty damn fast python code, but I spend alot of time optimizing it
05:00:30disruptekprobably naive of me, i suppose.
05:00:36FromDiscord<Gyllou> i havent touched it yet.
05:00:50disruptekfast python doesn't have anything pythonic about it.
05:00:56disruptekthis is the problem.
05:01:00FromDiscord<Gyllou> i think crystal looks cool, but im not sure i trust it for production based their release history
05:01:24disruptekto me it adds nothing to the toolbox.
05:01:47FromDiscord<Gyllou> yea its very true, you spend alot of time getting it to be anything but python
05:01:51FromDiscord<nikki> i think the codegen to C is suuuuuch a great feature, to be able to just look at it to get a sense of what it'll do behind the scenes
05:02:19FromDiscord<Gyllou> yea i agree
05:02:33disruptekwell, i'm gonna build a proper introspection shim.
05:02:57FromDiscord<Gyllou> i wish nim had more packages for stuff im doing, but it has the most important building blocks....and really good ones at that
05:02:58disruptekeven with my mangling patch, i don't really want to look at the c.
05:03:03disruptekit's just not that convenient.
05:03:36FromDiscord<Gyllou> yea i took a gander, useful, but i dont see myself tweaking at that stage anytime soon
05:04:08disruptekyou definitely don't want to.
05:04:26FromDiscord<nikki> yeah the main thing that has mad it tractable is that my editor has "goto def" working so i can just hit the hotkey on a symbol and i jump to the defn in the c code
05:04:28disruptekbut it's sometimes handy to track down a copy or something.
05:04:29FromDiscord<nikki> like the flags are setup for that
05:04:57disruptekthat sounds decent, but.. meh.
05:05:21*astronavt quit (Quit: Leaving)
05:05:29disrupteki want high-level instrumentation and i think it's not that hard to build it.
05:06:14FromDiscord<nikki> yeah that'd be cool to see
05:06:20FromDiscord<nikki> what do you mean by instrumentation in this case
05:08:18disrupteki'm making a thing that does cloud resource acquisition at compile-time and then moves a runtime continuation into the cloud.
05:08:35FromDiscord<ElegantBeef> Knowing disruptek he probably meant like a flute or something 😄
05:09:07disrupteki just want to be able to serialize my continuation back into ast, basically.
05:11:18FromDiscord<nikki> seems cool
05:11:19disruptekit's not that i can't just put another layer on top, but i think more folks would benefit from adding the layer to the bottom; integrating it into objects, say.
05:12:02FromDiscord<nikki> could you say like `doThing1(); wait(2.weeks); doThing2();` for some agent that's running in the cloud
05:12:10FromDiscord<nikki> and in the 2 week period its run state is serialized or sth
05:12:32disruptekoh, no. the goal is to have it way more integrated.
05:13:12disruptekthere's like a microkernel layer that knows how to do basic stuff like drop privileges and fork.
05:13:49disruptekso it can, say, create a new microservice and install code and setup a cron to kick it off two weeks later.
05:14:10FromDiscord<nikki> dang
05:14:27disruptekthe microservice lets this entity be managed by the rest of the environment, for example to delete it or measure it in some way.
05:14:45FromDiscord<nikki> right yeah
05:15:06FromDiscord<nikki> does your cps thing use some notion of the current execution frame and save it somehow
05:15:08disruptekbut this can all be done at compile-time. so when you run code, you're able to access these resources as native objects.
05:15:18FromDiscord<nikki> like you learn about local variables and learn that you should be able to serialize them or sth?
05:15:59FromDiscord<nikki> so that you can do `let x = computeSomethingNow(); wait(2.weeks); doThingWithData(x);`
05:16:05disruptekcps just rewrites the procedure and captures everything local and rewrites it all to operate on the same data.
05:16:42disrupteki mean, yes, you can do that. but it's a small part of the puzzle.
05:17:08FromDiscord<nikki> right yeah
05:17:52disrupteki'm building this to do more stuff like, "if foo(): one() else: two()" and i want both branches to run at the same time in two separate lambda calls in the cloud.
05:18:09FromDiscord<nikki> ahhh word
05:18:30FromDiscord<nikki> and maybe it figures out the flow graph and dependencies
05:18:40disruptekif 0 == randint(0, 1000): echo "i'm the forker" else: echo "i'm fork number x"
05:18:58FromDiscord<nikki> like in the case you showed because (or if) the `one()` and `two()` calls aren't sequenced relative to each other because of depending on one or the other
05:19:06disruptekright.
05:19:29FromDiscord<nikki> cool. well it also has parallels (ha) for being used in eg. gpu compute locally
05:19:52disruptekyeah, but there are i/o limitations there.
05:19:52FromDiscord<nikki> like -- being able to express a computation and have it automatically parallelize or sth
05:20:12disrupteksmarter people are solving those problems for us. 😉
05:20:24FromDiscord<nikki> haha
05:20:26*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
05:20:34disrupteki'm just trying to make a hack, basically.
05:20:34*njoseph joined #nim
05:21:17FromDiscord<nikki> well, hacks in nim are always appreciated
05:22:31disruptekit's just too hard to calculate fibonacci(100)
05:22:58disrupteki'm willing to pay for it, as long as it means running a few thousand parallel routines in the cloud with like 3 lines of code.
05:23:09disruptekit should cost almost nothing.
05:23:19disruptekthat's the low-friction software i want.
05:27:56*Cthalupa quit (Ping timeout: 260 seconds)
05:29:33*waleee-cl quit (Quit: Connection closed for inactivity)
05:29:51*Cthalupa joined #nim
05:33:22*solitudesf joined #nim
05:34:10disrupteksolitudesf: are you busy?
05:44:33*rockcavera joined #nim
05:50:43*leorize quit (Ping timeout: 240 seconds)
05:51:10*leorize joined #nim
05:55:51solitudesfyes
05:56:00disruptekpunk.
06:13:06*narimiran joined #nim
06:23:55*natrys joined #nim
06:37:21*habamax joined #nim
06:38:37FromDiscord<tinygiant> sent a code paste, see https://play.nim-lang.org/#ix=2Dwt
06:46:00solitudesfiterate with index, `for i, item in array`
06:52:18FromDiscord<tinygiant> sent a code paste, see https://play.nim-lang.org/#ix=2Dwy
06:54:38solitudesflol
07:00:05FromDiscord<Rika> sounds like json needs an update
07:54:27*PMunch joined #nim
08:21:27*xet7 joined #nim
08:53:56Oddmongerhello, what does this mean ? got <type string> but expected 'string' ( https://play.nim-lang.org/#ix=2DwW )
08:55:12*nc-x joined #nim
08:55:31nc-xOddmonger
08:55:32nc-xresult = X
08:55:42nc-xyou are assigning `type string` to result
08:55:55nc-xit should be result = a
08:56:39Oddmongerahhhh /o\
08:56:47Oddmongerthank you
09:05:23FromDiscord<Rika> When it says type something it means you're assigning a type, like a = int or so
09:21:25*Tanger quit (Remote host closed the connection)
09:24:05*nc-x quit (Remote host closed the connection)
09:24:23*leorize quit (Ping timeout: 240 seconds)
09:26:55*natrys quit (Ping timeout: 246 seconds)
09:27:25*natrys joined #nim
09:33:43*abm joined #nim
09:37:33*Vladar joined #nim
09:53:01*leorize joined #nim
09:53:43*hnOsmium0001 quit (Quit: Connection closed for inactivity)
10:02:33*habamax_ joined #nim
10:05:23*habamax quit (Ping timeout: 260 seconds)
10:08:37*xet7 quit (Quit: Leaving)
10:30:23*leorize quit (Ping timeout: 240 seconds)
10:45:40Oddmongeris there a use case with type assigning ?
10:45:59Oddmongerassigning a type to a variable seems so strange
10:47:53*leorize joined #nim
10:56:19FromDiscord<Rika> no clue really, only works on compiletime even
10:56:23*nc-x joined #nim
10:56:43nc-xyeah. there is no usecase and the compiler gives an error https://play.nim-lang.org/#ix=2DxG
10:58:13nc-xand if you have a usecase, then use `type abc = int`
10:58:13Oddmongermay be for macros…
10:58:30nc-xmaybe
10:58:37nc-xi don't use macros :)
10:58:45Oddmongermaybe one day :)
10:59:06bungI try to use nimble readPackageInfoFromNims proc , Got exception: /bin/sh: : command not found printPkgInfo() failed
10:59:48Oddmongeri was reading this: https://hookrace.net/blog/introduction-to-metaprogramming-in-nim/ , and finished in the strformat man page, wondering how to pad hex numbers display ^^'
11:02:25*nc-x quit (Remote host closed the connection)
11:03:21PMunch!eval import strutils; echo "'" & 100.uint8.toHex().align(5) & "'"
11:03:25NimBot' 64'
11:03:28PMunchLike that?
11:04:18PMunchWhere is `readPackageInfoFromNims` defined bung?
11:07:00bungnimblepkg/packageparser.nim
11:07:20bungI modified it locally for exporting
11:10:43PMunchDo you have /bin/sh?
11:12:05bungls /bin/sh
11:12:16bungyeah I have
11:13:34PMunchAh, it is failing to find an executable
11:14:33ForumUpdaterBotNew thread by Domogled: Std/tables [] vs. add(), see https://forum.nim-lang.org/t/7055
11:15:41*narimiran quit (Ping timeout: 256 seconds)
11:16:01*Cthalupa quit (Ping timeout: 265 seconds)
11:18:49*habamax_ quit (Quit: leaving)
11:19:09*habamax joined #nim
11:19:22*Cthalupa joined #nim
11:19:55planetis[m]is casting from string to seq[byte] safe in arc/orc?
11:22:42Araqyes if
11:22:55Araq- the string doesn't come from a string literal
11:23:03Araq- you don't mutate the seq[byte]
11:23:21Araqin fact, hmm, better never mutate the resulting seq[byte]
11:26:32*lritter joined #nim
11:27:35bungno idea now, it seems design for cli usage
11:27:43planetis[m]it's just that this new "zippy" lib does it, but indeed seems like it doesn't mutate seq[byte]
11:30:37*opal quit (Read error: Connection reset by peer)
11:30:37*leorize quit (Remote host closed the connection)
11:31:19*leorize joined #nim
11:32:10*opal joined #nim
11:34:32Zevvso, will this forever hold then?
11:34:39ZevvI thought we did not make this promise?
11:41:42FromDiscord<dom96> IMO all "cast"ing should always be "unsafe"
11:42:34FromDiscord<dom96> if a type conversion is safe then the compiler should allow it
11:42:48FromDiscord<dom96> i.e. seq[byte](myStr) should work
11:44:43*xet7 joined #nim
11:48:23*opal quit (Ping timeout: 240 seconds)
11:51:25*opal joined #nim
12:03:13bungPMunch it seems nimsuggest should init with correct project file, with my PR my project file suggest well, old version doesn't
12:04:25Zoom[m]Can locks be used with threadpool? ATM can't spawn the proc which acesses the global var with a lock due to it not being GCsafe
12:05:02bungand now it slower when init but faster with other files, since it has build whole graph
12:06:01*supakeen quit (Quit: WeeChat 2.9)
12:06:37*supakeen joined #nim
12:08:29Zoom[m]When I mark a proc {.gcsafe.} it explicitly points to a global var guarded by a lock
12:09:10Zoom[m]`foo() s not GC-safe as it accesses 'bar' which is a global using GC'ed memory`
12:09:18PMunchbung, this one? https://github.com/PMunch/nimlsp/pull/61
12:09:18disbotNimble
12:09:37bungyes
12:09:57PMunchZoom[m], it's still not GC-safe even if it is behind a lock
12:10:01bungnimble and clean read to merge I think
12:11:47Zoom[m]PMunch: so locks can't be used with spawn? I see dom96 has an example in the book (6.23) which is not far from what I have
12:12:44*mmohammadi9812 quit (Quit: Quit)
12:13:01*mmohammadi9812 joined #nim
12:15:08Zoom[m]TBH, I'm trying to directly mutate a global seq from behind a lock, is it a problem?
12:15:58PMunchThe lock isn't the problem, they work fine with spawn and threadpools
12:16:13PMunchThe problem is that you have a global variable that uses a GC'ed type and try to access it from a thread
12:17:49PMunchThe default garbage collector in Nim uses thread-local memory. This means that if this thread tried to access this variable and triggered the GC for that thread it wouldn't find references from other threads and could end up free-ing the global variable. This is obviously bad. In order to have global variables you need to make sure that they are GC-safe, ie. doesn't use the garbage collector.
12:20:07Zoom[m]ah, thanks. So, do I need to rewrite it using FlowVars or channels?
12:21:49PMunchDepends on what you're trying to do
12:22:29PMunchBut some kind of rewrite is necessary
12:35:32Zoom[m]I'm trying to process a list of strings with an external process, hopefully in parallel. Basically, this: https://play.nim-lang.org/#ix=2Dt8
12:36:43PMunchYeah, I'd rewrite that to a channel
12:37:14PMunchBasically make output a channel, then each `get_w` writes their result to the channel, and when they are all done you just exhaust the channel in your main thread.
12:40:36*xet7 quit (Ping timeout: 265 seconds)
12:44:57Zoom[m]Not sure how to convert the output to a channel since it's a seq. I don't like it to be copied, so I need to channel individual responses, right?
12:50:36Zoom[m]Also, my previous try with channels failed: Threadpool was launching the threads (the list is huge) and nothing was coming out of a channel until they all were created. It looks like I was receiving wrong.
12:53:58Zoom[m]I mean, it would be nice to start receiving something from the channel before "they were all done". It's a FIFO, why wait?
13:11:51PMunchAh, no don't convert it on runtime, convert your code to use a channel and not a seq
13:12:12PMunchWhat you probably did was pass the channel to the thread, but what you need to do is pass a pointer to the channel to the thread
13:12:28PMunchOtherwise it will copy the channel and you won't be able to read from it
13:15:07*Vladar quit (Remote host closed the connection)
13:20:21Zoom[m]ATM I'm trying to use a global channel which should pass a tuple.
13:20:48*Vladar joined #nim
13:21:52Zoom[m]An I'm seeing the same problem. Threads get created, most of them geto to sleep, some become zombies, and no processing with the channel's output happens, even though I'm checking for dataAvailable in the loop which spawns the threads.
13:22:12PMunchCode?
13:22:21Araq"threads become zombies"?
13:22:26Zoom[m] * And I'm seeing the same problem. Threads get created, most of them go to sleep, some become zombies, and no processing with the channel's output happens, even though I'm checking for dataAvailable in the loop which spawns the threads.
13:22:52Zoom[m]I mean the processes which are launched in threads
13:26:07Zoom[m]Ok, the code is a mess. I'm trying to get a bunch of word definitions from a local instance of dico.
13:27:37Araqnotice that osproc supports running multiple processes without multi-threading
13:27:47Araq(not sure if it helps)
13:31:01Zoom[m]https://play.nim-lang.org/#ix=2Dyi
13:31:58Zoom[m]The size of a threadpool and the amount of processess that get stuck in a sleeping or zombie states varies widely with the change of GC
13:32:30*Kaivo joined #nim
13:32:52Araquse createThread instead of the thread pool
13:33:44Zoom[m]Ok, but what's wrong with using the thread pool here?
13:34:02Araqthe thread pool was written by a moron (=me)
13:34:54Zoom[m]So, do you mean I'm actually hitting some bugs, and not just having an unworkable implementation?
13:35:47Araqbugs or not, one big problem is that threadpools don't reliably work with channels
13:36:52Zoom[m]As I said yesterday, this simple code is actually a miserable experience. It believe it would be trivial with Rust's Rayon (at least I used it successfully to launch multiple processess).
13:37:32Zoom[m]I tried it with FlowVars already, and was getting the same behaviour from the processess.
13:38:33Araqthere is also Weave
13:38:55Araqwhich offers a much better multi-threading package but it focusses on CPU perf, not on IO
13:40:01Zoom[m]couldn't spawn the proc's with weave, something was wrong with some 'semantics' it said
13:40:53PMunchWait, why doesn't threadpools work well with channels?
13:41:14AraqI used createThread to control processes, worked without problems.
13:41:20Araqwell
13:42:05Araqwith the usual problems that I also remember from other languages/runtimes
13:42:07Zoom[m]<PMunch "Wait, why doesn't threadpools wo"> Yeah, as I said, we have an example in Dom's book, is it not relevant in this regard?
13:42:46AraqPMunch, 'spawn' was originally designed for parallelism, not for concurrency
13:42:51PMunchWhat kind of problems? I don't really see why it would cause issues, but maybe I'm missing something
13:42:52PMunchAh
13:42:54Araqthe idea is that when you do
13:43:02Araqspawn foo(args)
13:43:13Araqit's *optionally* run on a different thread
13:43:28Araqbut the semantics are much like 'foo(args)'
13:43:57Araqand then later threadpool got patched because people simply don't understand 'spawn'
13:44:55Araqor maybe because they rightly demand that it is at least non-blocking :-)
13:45:03Zoom[m]May be because it's not maybe_spawn?
13:45:29PMunchI can see how people would misunderstand that
13:45:52PMunchBut anyways Zoom[m], how many threads/processes are you trying to start simultaneously?
13:46:46Zoom[m]I hoped that would be not for me to decide. The list is about 10000 and I expected the threadpool to manage it for me
13:47:34PMunchAh right
13:47:34AraqZoom[m], execProcesses handles it fine IME
13:47:54Araqgive it a list of tasks and it runs them
13:48:09Araqwithout creating N processes at the same time, it slices through them
13:48:11PMunchYeah starting a thread for each program might be a bit overkill
13:50:34Zoom[m]But I need to capture their output. Do I need to utilize `afterRunEvent` somehow?
13:52:39FromGitter<gogolxdong> Is there a way to store table from its string repr?
13:52:47FromGitter<gogolxdong> restore
13:53:10AraqZoom[m], yeah
13:53:24Araqmaybe look at compiler/extccomp.nim
13:53:30Zoom[m]<PMunch "Yeah starting a thread for each "> Why? Isn't it a perfect case of using threads? Completely separate processes in their own threadas?
13:53:41PMunchNope
13:54:06PMunchThreads are a fairly heavy OS construct. Optimally you don't want more threads than you have cores on your CPU
13:54:30PMunchFurthermore they are meant to run things across cores, and don't really have anything to do with running external programs.
13:54:50Zoom[m]Yep, isn't the threadpool supposed to limit the number of threads to maintain the optimal load?
13:54:53PMunchIf anything you'll slow your program down from running them in separate threads vs. a proper async solution
13:55:06PMunchYes, in a CPU-bound computation
13:55:39PMunchWhat you are doing is starting separate programs (which will run in their own thread(s)), and the consumption of their output is to your program the same as IO
13:55:47PMunchAnd IO bound stuff is better handled with async
13:56:03AraqPMunch, 10_000 threads are really not much of a problem on any OS these days
13:56:13Zoom[m]This is what I started with :D
13:56:20Araqbut sure, async's resource consumption is better
13:56:32PMunchAraq, oh yeah, not much of a problem, but not giving you any benefits either
13:56:54Araqwell if the job is "I need to ship this yesterday"
13:57:03Araqthen using 10_000 threads can get you there
13:57:17PMunchWell yeah
13:57:30Araqwithout having to mess around with 3rd party async osproc implementations :P
13:57:48Araq(yeah yeah, we should have one of these ourselves)
13:57:54Zoom[m]Well, I expected this to be a threadpool's job. I should say "limit threads to nCPUs and process all that"
13:57:54PMunchBut there are plenty of things we do when "this should be shipped yesterday" that we shouldn't tell other people about :P
13:58:14AraqZoom[m], threadpool does that but I doubt it helps much
13:58:26PMunchThreadpool should indeed be a tool to do this, but not the best one
13:58:35Zoom[m]In my case it led to a bunch of zombie processes :)
13:58:51PMunchThen you probably did something wrong :P
13:58:52Araqthreadpool has logic like
13:58:54PMunchThreads can be tricky
13:58:59Zoom[m]I just need a tool, not the best one
13:59:05PMunchWhat does execProcesses really do Araq?
13:59:07Araq"are the CPUs busy? no? let me create more threads then..."
13:59:46Araqthe idea of threadpool is to adjust the number of threads for the workload
14:00:30Araqnothing of this code was written in mind with process control :-)
14:00:33Zoom[m]<Araq ""are the CPUs busy? no? let me c"> That's prefectly fine by me! I'm not sure why in my case the processess I'm launching are so slow, but I'm not hitting IO (hdd) freezes so please RUN MOAR
14:01:01Araqso call setMinPoolSize/setMaxPoolSize
14:01:11PMunchWell, without code it's pretty hard for us to guess why..
14:01:18Zoom[m]That's what I did
14:01:20Araqbut I don't see the point, createThread gives more guarantees
14:01:42Zoom[m]I showed the code. It's trivial
14:02:27Araqwe can't run your code tho
14:02:34Zoom[m]I just used a common sense and didn't wan't to flood the OS so that's why I used a threadpool
14:03:17Zoom[m]There's a commented string which substituted the process for `echo`
14:06:31Zoom[m]So, what I'm saying is, the task of "take a list of stuff, process it in parallel and start giving me back the results as soon as any is available" is rather common and threadpool+channel combo looks like it's made specifically for that.
14:07:29PMunchAnd if you were actually doing processing in your thread then I'd agree
14:07:47PMunchBut you're calling a separate program, which turns this from CPU bound to IO bound in the eyes of your program
14:09:59Zoom[m]That's what I reasoned at first. But the catch is, there's not much to do except launch more processes. And I don't see how async/await could help me there.
14:11:18FromDiscord<Rika> less overhead i believe
14:13:25PMunchBecause you can start as many processes as you want, as they will run their own threads, and then poll them for completion
14:13:34PMunchWhich is basically what execProcesses does
14:13:47PMunchYou could also use https://github.com/cheatfate/asynctools/blob/master/asynctools/asyncproc.nim
14:15:00Zoom[m]Thanks for the link. Less technical overhead, but much more mental one. Not the best trade-off
14:15:02*Cthalupa quit (Ping timeout: 264 seconds)
14:15:24PMunchWhy don't you want to use execProcesses though?
14:15:47PMunchThat's the easiest and a good technical solution
14:16:17Zoom[m]Because to be honest, when I looked at the docs I couldn't see a clear way or capturing the output
14:16:54PMunchAh, that's what you would do in the callback
14:17:05PMunchYou get the Process object, so you can read it's output
14:17:08PMunchits*
14:17:26*Cthalupa joined #nim
14:17:29Zoom[m]"The highest (absolute) return value of all processes is returned." is not what I'm looking in a description.
14:17:36PMunchOnly issue is if the program produces too much output and fills its buffer
14:17:47*narimiran joined #nim
14:17:55PMunchZoom[m], huh? That is the return value of the entire call
14:18:17PMunchBasically just meant to be used to check if any of the processes errored out, if you haven't attached a callback
14:18:35Zoom[m]I understand it now. I just would love the docs to be a little bit more prescriptive
14:18:39PMunchUseful if you are just calling a bunch of processes for batch processing where you will later read the result from a file for example
14:19:54Zoom[m]I also stand my ground that threadpool+channel should work, as it's the dumbest and most obvious thing on the surface
14:20:23PMunchPretty sure it does work if you do it right :P
14:21:09Zoom[m]I'm not sure what you're hinting at, but it worked with Rayon on a similar case for me. :D
14:21:19Zoom[m]Hope I'm not getting banned for that
14:21:48PMunchHaha, you don't get banned for saying that you can make stuff work in other languages :P
14:21:48FromDiscord<Rika> you probably would if your situation was reversed (nim working and rust not)
14:21:53FromDiscord<Rika> (and in the rust discord)
14:22:13FromDiscord<Rika> also i'd argue rust's rayon has probably had more work than many nim libraries have had
14:22:52Zoom[m]I spammed rust_newbies alright in my time, never had problems with my dumb questions
14:23:04PMunchStill not entirely sure what would prevent channels to work in a threadpool though
14:23:10PMunchMust be a really funky implementation :P
14:23:53FromDiscord<Rika> perhaps your questions to rust were common; i dont think your threadpools question is common at all
14:24:12Zevvpssst... just join us on the dark side and come work on cps
14:25:21Zoom[m]<Zoom[m] "So, what I'm saying is, the task"> Isn't it common? Let's not dive into io vs cpu, it's a simple solution that's obviously works as intended, when it works
14:29:06Zoom[m]In an ideal world my code should use some asynchronous solution, but technically it should have worked, right?
14:29:45PMunchYes, but again, without your code it's pretty hard to tell if you just messed it up or if there is a problem with the library
14:30:39Zoom[m]Again, here it is: https://play.nim-lang.org/#ix=2Dyi
14:31:03Zoom[m]I wasn't going to show this monstrosity to anyone
14:33:49*narimiran quit (Ping timeout: 264 seconds)
14:36:13*narimiran joined #nim
14:39:54jonjitsu[m]Is it considered bad style to assign enums values and use those values later. A use case can be when there are environment variables used and you want to avoid typo bugs, ex: https://play.nim-lang.org/#ix=2DyC
14:41:49PMunchNot at all, in fact I'd say that is good practice
14:42:14PMunchHaven't seen it much in user code, but definitely being used in libraries
14:45:09Zoom[m]That's what the type system is there for, to free us from bugs :D
14:47:07ForumUpdaterBotNew thread by Jackhftang: Quick question about acyclic pragma , see https://forum.nim-lang.org/t/7057
14:47:43jonjitsu[m]ok I wasn't sure if enums were more for the symbol and if the value was guaranteed not to be mangled or some other side effect like that
14:57:19*PMunch quit (Ping timeout: 246 seconds)
15:04:14*luis_ joined #nim
15:11:02*PMunch joined #nim
15:14:02PMunchNo stream tonight unfortunately, I have some real-world stuff to do, and besides improving the layouting algorithm for notifishower I'm not really sure what I'd be doing
15:14:21PrestigePMunch: nimlsp ;)
15:14:37PMunchActually bung has been doing some work on NimLSP lately
15:15:15*tane joined #nim
15:15:40PMunchOh well, gotta go fetch something at the post office
15:17:43Prestigesee ya
15:21:29FromGitter<Kvothe87> i tried to update the nim version. I tried choosenim update stable ang got an error (libcrypto-1_1-x64|libeay64).dll
15:24:05FromGitter<Kvothe87> tried to download choosenim again, thinking that maybe i had it in the other pc, tried with the exe and it seems like it did not do anything. Tried with the zip file and running the runme.bat and got that teh system cannot find the specified path press any key to continue and then nothing
15:26:23*gangstacat quit (Ping timeout: 272 seconds)
15:26:59Oddmongerhow to pass values as cint ? (10,10) is parameters is passed like tuple of int's
15:27:25Prestige(10.cint, 10.cint) ?
15:27:39Oddmonger/o\ i was afraiding this
15:27:47Oddmongerthank you
15:28:01PrestigeAny time!
15:30:30Oddmongermay be it's time for a template…
15:31:25PrestigeOr maybe a converter, if you're using that a lot
15:32:54Oddmongerah, didn't know converter
15:33:15FromDiscord<Rika> theyre a feature many people dont recommend using but theres the occasional use so
15:33:16Oddmongeri think it will be used a lot, indeed
15:34:20*luis_ quit (Quit: luis_)
15:34:50Oddmongerok so let's stick to the template for beginning
15:37:35*waleee-cl joined #nim
15:49:23*leorize quit (Ping timeout: 240 seconds)
15:49:37*astronavt joined #nim
15:50:58Oddmongerfor macros, tried this, not the right way it seems : https://play.nim-lang.org/#ix=2DyT
15:51:19Oddmongermay be i'm taking the wrong path for cint/int conversions
15:52:03FromDiscord<InventorMatt> https://play.nim-lang.org/#ix=2DyU
15:52:14FromDiscord<InventorMatt> you just needed to add an ouput parameter
15:52:18*leorize joined #nim
15:52:53Oddmongerahh like this! Thank you
15:53:50FromDiscord<InventorMatt> no problem. i make the same mistake all the time with templates
15:53:58*luis_ joined #nim
15:54:27FromDiscord<Zachary Carter> you can make the return type `Vec2` instead of `untyped`
15:54:52FromDiscord<Zachary Carter> also - you don't need to use `repr` you can just print the object representation with `echo`
15:55:03FromDiscord<Zachary Carter> so - https://play.nim-lang.org/#ix=2DyV
15:57:24Oddmongerok, yes for the repr i wasn't sure too
15:58:07Oddmongercan i use this template in another file ? It seems templates cannot be imported
15:58:15FromDiscord<Zachary Carter> you can export templates
15:59:02FromDiscord<Zachary Carter> but remember templates are for code substitution
15:59:17FromDiscord<Zachary Carter> so if a symbol in the template isn't available in that source unit you'll encounter issues
15:59:29Oddmongeryes, i see that
15:59:55Oddmongeras Vec2 is defined in source A, and template must be defined in source B
16:00:14OddmongerB template doesn't know what Vec2 is
16:00:36Oddmongerso i can export the type with « type Vec2* = »
16:01:18FromDiscord<Zachary Carter> actually
16:01:35FromDiscord<Zachary Carter> the template doesn't necessarily have to know what Vec2 is, if you use `untyped`
16:01:35Oddmongeri have other errors though
16:01:44Oddmongerah
16:01:47FromDiscord<Zachary Carter> so for instance - https://play.nim-lang.org/#ix=2Dz5
16:01:48FromDiscord<Zachary Carter> this compiles
16:01:55FromDiscord<Zachary Carter> even though I haven't defined `Vec2` anywhere
16:02:26FromDiscord<Zachary Carter> since the return value is `untyped` it won't be type checked
16:03:10Oddmongernot so easy in fact…
16:03:57Oddmongerwhen i try to use the template ( foo( toVec2( 10,12) ) , the compiler says it cannot be called
16:04:31Oddmongerbut « that was working before :( »™
16:05:24Oddmongerdidn't expected so much resistance in this field :')
16:07:00Oddmongerah i see, he thinks i want to call : foo ( Vec2(…) ) which is not a function
16:09:03FromDiscord<Zachary Carter> yeah
16:10:03Oddmongerok i had a typo ( ':' instead of '.')
16:10:07Oddmongerthank you :)
16:15:38*kaliy joined #nim
16:21:04FromDiscord<Zachary Carter> sure!
16:27:36*hnOsmium0001 joined #nim
16:45:16FromGitter<Knaque> What would be the equivalent of this Python code (https://hastebin.com/exiwoqelik.py) so that I can Ctrl+C gracefully?
16:46:31*natrys quit (Quit: natrys)
16:46:34FromDiscord<lqdev> https://nim-lang.org/docs/system.html#setControlCHook%2Cproc%29
16:46:39FromDiscord<lqdev> @Knaque ^
16:47:11FromGitter<Knaque> Of course it would be right under my nose...
16:47:36FromGitter<Knaque> Thank you.
16:48:19disruptek🏀⚽
17:01:34FromDiscord<Avatarfighter> disruptek: feeling sporty today?
17:02:02disruptekhard to feel sporty with these big balls.
17:02:32FromDiscord<Avatarfighter> oh nice you got big basketballs to compensate ? 😛
17:03:24*kinkinkijkin joined #nim
17:03:43FromDiscord<Avatarfighter> Also, how is IC going disruptek 😩
17:04:24disruptekwhat are you cryin' for? you don't have any code that's expensive to compile.
17:04:35FromDiscord<Avatarfighter> Oh I know
17:04:39FromDiscord<Avatarfighter> Its just so interesting
17:04:49FromDiscord<Avatarfighter> You're basically my primary source on how hard IC is
17:05:05disruptekwell, the frontend is really simple. araq is making good progress.
17:05:25solitudesfcmon man, he has to compile nimph
17:05:27disrupteki'm struggling with a bug. not sure if it's a frosty issue or what.
17:06:08FromDiscord<Avatarfighter> What is the bug if I may ask?
17:06:39disrupteki'm getting a sequence for write that has an impossibly large length.
17:07:32FromDiscord<Avatarfighter> That's a really interesting bug
17:07:41FromDiscord<Avatarfighter> I had something not similar at all in another project 😛
17:09:01FromDiscord<Avatarfighter> Do you have any idea what could be causing this?
17:12:04FromDiscord<Avatarfighter> probably not now that I think about it since if you did the bug wouldn't be a bug
17:13:20disrupteki think it's distinct-string related but i thought i had a passing test for this.
17:13:40disruptekalso, it works some of the time, so...
17:14:22disruptekevery filesystem path in the compiler is a distinct string. 🤷
17:24:01*habamax quit (Quit: leaving)
17:31:14disruptek`len(a) == L` the length of the seq changed while iterating over it
17:31:34disruptekyet frosty's writes are all performed against immutable inputs.
17:38:00*natrys joined #nim
17:38:22FromDiscord<krisppurg> @haxscramper have you looked at the code yet, if not then I'm around if you got any questions or solutions and I'll try.
17:38:52*luis_ quit (Ping timeout: 272 seconds)
17:43:06FromDiscord<haxscramper> @krisppurg Yes, I looked at it, but the only thing (quite obvious, so probably not the reason for error) - there is still an `./aaa.mp3` as parameter for `ffmpeg`, so it won't generate any data etc. Anything else - I can't say for sure unless I just build & debug it myself
17:44:10FromDiscord<krisppurg> hm
17:45:16FromDiscord<krisppurg> still working though?
17:46:26FromDiscord<krisppurg> the audio file I used was https://media.discordapp.net/attachments/371759389889003532/775416019769491496/anyways_you_can_stop.mp3
17:46:45FromDiscord<krisppurg> (edit) "the audio file I used was ... https://media.discordapp.net/attachments/371759389889003532/775416019769491496/anyways_you_can_stop.mp3" added "(if that helps)"
17:47:17FromDiscord<haxscramper> I can't build whole code you linked (`cannot open file: ws`) and to be honest this is probably not something I have time to debug right now - async code etc. is not something I'm familliar with
17:48:52FromDiscord<krisppurg> nimble install dimscord
17:49:02disrupteknever.
17:49:13FromDiscord<haxscramper> Sorry, but I'm not going to debug this whole thing right now
17:49:21FromDiscord<krisppurg> eh oh well
17:49:49FromDiscord<krisppurg> what version of Nim are you running? I am using v1.2.0
17:51:11FromDiscord<haxscramper> 1.4.0. And just for the record - my experience with dimscord/async/&related is just building documentation example. You probably much more proficient with that part of application than myself, so it is not like I can help to debug anything either.
17:51:24FromDiscord<krisppurg> alright
17:51:39FromDiscord<krisppurg> I might as well stop using startProcess and try execCmdEx
17:52:02FromDiscord<krisppurg> Is there any benefits so far for not using streams or...?
17:52:02disrupteknope.
17:52:10disruptek!repo asynctools
17:52:11disbothttps://github.com/cheatfate/asynctools -- 9asynctools: 11Various asynchronous tools for Nim language 15 63⭐ 22🍴
17:54:17*luis_ joined #nim
17:54:27FromDiscord<krisppurg> wait...
17:54:39FromDiscord<krisppurg> BRUH i realised I used aaa.mp3
17:54:44FromDiscord<krisppurg> it works now lmfao
17:55:02FromDiscord<krisppurg> I think.
17:57:15Zoom[m]Thanks everyone who helped me earlier, especially PMunch and Araq. Don't want to sound rude, but I just looked at asynctools or execProcessess and rewrote the whole program in Rust with Rayon. No Zombies anymore. It's not even bigger in LOC. I feel like I lost this battle
17:57:46FromDiscord<krisppurg> yup it works thanks for your help haxscramper
17:57:50PMunchToo bad you couldn't get it to work out..
17:57:52disrupteknonsense. sounds like you used the right tool for the job.
17:59:47Zoom[m]PMunch: I'm not a coder, so I code in abrupt waves when the inspiration or necessity strikes, so absorbing Nim docs for two days was too much for me, especially when I was hitting some strange behaviour which we discussed
18:01:21PMunchAh, I can see that
18:01:31Zoom[m]What I was doing is I was looking for a way to automatically form decks for anki. One program exports the most infrequently used words from a book (txt) and the other polls dico for dictionary definitions and outputs the file Anki could import.
18:02:57*gangstacat joined #nim
18:03:02FromDiscord<shadow.> im getting a static assertion error when trying to compile in c++ mode
18:03:13FromDiscord<shadow.> i can fetch the exact error if needed
18:03:39*disruptek is now known as keisterfish
18:03:45ForumUpdaterBotNew thread by Mantielero: Raspberry Pi 1B - nmqtt - exit code 137, see https://forum.nim-lang.org/t/7059
18:04:19FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2DzW
18:04:21FromDiscord<shadow.> and a bunch of other weird g++ errors lmao
18:04:34FromDiscord<shadow.> (edit)
18:05:16*a_b_m joined #nim
18:05:20FromDiscord<shadow.> any ideas on how to fix?
18:05:24FromDiscord<shadow.> c works fine
18:08:38*abm quit (Ping timeout: 272 seconds)
18:10:30PMunchZoom[m], just out of curiosity, could you run this for me: https://play.nim-lang.org/#ix=2DA0
18:12:17Zoom[m]Just , a moment, I think Dico just crapped into it's pants or something, pardon my French
18:13:21PMunchNo worries, my French isn't all that great either :P
18:17:41*shadowninja55 joined #nim
18:21:00shadowninja55ello
18:21:05PMunchHi there
18:21:11shadowninja55im getting static assertion errors when trying to compile to c++
18:21:21shadowninja55*compile through c++ i guess
18:21:26shadowninja55i believe its a g++ error
18:21:31shadowninja55should i paste it here?
18:21:51keisterfish~paste
18:21:52disbotpaste: 11a frowned-upon behavior in chat; please use a service such as https://play.nim-lang.org/ or http://ix.io/ or https://gist.github.com/ and supply us a URL instead.
18:22:01shadowninja55ah ok
18:22:35shadowninja55https://hastebin.com/iriwiyelog.csharp
18:22:37shadowninja55does this suffice?
18:22:53keisterfishsure.
18:23:08shadowninja55alr cool
18:23:32PMunchThanks for watching out for us keisterfish
18:23:45keisterfishyep.
18:24:11keisterfishlooks like your compiler doesn't agree with nim wrt int sizes.
18:24:13*luis_ quit (Remote host closed the connection)
18:24:20PMunchYeah
18:24:20shadowninja55hmm
18:24:27shadowninja55i just checked my mingw installation and it seems to be mingw32
18:24:31shadowninja55should i get 64 instead lmao
18:24:37shadowninja55ive been using c++ for months now fine but
18:24:43shadowninja55does mingw32 pose an issue for nim?
18:24:50PMunchIf you are on a 64 bit system then you should use mingw32-w64 or whatever it is called
18:24:58shadowninja55ah ok
18:25:26PMunchAt least that's what I've been using when cross compiling to Windows
18:25:34shadowninja55lemme go install that rq
18:25:58keisterfishor just x-compile to 32-bit.
18:26:27shadowninja55eh its probably best to get x64 since im on a 64 bit system
18:26:38keisterfishof course.
18:26:39PMunchSure, you could try to do --arch:32 or whatever the option is
18:26:53PMunchAnd that should at least give you a build with the Mingw version you have installed
18:27:33shadowninja55oh ok
18:27:36shadowninja55lemme try that
18:30:53shadowninja55im installing mingw 64 rn
18:31:09shadowninja55also do you have any idea which produces faster-executing programs in general with nim? c or c++
18:31:36PMunchWell, C++ tends to be faster for certain things
18:31:46PMunchBut they're not too far apart
18:31:55keisterfishuse c.
18:33:09*Kaivo quit (Ping timeout: 256 seconds)
18:35:21*Kaivo joined #nim
18:35:47shadowninja55i just realized nim has an installation of mingw64 lmao
18:37:02keisterfishtell me something and tell me true:
18:37:08keisterfishare you really a ninja?
18:37:12shadowninja55hmm
18:37:23shadowninja55considering i use windows probably not
18:38:09*keisterfish is now known as disruptek
18:39:14*mmohammadi9812 quit (Ping timeout: 256 seconds)
18:39:39shadowninja55oml it worked
18:40:47shadowninja55thank you lol
18:41:03shadowninja55all i had to do was remove my mingw32 from path since nim already has a mingw64 and the 32 was higher
18:41:07FromDiscord<krisppurg> is there a way to convert from string to binary?
18:41:25solitudesfto what?
18:41:44*pbb quit (Ping timeout: 240 seconds)
18:42:27FromDiscord<krisppurg> to binary
18:42:32FromDiscord<krisppurg> binary data string
18:42:39shadowninja55manually or with a builtin
18:42:49FromDiscord<krisppurg> any
18:43:00shadowninja55i mean you could iterate the chars
18:43:01solitudesfand whats wrong with string itself?
18:43:05shadowninja55and then extract the bits
18:43:29FromDiscord<krisppurg> nothing related to above, but I'm sending voice audio data to discord
18:43:38FromDiscord<krisppurg> which needs to be binary
18:43:46solitudesf...
18:43:47FromDiscord<krisppurg> as final
18:44:02FromDiscord<krisppurg> hence why I was asking.
18:44:21*mmohammadi9812 joined #nim
18:44:43FromDiscord<treeform> @krisppurg its very easy just cast it: `cast[seq[uint8]](yourString)`
18:44:54solitudesfjust send it?
18:45:34FromDiscord<krisppurg> sending to udp unrelated to my question.
18:45:34FromDiscord<treeform> string is a seq[char] which is a seq[uint8]
18:45:36*pbb joined #nim
18:45:38solitudesfstring is just a sequence of bytes, no need to cast anything
18:45:39FromDiscord<krisppurg> thanks treeform btw
18:46:29FromDiscord<treeform> I end up casting the strings all the time, as different apis take different signatures for just "buffer" of data.
18:46:49shadowninja55is there any way to use gcc/g++ optimization flags with nim?
18:46:56solitudesf--passC
18:48:28FromDiscord<treeform> shadowninja55, its really easy, --passC, --passL, or the {.passC.} {.passL.} pragmas...
18:48:43FromDiscord<treeform> depends if you want compile time or link time optimizations
18:48:53solitudesfjust keep in mind that -d:danger/release already implies -O3
18:49:35FromDiscord<krisppurg> I want it to be something like `011001011101` @treeform
18:50:03FromDiscord<treeform> oh you want to convert it to a string of characters that is 0 and 1s?
18:50:05shadowninja55how would i do passC for c++ mode?
18:50:06*habamax joined #nim
18:50:16FromDiscord<treeform> passC also works for c++
18:50:22solitudesfc means compiler
18:50:24FromDiscord<treeform> its "pass to compiler"
18:50:42FromDiscord<krisppurg> yes
18:50:50shadowninja55ahh ok
18:51:03FromDiscord<treeform> so you want some thing like "abc" to turn into "1010001010101100010101"
18:51:25Zoom[m]PMunch: looks like it's chugging along just fine. Thank you, that's very educational
18:52:00FromDiscord<krisppurg> yes
18:52:04solitudesfstrutils.toBin
18:52:58PMunchZoom[m], no problem, I was just curious if I was using execProcesses right :P
18:55:02FromDiscord<treeform> @krishass here: https://play.nim-lang.org/#ix=2DAj
18:55:47FromDiscord<treeform> oh I did not know that toBin takes a param
18:57:12FromDiscord<treeform> @krisppurg this is probably better https://play.nim-lang.org/#ix=2DAl
18:57:25FromDiscord<Yardanico> @krisppurg uhh, I don't think you need binary as text representation, do you?
18:57:35FromDiscord<Yardanico> this is not how voice works
18:57:44FromDiscord<treeform> that is true
18:57:52FromDiscord<treeform> you want to cast it the first way
18:58:00FromDiscord<Yardanico> you transmit bytes themselves, not the binary text representation of them
18:58:51FromDiscord<treeform> binary text representation is very rare, I never used it for anything.
18:58:57FromDiscord<krisppurg> https://discord.com/developers/docs/topics/voice-connections#encrypting-and-sending-voice-voice-packet-structure
18:59:21FromDiscord<Yardanico> yes
18:59:28FromDiscord<Yardanico> "Binary data" means bytes themselves
18:59:31FromDiscord<Yardanico> not the text representation of them
18:59:35FromDiscord<krisppurg> oh?
18:59:37FromDiscord<treeform> @krisppurg you want to cast it not to text them
18:59:52FromDiscord<krisppurg> well how am I going to write to stream?
18:59:58FromDiscord<Yardanico> just write the bytes
18:59:59FromDiscord<Yardanico> BYTES
19:00:19FromDiscord<Yardanico> e.g. write for http://nim-lang.github.io/Nim/streams.html
19:00:21FromDiscord<Yardanico> or writeData
19:00:25FromDiscord<krisppurg> o
19:01:11FromDiscord<krisppurg> but what about all together?
19:02:02FromDiscord<Yardanico> still the same
19:04:04FromDiscord<treeform> @krisppurg I made binny module that makes this easy: https://play.nim-lang.org/#ix=2DAn
19:04:15FromDiscord<treeform> this is how you would do the whole packet.
19:06:52*mmohammadi9812 quit (Ping timeout: 246 seconds)
19:07:07*mmohammadi9812 joined #nim
19:10:46FromDiscord<krisppurg> I see `add` being called, what would `audio` would look like?
19:10:52FromDiscord<treeform> a string
19:11:01FromDiscord<krisppurg> just string?
19:11:05FromDiscord<treeform> yeah?
19:11:08FromDiscord<treeform> packet is also a string
19:11:13FromDiscord<treeform> its just string & string
19:11:46FromDiscord<krisppurg> the chunk audio im sending looks something like `÷¸l¶:male_sign:ªù▲§q¸¤↨è:spades:òÞÃ─±` this
19:11:58FromDiscord<krisppurg> (edit) "`÷¸l¶:male_sign:ªù▲§q¸¤↨è:spades:òÞÃ─±`" => "`÷¸l¶ªù▲§q¸¤↨èòÞÃ─±`"
19:12:09FromDiscord<treeform> is it encrypted?
19:12:10*mmohammadi9812 quit (Quit: Quit)
19:12:12FromDiscord<krisppurg> yes
19:12:17FromDiscord<treeform> then it should work
19:12:20FromDiscord<krisppurg> alright
19:12:32FromDiscord<krisppurg> wait do you mean binary encrypted?
19:12:45FromDiscord<krisppurg> or just encrypted opus lol
19:12:52FromDiscord<treeform> opus encodes it?
19:13:07FromDiscord<treeform> it appears that docs want it also encrypted
19:13:34FromDiscord<krisppurg> I'm just calling ffmpeg with the options including the codec being opus
19:13:38FromDiscord<treeform> I made the `hexPrint` functions which makes working with binary data easier: `flatty/hexprint`
19:13:48FromDiscord<krisppurg> (edit) "I'm just calling ffmpeg with ... the" added "file as input and"
19:13:55FromDiscord<treeform> usually if you print binary data it looks like this `÷¸l¶ªù▲§q¸¤↨èòÞÃ─±`
19:14:24FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=2DAq
19:14:52FromDiscord<treeform> I work a lot with binary data
19:15:46FromDiscord<treeform> It says at the top "Voice encryption uses the key passed in Opcode 4 Session Description and the nonce formed with the 12 byte header appended with 12 null bytes to achieve the 24 required by xsalsa20_poly1305. Discord encrypts with the libsodium encryption library."
19:15:54FromDiscord<treeform> I don't know if `ffmpeg` did that for you.
19:16:27FromDiscord<treeform> you might need to run it through some thing like `libsodium`... you will need to do your own research.
19:16:51FromDiscord<krisppurg> nah I've got that covered
19:17:11FromDiscord<treeform> good luck then!
19:17:15FromDiscord<krisppurg> I am using libsodium
19:17:18FromDiscord<treeform> cool
19:17:54FromDiscord<krisppurg> on writeUint8, it expects two parameters I only put `0x80`
19:18:32*mmohammadi9812 joined #nim
19:18:34habamaxexit
19:18:38*habamax quit (Quit: leaving)
19:20:15FromDiscord<treeform> @krisppurg sorry I typed, please use add instead of write: https://play.nim-lang.org/#ix=2DAt
19:21:19FromDiscord<treeform> @krisppurg full api here: https://github.com/treeform/flatty
19:22:49FromDiscord<krisppurg> i've looked through the repo and code when you first mentioned ur lib
19:23:57ForumUpdaterBotNew thread by Snej: Any workarounds for view-object bugs?, see https://forum.nim-lang.org/t/7061
19:31:35*mbomba joined #nim
19:32:43*leorize quit (Ping timeout: 240 seconds)
19:35:17FromGitter<bung87> @PMunch please merge my two PRs
19:36:53PMunchSorry ,did you address my comments already?
19:38:19*shadowninja55 quit (Quit: Connection closed)
19:39:57FromGitter<bung87> I think i take carefully,think seriously.
19:41:32PMunchHuh?
19:43:56bungwhich one ? I commented them all.
19:47:26*brainproxy joined #nim
19:53:05*astronavt quit (Quit: Leaving)
20:01:59*ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
20:11:11*lmariscal quit (Quit: I'm Out!)
20:12:24*leorize joined #nim
20:14:19*lmariscal joined #nim
20:37:09*natrys quit (Quit: natrys)
21:02:26*narimiran quit (Ping timeout: 264 seconds)
21:06:43*leorize quit (Ping timeout: 240 seconds)
21:14:57*kinkinkijkin quit (Remote host closed the connection)
21:29:45*PMunch quit (Quit: leaving)
21:38:23FromDiscord<dom96> Today's MVP, iffy, https://github.com/nim-lang/nimble/pull/871
21:38:24disbotSimpler GitHub Actions CI
21:43:10*lritter quit (Quit: Leaving)
21:45:19*leorize joined #nim
21:49:29*mbomba quit (Quit: WeeChat 2.9)
21:55:23*pbb quit (Quit: No Ping reply in 180 seconds.)
21:56:49*pbb joined #nim
21:57:11FromDiscord<alehander42> oi
21:58:23*leorize quit (Ping timeout: 240 seconds)
22:00:05FromDiscord<Daniel> oi
22:00:40*leorize joined #nim
22:03:10*Vladar quit (Quit: Leaving)
22:06:59*guelosk[m] joined #nim
22:20:53*sagax joined #nim
22:22:57*solitudesf quit (Ping timeout: 260 seconds)
22:26:23*opal quit (Ping timeout: 240 seconds)
22:28:28*opal joined #nim
22:32:28FromDiscord<emizzle> sent a code paste, see https://play.nim-lang.org/#ix=2DBF
22:32:35FromDiscord<emizzle> (edit)
22:35:28*NimBot joined #nim
22:35:43FromDiscord<ElegantBeef> @emizzle I believe this speaks to that https://github.com/nim-lang/RFCs/issues/250
22:35:44disbotType checking for nil dereference: nilable and not-nilable types ; snippet at 12https://play.nim-lang.org/#ix=2w7D
22:40:17*tane quit (Quit: Leaving)
22:42:28jonjitsu[m]Anyone have handy a library that does http requests which provides both async and synchronous APIs that I can check out?
22:42:44mipristd/httpclient does that
22:45:17jonjitsu[m]thx
23:06:35FromDiscord<alehander42> oh yeah
23:06:54FromDiscord<alehander42> i think i tried to get a day off
23:07:03FromDiscord<alehander42> my work next week
23:07:05FromDiscord<alehander42> for that
23:07:17FromDiscord<alehander42> task eventually(and other stuff)
23:18:57*xace quit (Ping timeout: 260 seconds)
23:22:38ForumUpdaterBotNew thread by DataPulverizer: Issue with compile time evaluation, see https://forum.nim-lang.org/t/7062
23:35:45*xace joined #nim
23:36:20FromDiscord<nikki> the elems of any type `openArray` matches are always guaranteed to be contiguous in memory right? so that i could pass the `addr` of the first elem along with a length to pass things to C
23:37:03FromDiscord<ElegantBeef> Do sequences take up contiguous memory? 😄
23:37:10FromDiscord<nikki> yup
23:37:13FromDiscord<ElegantBeef> Then yep
23:37:34FromDiscord<nikki> cool that works out nicely
23:37:45FromDiscord<ElegantBeef> Openarray only covers seqs and arrays, one of which is compiletime constant size so I can say i know that's in order like ducks
23:38:00FromDiscord<nikki> so far `openArray` just seems to match arrays and seqs, but i was wondering if that was sth to assume in all types it's meant to match if that evolve in the future. probs don't need to worry about that for now lol
23:38:25FromDiscord<ElegantBeef> It's just a generic so you dont have a proc that takes just `array[3, T]` or /we
23:38:50FromDiscord<ElegantBeef> I dont imagine it'd ever get any other data type
23:38:56FromDiscord<nikki> i think it's technically a view type
23:39:23FromDiscord<nikki> so you can def a local var that's an openarray viewing something else. tho that's in the experimental view stuff only for now 🤔
23:39:30FromDiscord<nikki> it's really neat that it exists tho bc. that's definitely a pain point in other langs
23:39:46FromDiscord<nikki> they either don't have anything like this at all or have slices but slices are also distinct objects and not just views and it gets weird
23:40:01FromDiscord<ElegantBeef> Yea C# used an IEnumerable interface for supporting all collections
23:40:19FromDiscord<nikki> ah yeah; that's also probably different bc. it only is about satisfying an iterable concept rather than a mem layout one
23:40:25FromDiscord<ElegantBeef> Didnt feel right as it supports lists/dicts/ anything that can be iterated
23:40:42FromDiscord<nikki> like i'm guessing that it's just about returning an iterator that supports next, maybe prev, and get current elem, right?
23:40:48FromDiscord<ElegantBeef> Yea
23:40:53FromDiscord<ElegantBeef> It's for `foreach` iteration
23:41:04FromDiscord<ElegantBeef> I dont think there is a single array/list abstraction there
23:42:24FromDiscord<nikki> yeah i think when you want some amt of generic but also don't want memory spaghetti it helps to have an openArray-ish type
23:42:25FromDiscord<nikki> thx nim!
23:42:40disruptekc# is for racists.
23:43:30FromDiscord<ElegantBeef> Indeed, i've started a `C# -> Nim` article on dev.to since I know C# pretty well, to try to aid transitioning from C#.
23:45:02mipriis there a shortcut for "<some unicode char>".runeAt(0) ?
23:59:31*opal quit (Remote host closed the connection)