<< 06-12-2020 >>

00:03:14FromDiscord<ElegantBeef> Yea it's weird `jsNull` instead of outputing ` = null` does `var recorder_402653185 = [null];`
00:05:50FromDiscord<ElegantBeef> ah yes i have to do `[rec].toJs` cause all js objects are arrays of the values
00:09:53FromDiscord<shadow.> yeah oop in js is interesting
00:10:14FromDiscord<ElegantBeef> Well it's just nim's interop that's being interesting in this case
00:12:36*a_chou joined #nim
00:16:34FromDiscord<shadow.> ohh ok
00:28:22*a_chou quit (Quit: a_chou)
00:33:38FromDiscord<shadow.> should i use chr or char for printing ascii decimals as chars
00:34:33*Kaivo quit (Quit: WeeChat 2.9)
00:38:43FromDiscord<ElegantBeef> isnt `chr` just an alias of `char`?
00:39:27FromDiscord<ElegantBeef> i dont think you want to use either to be honest i think you want to do `(num + '0'.byte).chr`
00:39:32FromDiscord<ElegantBeef> But try both 😄
00:40:08FromDiscord<shadow.> well
00:40:11FromDiscord<shadow.> im making a brainfuck interpreter
00:40:16FromDiscord<shadow.> ill use char for now
00:45:55FromDiscord<Quibono> Interpreting brainfuck into nim or nim into brainfuck?
00:55:02*lritter quit (Quit: Leaving)
00:56:17FromDiscord<shadow.> well
00:56:21FromDiscord<shadow.> a function that can execute brainfuck code
00:56:38FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GN6
00:58:21FromDiscord<shadow.> wait nvm it doesn't work kek
00:58:27FromDiscord<Quibono> lol
00:58:32FromDiscord<shadow.> f
00:58:43FromDiscord<shadow.> it worked for my capital A program, but not for hello world
00:58:49FromDiscord<Quibono> _f for respects_
00:59:20FromDiscord<shadow.> hmm
00:59:22FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GN8
00:59:27FromDiscord<shadow.> now i gotta figure out why the other one didnt
01:12:46FromDiscord<shadow.> hmm ok
01:12:53FromDiscord<shadow.> i added wrapped inc / dec lol
01:12:58FromDiscord<shadow.> ill head to offtopic
01:18:17FromDiscord<ElegantBeef> Well i now can record/playback an audio stream
01:21:39*krux02 quit (Remote host closed the connection)
01:46:54*vsantana quit (Ping timeout: 256 seconds)
01:50:34FromDiscord<shadow.> how do you pass mutable arguments by value again?
01:50:44FromDiscord<shadow.> like so that you can mutate the argument without shadowing it
01:55:18FromDiscord<ElegantBeef> `var T`
01:55:36FromDiscord<ElegantBeef> That's not passing by value, it's passing a reference 😄
01:56:49FromDiscord<shadow.> i know
01:56:52FromDiscord<shadow.> i dont want to do that lol
01:57:09FromDiscord<shadow.> i want a replacement for like
01:57:12FromDiscord<Rika> your reason doesnt make sense
01:57:18FromDiscord<exelotl> you shadow it :P
01:57:22FromDiscord<Rika> yeah
01:57:35FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GNw
01:57:37FromDiscord<Rika> you have to shadow it if you want to modify something passed with value semantics
01:57:40FromDiscord<shadow.> ah ok
01:57:49FromDiscord<shadow.> someone mentioned there being a simpler way than just shadowing it but
01:57:55FromDiscord<shadow.> i suppose not lol
01:58:06FromDiscord<Rika> ~~technically everything is passed by value, its just what value is passed that changes~~
01:58:06FromDiscord<shadow.> and yes, i know echo num + 1 would be smarter lol
01:58:10FromDiscord<shadow.> lol
01:58:15FromDiscord<shadow.> fair enough
01:58:40FromDiscord<Rika> pass the value of the object or the value of the reference (the pointer) xd
02:01:15FromDiscord<shadow.> lmao yeah
02:01:21FromDiscord<shadow.> hmm
02:01:34FromDiscord<shadow.> i love how i made a brainfuck interpreter only to realize i have no use for it
02:01:45FromDiscord<ElegantBeef> just `template shadow(a: untyped) = var a = a`
02:01:54FromDiscord<shadow.> fair enough
02:02:12FromDiscord<ElegantBeef> With your name i'd figure you'd be ok with shadowing
02:02:17FromDiscord<shadow.> hmm
02:02:18FromDiscord<shadow.> well its shadow.
02:02:20FromDiscord<shadow.> not shadow!
02:02:22FromDiscord<shadow.> so its kind of like
02:02:25FromDiscord<shadow.> not a command?
02:02:28FromDiscord<shadow.> but more stern
02:02:32FromDiscord<shadow.> lmfao
02:03:03FromDiscord<ElegantBeef> ah you're right it's an overidden `proc '.'(s: Shadow)`
02:03:13FromDiscord<shadow.> lol
02:03:27FromDiscord<shadow.> ,.
02:03:31FromDiscord<shadow.> ^^^ cool brainfuck program
02:03:35FromDiscord<shadow.> lmao
02:05:38FromDiscord<shadow.> hmm now i need to make a brainfuck compiler
02:05:42FromDiscord<shadow.> i wonder what the best way to go about this is
02:06:02FromDiscord<shadow.> transpiling to nim and then compiling maybe?
02:06:03FromDiscord<shadow.> lmfao
02:12:47FromDiscord<ElegantBeef> Make a macro that converts the brainfuck to nim code, then compiled that 😄
02:12:51FromDiscord<ElegantBeef> (edit) "compiled" => "compile"
02:13:21ForumUpdaterBotNew thread by Slangmgh: There is any simple to convert a Time to DateTime?, see https://forum.nim-lang.org/t/7209
02:14:39FromDiscord<shadow.> yeah thats what i was thinking
02:14:52FromDiscord<shadow.> hmm
02:15:02FromDiscord<shadow.> is there a way to compile ast inside of nim?
02:18:03FromDiscord<ElegantBeef> The closest i know how to do that is to use the NimVM to populate a string from a macro there
02:18:41FromDiscord<ElegantBeef> But uncertain how well that'd work
02:21:18FromDiscord<shadow.> hmm
02:21:22FromDiscord<shadow.> i could technically just like
02:21:42FromDiscord<shadow.> write result.repr into a file
02:21:48FromDiscord<shadow.> and run a system command to compile it
02:21:54FromDiscord<shadow.> right?
02:23:07FromDiscord<shadow.> ye
02:23:50FromDiscord<ElegantBeef> Yes
02:23:55FromDiscord<ElegantBeef> That's what i do for nimscripter 😛
02:24:24FromDiscord<shadow.> nice nice
02:24:26FromDiscord<shadow.> wait even big brainer
02:24:29FromDiscord<shadow.> just interpret the code
02:24:45FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GNI
02:24:48FromDiscord<shadow.> and write that
02:24:49FromDiscord<shadow.> and compile it
02:24:50FromDiscord<shadow.> LOL
02:25:41FromDiscord<shadow.> oh wait a minute
02:25:47FromDiscord<shadow.> i can just compile the interpreter, no?
02:25:47FromDiscord<shadow.> lmao
02:29:11FromDiscord<ElegantBeef> Yea that's what nimscripter does, ships the NimVM
02:31:00FromDiscord<ElegantBeef> so what you could do make a stream of `brainfk:"codeHere"`, which when ran will send the code to nim from calling a string
02:31:43*disruptek throbs.
02:32:04FromDiscord<ElegantBeef> It's a pretty silly thing though as disruptek is indicating
02:32:15FromDiscord<shadow.> yeah
02:32:17FromDiscord<shadow.> i know
02:32:18FromDiscord<shadow.> but
02:32:23FromDiscord<shadow.> lemme just test this lol
02:32:33FromDiscord<shadow.> hmm
02:32:38FromDiscord<shadow.> writeFile() will create a file if it doesnt find it rihgt
02:32:52FromDiscord<ElegantBeef> What're you doing?
02:33:30FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GNN
02:33:38FromDiscord<shadow.> `Error: internal error: expr: var not init code_15655085`
02:33:49FromDiscord<ElegantBeef> can the nimVM even use write file?
02:33:54FromDiscord<shadow.> ohhhh
02:33:56FromDiscord<shadow.> lol
02:34:02FromDiscord<shadow.> what should i do then
02:34:13FromDiscord<ElegantBeef> Could do exactly what i said
02:34:43FromDiscord<shadow.> sorry im not exactly sure what you meant
02:34:47FromDiscord<ElegantBeef> Use nimscripter to run the macro on the string
02:34:50FromDiscord<shadow.> ohh
02:35:04FromDiscord<ElegantBeef> Or the raw VM if you prefer more labour 😄
02:35:10FromDiscord<shadow.> hmm
02:35:30FromDiscord<Rika> Vm can use write file I believe
02:35:50FromDiscord<shadow.> ah
02:35:53FromDiscord<shadow.> the issue is with code.repr
02:36:06FromDiscord<ElegantBeef> can it though? https://media.discordapp.net/attachments/371759389889003532/784971394361327646/unknown.png
02:36:56FromDiscord<ElegantBeef> I dont think it can, but i could be wrong, the reason i say that is you could only write strings/primitives, since there is no way to convert to the bits in the VM
02:37:14FromDiscord<shadow.> i mean i should be only writing a string correct?
02:37:49FromDiscord<ElegantBeef> Yea, but idk if it's implemented
02:37:52FromDiscord<shadow.> ahh ok
02:38:06FromDiscord<shadow.> so apparently code.repr isnt ready
02:38:08FromDiscord<shadow.> at compile-time
02:38:13FromDiscord<ElegantBeef> Well you also have an issue there
02:38:16FromDiscord<shadow.> mhm?
02:38:22FromDiscord<Rebel> Nimscripter is hot :p
02:38:26FromDiscord<Rika> I've already written a file in a macro
02:38:27FromDiscord<ElegantBeef> You have to compile the binary everytime to compile the brainfuck
02:38:46FromDiscord<ElegantBeef> Ideally a compiler you know is just going to output the code you want
02:38:59FromDiscord<shadow.> hmm
02:39:12FromDiscord<shadow.> trueeee
02:39:22FromDiscord<shadow.> i guess ill learn how to write an actual compiler lmao
02:39:30FromDiscord<ElegantBeef> I mean i just told you an easy way to do it
02:39:38FromDiscord<ElegantBeef> But sure go write a compiler 😄
02:39:40FromDiscord<shadow.> im too
02:39:43FromDiscord<shadow.> dumb to underrstand
02:39:46FromDiscord<shadow.> what you wrote
02:39:48FromDiscord<shadow.> in all honesty
02:39:49FromDiscord<shadow.> lmao
02:39:55FromDiscord<ElegantBeef> Well it's easier to learn that than make a compiler
02:40:00FromDiscord<shadow.> never worked with nimscript before
02:40:08FromDiscord<ElegantBeef> https://github.com/beef331/nimscripter
02:40:11FromDiscord<ElegantBeef> It's fucking easy with that
02:40:17FromDiscord<shadow.> hm alr ill take a look
02:40:37FromDiscord<ElegantBeef> And now thanks to rebel annoying me you can just make a string to compile
02:40:57FromDiscord<shadow.> wait a minute
02:41:04FromDiscord<shadow.> i have idea 💀
02:41:22FromDiscord<shadow.> lemme try my thingy first if that doesnt work ill look intro nimscripter
02:43:38FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2GNQ
02:43:43FromDiscord<ElegantBeef> That's mostly all you need to be honest
02:43:57FromDiscord<ElegantBeef> Sorry https://play.nim-lang.org/#ix=2GNR
02:44:15FromDiscord<shadow.> ohh i see ok
02:44:19FromDiscord<shadow.> hmm
02:44:26FromDiscord<shadow.> alr if my current attempt does not work ill def do that lmao
02:44:47FromDiscord<ElegantBeef> basically what'll happen is your macro will endup doing `saveCode(name, transpiledNim)`
02:45:15FromDiscord<ElegantBeef> It's kinda funny that you'd have to have this brainfuck compiler, the nim compiler, and a C compiler 😄
02:45:36FromDiscord<shadow.> lmfao yeah
02:47:47FromDiscord<ElegantBeef> You know when you get a star for a repo after you link it the lurkers are lurking 😄
02:48:12FromDiscord<shadow.> lmfaoo
02:49:07FromDiscord<shadow.> ok i made the compiler lmao
02:49:10FromDiscord<shadow.> its rly shitty but it works
02:49:22FromDiscord<ElegantBeef> Does it require recompilation of the nimcode?
02:49:38FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GNT
02:49:42FromDiscord<shadow.> i dont think so
02:49:45FromDiscord<shadow.> the compiler doesnt need to recompile itself
02:50:15FromDiscord<ElegantBeef> I mean that's just the intepreter
02:51:04FromDiscord<shadow.> but compiled
02:51:04FromDiscord<shadow.> yes
02:51:06FromDiscord<shadow.> LMAO
02:51:11FromDiscord<ElegantBeef> I thought you were converting the brainfuck to Nim operations
02:51:15FromDiscord<shadow.> i mean i could do that but
02:51:17FromDiscord<shadow.> ehhhhh
02:51:26FromDiscord<shadow.> ehhhhh
02:51:28FromDiscord<shadow.> do i really want to
02:51:29FromDiscord<shadow.> lol
02:51:36FromDiscord<ElegantBeef> It's not even compiled it's just shipping the intepreter 😄
02:51:39FromDiscord<shadow.> yup
02:51:40FromDiscord<shadow.> i know
02:51:40FromDiscord<shadow.> LOL
02:52:07FromDiscord<shadow.> no ik what u mean i could actually translate it to nim operations but eh
02:52:52FromDiscord<ElegantBeef> My nimscripter suggestion was cause i thought you were attempting that 😄
02:53:16FromDiscord<shadow.> ohhhh
02:53:17FromDiscord<shadow.> shoot
02:53:17FromDiscord<shadow.> wait
02:53:19FromDiscord<shadow.> that'd be kinda cool
02:53:22FromDiscord<shadow.> alr ill try that tmr lmfao
02:54:46FromDiscord<ElegantBeef> Well i'll be around when you inevitably run into an issue
02:54:52FromDiscord<shadow.> thanks
02:56:23FromDiscord<ElegantBeef> I do think it's mostly well documented but YMMV
03:11:52FromDiscord<Rebel> Where is disruptek when you need him lol
03:13:04FromDiscord<ElegantBeef> He's here
03:13:43*vicfred joined #nim
03:19:08FromDiscord<ajusa> What is the generally accepted way to handle closing channels and signaling to receivers that they can stop calling `recv`? I'm currently doing a `while chan.peek > -1` where the other thread closes chan once it is done, but this appears to deadlock sometimes
03:21:46FromDiscord<ajusa> This clearly doesn't work, if a channel closes once it is done but the receiver still has work to do, as all of that work gets deleted.
03:25:49FromDiscord<ElegantBeef> can you not just use `tryRecv` and read the message that it gives you?
03:25:59*jaggz left #nim ("Leaving")
03:26:22FromDiscord<ElegantBeef> I havent used channels ever so... i'm just spitballing
03:26:51FromDiscord<ElegantBeef> Ah nvm
03:26:53FromDiscord<ElegantBeef> Misread it
03:26:56FromDiscord<ajusa> I believe that `tryRecv` can return false even there is still work left to be done, so that doesn't work
03:27:46FromDiscord<ElegantBeef> I didnt realize that the message is just what it's sending. A weird idea would be a coresponding channel that's a bool, that just sends a true when the channel is closed
03:28:09FromDiscord<ElegantBeef> No clue the proper method as i've never used channels, so probably best to just wait for someone that does
03:47:32FromDiscord<ajusa> I'm giving up and taking a look at weave lol, hopefully it solves my problems
03:47:42FromDiscord<Rebel> haha
03:47:45FromDiscord<Rebel> weave is hot
03:47:49FromDiscord<Rebel> channels are not fun to deal with 😦
03:48:04FromDiscord<Rebel> this might help
03:48:05FromDiscord<Rebel> https://github.com/dom96/nim-in-action-code/blob/master/Chapter3/ChatApp/src/client.nim#L39
03:48:25FromDiscord<Rebel> although that doesn't really use channels but uses a threadpool to see if the data is ready
03:49:58FromDiscord<ajusa> I actually based my code off of that lol. The issue I was running into is exiting. readLine doesn't exit the way it is used there, because the EOFError is thrown inside the `spawn`ed thread.
03:50:45FromDiscord<ajusa> So it isn't easy to figure out if you are done reading the file without additional io calls which seemed to slow down my code even more once I timed it
03:52:45FromDiscord<ajusa> See https://github.com/nim-lang/Nim/issues/15167 for what I am talking about 😦
03:52:46disbot(Re-)raise exceptions from the spawned proc when a `flowVar` is queried with `^flowVar` ; snippet at 12https://play.nim-lang.org/#ix=2uaF
03:54:44FromDiscord<Rebel> Look on the bright side
03:54:57FromDiscord<Rebel> At least you're able to create your flowVar
03:55:25FromDiscord<Rebel> ` Error: cannot create a flowVar of type: Table[system.string, system.string] ` 🙃
03:56:13FromDiscord<ajusa> huh
03:56:46FromDiscord<Rebel> Exactly
03:57:12FromDiscord<Rebel> 15 minutes I'm never getting back and now I have to rewrite the solution to use threads + locks manually and make sure I don't screw that up
04:05:04FromDiscord<Rebel> On a scale from 1-10 how frowned upon would it be to have a global variable that corresponds to a workerthread 🤔
04:06:01*supakeen quit (Quit: WeeChat 2.9)
04:06:36*supakeen joined #nim
04:11:04FromDiscord<ajusa> that's probably fine
04:11:18FromDiscord<Rebel> Well I wish that was the only problem I had to worry about lol
04:11:30FromDiscord<Rebel> I will have to wait for disruptek to be on to ask him the rest
04:13:01disruptekwhat?
04:13:19disruptekthere's nothing to screw up.
04:14:12disruptektalk to me when you get to the intersection of macros, concepts, generics, and statics.
04:14:19disruptekthis is where the fun begins.
04:14:22*disruptek throbs.
04:14:32FromDiscord<Rebel> well I do eventually want to talk about just macros
04:14:41FromDiscord<Rebel> compile time macros and changing code on the fly during compile time
04:14:47FromDiscord<Rebel> but that conversation is for another day
04:14:52FromDiscord<Rebel> I have 3 important questions
04:15:02FromDiscord<Rebel> ok maybe just important to me lol
04:15:39FromDiscord<Rebel> ok actually 2 one was just solved by rtfm
04:16:01FromDiscord<ajusa> I tried using weave and now my code doesn't compile↵`weave-0.4.0/weave/parallel_tasks.nim(162, 25) Error: type mismatch: got <ptr Flowvar[system.string], int literal(0)>`
04:17:08FromDiscord<Rebel> huh maybe I don't have any questions I think I have it figured it out
04:17:18FromDiscord<Rebel> (edit) removed "it"
04:17:19disruptekthis guy has been threatening to use threads and a lock ever since i suggested it 10 days ago.
04:17:19FromDiscord<Rebel> in theory
04:17:38disruptekevery time i turn around, he's abandoning some other mad approach.
04:19:16*Cthalupa quit (Ping timeout: 240 seconds)
04:20:46*Cthalupa joined #nim
04:20:58FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=2GOf
04:22:54disrupteknow c'mon now, quit threatening to implement this correctly and simply and just do it.
04:23:27FromDiscord<ElegantBeef> If you continue threatening disrupteks going to leave again after using some bad words
04:25:05disruptekrror: the macro body cannot be compiled, because the parameter 'goatfucker' has a generic type
04:25:15disrupteki wonder wtf that means.
04:26:57FromDiscord<Rebel> Did you check issues ajusa?
04:27:07FromDiscord<Rebel> I am spinning up the vm disruptek
04:27:09FromDiscord<Rebel> I actually think I got it
04:27:18FromDiscord<Rebel> well in theory I do lol
04:28:26FromDiscord<Rebel> Because what I did was I have a global worker thread and global lock within that job.nim at the top and when it's time to stop that certain job I just join the thread and deinit lock else it just continues running it's own while loop
04:28:56FromDiscord<ajusa> Yeah, but I didn't see anything with the same error message.
04:29:06FromDiscord<Rebel> weird...
04:32:23FromDiscord<ajusa> It does work without weave (using just threadpool) but it is slower than the single threaded implementation
04:32:57*Prestige quit (Quit: Prestige)
04:33:07*vicfred quit (Quit: Leaving)
04:33:52FromDiscord<sealmove> i am writing some data to a stream by using a proc that I don't have control over. i want to know how many bytes were written to the stream by it.
04:34:17*Prestige joined #nim
04:34:32FromDiscord<ElegantBeef> use `stream.getPosition` call the proc then compare with `stream.getPosition`
04:34:39disruptekor use a stream proxy.
04:34:46FromDiscord<sealmove> oh write I am stupid
04:34:49FromDiscord<sealmove> right
04:35:01FromDiscord<sealmove> that was an easy one, thx
04:39:05*thomasross quit (Ping timeout: 240 seconds)
04:40:54FromDiscord<sealmove> are buffers initialized to zero?
04:40:54FromDiscord<Rebel> hmmmm any wisdom?
04:40:57FromDiscord<sealmove> by default
04:41:03FromDiscord<sealmove> i mean arrays
04:41:07disruptekyes.
04:41:11FromDiscord<Rebel> https://media.discordapp.net/attachments/371759389889003532/785002877876830218/unknown.png
04:41:13FromDiscord<Rebel> 🤔
04:41:55disruptekwhy am i seeing `Future` in your threading code?
04:41:59FromDiscord<Rebel> um
04:42:06FromDiscord<Rebel> because I need to do async things within that proc
04:42:06FromDiscord<ElegantBeef> You can use `{.noinit.}` for non globally scoped variables
04:42:31FromDiscord<Rebel> does that help?
04:42:37FromDiscord<Rebel> like in terms of performance
04:42:47disruptekno.
04:42:51FromDiscord<Rebel> so should I be awaiting?
04:42:52FromDiscord<Quibono> Rebel you’re making disruptek cry with this asynchronous talk.
04:42:56FromDiscord<Rebel> well idk what to tell you
04:43:04disruptekhow do you expect that to work? the whole idea of async is that it's confined to a single thread.
04:43:06FromDiscord<Rebel> `proc Handler(holderTuple: tuple[config: Config, job: Job]): Future[Table[string,string]] {.async, thread.} = `
04:43:11disruptekseriously, i am in tears.
04:43:26disruptek🤦
04:43:34FromDiscord<ElegantBeef> Does `noinit` help for performance? I imagine so since you dont have to zero bytes 😄
04:44:00FromDiscord<Rebel> I guess I could have a global variable master seq of tables and each time I get a response just append it there and then ship them all at end?
04:44:03FromDiscord<Rebel> wait no I can't do that
04:44:11FromDiscord<Rebel> well I could but that is yikes
04:44:23disruptekyou are making this so incredibly difficult.
04:44:29FromDiscord<Rebel> hmmmm I guess have my seperate thread in the handler call the async proc?
04:44:48*vsantana joined #nim
04:45:04disrupteklook, the thread shouldn't have any async code anywhere near it.
04:45:12disruptekno async. no Futures.
04:45:27*narimiran joined #nim
04:45:27disruptekjust use a lock. that's it. `withLock mylock: fuck with the table`
04:45:44FromDiscord<Rebel> ok then what am I suppose to do with results then?
04:45:47disruptekthen on your async side, where life is shitty, you use the lock.
04:45:52disruptekthat's it.
04:46:05disruptekis someone paying you for this work?
04:46:08FromDiscord<Rebel> no lol
04:46:12disruptekokay.
04:46:15disruptekthat's too bad.
04:46:24FromDiscord<Rebel> What am I suppose to do with the results though because they need to be shipped immediately?
04:46:40FromDiscord<Rebel> I can't just append them to a master seq of tables and ship them all at once when the user decides to stop the job
04:46:44FromDiscord<Rebel> for two reasons
04:46:48disruptekyou manipulate the table in your thread, adding the results.
04:46:53FromDiscord<Rebel> yes
04:46:56FromDiscord<Rebel> but what about shipping them
04:47:04FromDiscord<Rebel> I need to ship them to a server in json via http requests
04:47:08disruptekyou can poll the results or you can use a semaphore.
04:47:25FromDiscord<Rebel> isn't that what I'm already doing?
04:47:25disruptekthe thread can twiddle the semaphore to signal that it has changed.
04:47:49FromDiscord<Rebel> oh why are there semaphores now 😦 I thought it was just a global variable and locks I had to deal with lol
04:47:53FromDiscord<Rebel> oh shit
04:47:58FromDiscord<Rebel> I remember my important question now
04:48:08FromDiscord<Rebel> should I passing the lock to the function it spawns?
04:48:08disruptekwhen i say semaphore, i mean "some fucking boolean you can trip."
04:48:12FromDiscord<Rebel> (edit) "passing" => " bepassing"
04:48:14FromDiscord<Rebel> (edit) "bepassing" => "be passing"
04:48:22disruptekno.
04:48:23FromDiscord<Rebel> or should the function I spawn have it's own lock?
04:48:38FromDiscord<Rebel> so......
04:48:42FromDiscord<Rebel> when do I use the lock?
04:48:48FromDiscord<Rebel> because the proc I call is in a seperate file
04:48:50disruptekwhenever you read or write to the data structure.
04:48:51FromDiscord<Rebel> (edit) "seperate" => "separate"
04:49:05FromDiscord<Rebel> yes but how does it know what lock to use?? if it's not being passed in or created
04:49:07disruptekwell, pass the lock then, or make them both import the lock.
04:49:21FromDiscord<Rebel> oh you can import variables like Python?
04:49:31disruptekany symbol, yes.
04:49:39FromDiscord<Rebel> ok but that doesn't solve the biggest problem
04:49:48disruptekthese are not big problems.
04:49:59FromDiscord<Rebel> ok lol
04:50:00disruptekspending 10 days trying to make async work... this is a big problem.
04:50:01FromDiscord<Rebel> my small problem
04:50:14disrupteki can't recommend viagra, but i guess it helps some people.
04:50:20FromDiscord<Rebel> well I have a modular proc already that handles http comms that is fully async
04:50:23FromDiscord<Rebel> I am not rewriting it
04:50:26FromDiscord<Rebel> or making it synchronous
04:50:40FromDiscord<Rebel> and when my thread returns results they need to shipped off immediately
04:50:48FromDiscord<Rebel> via async http GET requests
04:50:56FromDiscord<Rebel> (edit) "via async http GET requests ... " added "with json params base64 encoded"
04:50:59disruptekwhat does this have to do with me?
04:51:30FromDiscord<Rebel> oh
04:51:33FromDiscord<Rebel> I got it
04:51:36FromDiscord<Rebel> just don't return anything
04:51:40FromDiscord<Rebel> or just a bool
04:51:47disruptekthe thread never returns.
04:52:09disruptekthe thread can modify the bool to indicate that the result has changed, or you can use a "proper" semaphore.
04:52:13FromDiscord<Rebel> oh
04:52:14FromDiscord<Rebel> fuck
04:52:24FromDiscord<Rebel> because I added the async pragma it's returning Future[void]
04:52:31disruptekyes.
04:52:55disrupteki can't tell if i'm having a heart attack or if it's just indigestion.
04:53:08disrupteki don't /smell/ toast but i do feel a little burnt.
04:53:31disruptekalso, there's something wet in my pants. might be unrelated, though.
04:53:44FromDiscord<Rebel> whelp idk what to do then lol I guess read nim forums or the manual and hope they say how to deal with calling async procs within a thread
04:53:54disruptekholy shit.
04:54:16disruptekjust stop using async in the thread. how many times do i have to say this?
04:54:25disruptekremove all async from the thread.
04:54:28disrupteknothing.
04:54:36disruptekno await, no waitfor, no .async, no Future.
04:54:37disrupteknothing.
04:54:39disruptekno async.
04:54:40disrupteknone.
04:54:42disrupteknothing.
04:55:08FromDiscord<Quibono> Lol disruptek I might need your advice on writing fast non-async code later.
04:55:09disrupteki can't smile. maybe it's a stroke.
04:55:40FromDiscord<Quibono> Could you smile before?
04:55:51*disruptek 🤔
04:56:03FromDiscord<Rebel> well wtf
04:56:10FromDiscord<Rebel> when do I ship the results then 😮
04:56:19FromDiscord<Rebel> I meant 😦
04:56:40FromDiscord<Rebel> not even a question of when but how
04:57:08FromDiscord<Quibono> So wait what’s the problem?
04:57:26FromDiscord<Rebel> lol I can't type all out again
04:57:33FromDiscord<Rebel> just do
04:57:38disruptekdo it any way you want.
04:57:45disruptekyou can use async for that, chucklehead.
04:57:54disruptekyou already said you aren't going to rewrite it.
04:58:24FromDiscord<Rebel> (edit) "just do ... " added "`from:Rebel#1782 job` in discord search"
04:58:38FromDiscord<Rebel> ok let's make sure we're on the same page I guess I will type it all out again
04:59:02FromDiscord<Rebel> well not all of it just what's relevant
04:59:21FromDiscord<Quibono> I think the message is use threads and don’t use any async anything
04:59:26FromDiscord<Rebel> way too late for that
04:59:32FromDiscord<Rebel> entire codebase is already fully async
04:59:34FromDiscord<Rebel> and over 2000 lines
04:59:38FromDiscord<Rebel> so not happening
05:01:44FromDiscord<Quibono> But isn’t the whole point that async is driving you crazy?
05:03:23FromDiscord<Quibono> Also just for my edification what does the program do?
05:03:44FromDiscord<Rebel> sent a long message, see http://ix.io/2GOk
05:03:55FromDiscord<Rebel> (edit) "http://ix.io/2GOk" => "http://ix.io/2GOl"
05:04:09FromDiscord<Rebel> Apply the filter and I describe the program and app a bit more lol
05:04:18FromDiscord<Rebel> Can't type it all out again lol
05:04:46disrupteki dunno why you're trying to keep it a secret.
05:05:18FromDiscord<Rebel> I'm not lol I mean I guess I could post it here
05:05:21FromDiscord<Rebel> don't want to spam or anything
05:05:29FromDiscord<Rebel> but do you what I mean now disruptek?
05:05:33FromDiscord<Rebel> (edit) "but do you ... what" added "see"
05:05:47disrupteksee what you mean about what?
05:07:04FromDiscord<Rebel> the problem....
05:07:08FromDiscord<Rebel> and my current conundrum
05:07:19disruptekthere's no problem, so, no, i don't see what you mean.
05:07:21FromDiscord<Rebel> this problem is slowly chipping away at my sanity
05:07:28FromDiscord<Rebel> oh well
05:07:44disruptekmine, too.
05:08:31FromDiscord<Rebel> I will try to reexplain it
05:08:33FromDiscord<Rebel> the problem is
05:08:38FromDiscord<Rebel> within the thread
05:08:40FromDiscord<Rebel> once I get the results
05:08:50FromDiscord<Rebel> they need to be shipped to the server asap
05:09:06FromDiscord<Rebel> and to do that I would use my modular async proc that handles http comms
05:09:18FromDiscord<Rebel> the question is how would I call it
05:09:24disruptekyou don't call it.
05:09:24FromDiscord<Rebel> if I can't do anything async within the thred
05:09:25FromDiscord<Rebel> (edit) "thred" => "thread"
05:09:41FromDiscord<Rebel> so the results just stay within my program and the serer never sees them?
05:09:44disruptekyou set a flag to indicate that it needs shipping.
05:09:51FromDiscord<Rebel> oh
05:09:52FromDiscord<Rebel> a threadvar
05:09:56FromDiscord<Rebel> a global threadvar
05:10:01disruptekno.
05:10:30FromDiscord<Rebel> oh but even if I specify a flag that it needs to be shipped I would need to do `await otherproctoshipresults(table: Table[string, string): Future[bool]`
05:10:37FromDiscord<Rebel> but I can't
05:10:40disruptekomg you really aren't pickin' up what i'm puttin' down and i just don't know how to make it any clearer.
05:10:53disruptekyou don't do any async shit in the thread. how many times? how many?
05:10:54FromDiscord<Rebel> ok
05:10:56FromDiscord<Rebel> I set the flag
05:10:57FromDiscord<Rebel> then what
05:10:59FromDiscord<Rebel> break the loop?
05:11:02FromDiscord<Rebel> stop collecting results?
05:11:03disruptekno.
05:11:05disruptekstop it.
05:11:20disruptekthen, on the async side, you lock the lock.
05:11:30FromDiscord<Rebel> but that's no bueno as it should always be running?
05:11:30disrupteknow you ship off the results and clear the table.
05:11:35disrupteknow you unlock the lock.
05:11:44disrupteknow the thread can result inserting data.
05:11:49disrupteks/result/resume/
05:11:59disruptekthe async side resets the flag.
05:12:13disruptekit always /is/ running.
05:12:16disruptekit's a thread.
05:12:26FromDiscord<Rebel> I will try tht
05:12:28FromDiscord<Rebel> (edit) "tht" => "that"
05:12:29disruptekhave you ever used threads?
05:12:37FromDiscord<Rebel> tbh it's been a while
05:12:41FromDiscord<Rebel> last time I used them was pthreads in C
05:12:42FromDiscord<Rebel> with ncurses
05:12:48FromDiscord<Rebel> don't really touch them
05:12:51FromDiscord<Rebel> mostly just asyncio
05:12:58disrupteki think only zedeus has ever made my balls hurt this much.
05:13:01FromDiscord<Rebel> (edit) "asyncio" => "asyncio.queue + uvloop + asyncio.gather"
05:13:07disruptekgonna need extra ice tonight.
05:13:22zedeuslol
05:26:18FromDiscord<Quibono> Disruptek any advice for writing real time code in Nim, other than using ARC?
05:26:59FromDiscord<lytedev> I should definitely NOT be proud of this, right? (Advent of Code day 6 spoilers) https://github.com/lytedev/advent-of-code/blob/f2d593837e76282a0b66b58f45478c0c934aad49/2020/src/day6.nim
05:27:36disruptekquibono: not really.
05:30:40FromDiscord<Quibono> Lol
05:30:42FromDiscord<Quibono> Thanks
05:31:06FromDiscord<Rebel> so if I have a global table that is a threadvar I should just export that var and import it within my job specific file and then just use that?
05:31:15disruptekyou shouldn't have a threadvar.
05:31:27disruptekdo you know what a threadvar is?
05:31:31disruptekthen don't use one.
05:32:03FromDiscord<Rebel> when do you use one then
05:32:15disruptekquibono: don't waste time optimizing code before it's slow.
05:32:34disruptek~manual
05:32:34disbotmanual: 11the Nim Manual is https://nim-lang.org/docs/manual.html -- disruptek
05:32:34disbotmanual: 11just good to Ctrl+F in cases like this
05:33:00FromDiscord<Rebel> lol already there https://media.discordapp.net/attachments/371759389889003532/785015917196214312/unknown.png
05:33:41disruptekwhat makes you think that is applicable? it's exactly what you don't want.
05:34:45FromDiscord<Quibono> Well I know I want my code to be as blazing fast as possible so
05:35:09FromDiscord<lytedev> do you? why?
05:35:16disruptekso i guess it won't do much, because most of your time will be spent on making it faster.
05:36:22disrupteki really only optimize with algorithms and in a couple cases i made new structures, like skiplists.
05:36:37disruptekbut basically, speed is never the limiting factor for my work.
05:37:05*Cthalupa quit (Ping timeout: 272 seconds)
05:37:50*Cthalupa joined #nim
05:38:52FromDiscord<Quibono> I’m trying to basically make a (for what it’s capable of) HFT program.
05:39:09FromDiscord<Quibono> Realizing that true HFT is kinda beyond the scope.
05:39:28disruptekit's impossible because you can't compete with their peering.
05:39:47FromDiscord<Quibono> I know, I’m solely just trying to see how fast I can get it
05:39:49FromDiscord<lytedev> also, "go fast only when you need to" still applies
05:39:57FromDiscord<Quibono> Lol fair
05:40:26FromDiscord<lytedev> but I understand wanting to go fast, you will just get a lot less help, since that kind of tuning is too specific
05:40:53disrupteki've thought about reimplementing LEAN in nim. i was pretty unhappy with the performance.
05:46:01FromDiscord<Quibono> That’d be cool.
05:57:07*waleee-cl quit (Quit: Connection closed for inactivity)
06:08:45FromDiscord<j-james> Is there a more idiomatic way to remove a character from a string than `join(split(string, '\n'))`?
06:11:05FromDiscord<lytedev> `string.replace('\n')`?
06:11:43mipri!eval import sequtils; echo "a\nb\nc".filterIt(it in {'a'..'z'})
06:11:46NimBot@['a', 'b', 'c']
06:14:26FromDiscord<j-james> !eval import strutils; echo replace("zebra", 'z')
06:14:28NimBotCompile failed: /usercode/in.nim(1, 30) Error: type mismatch: got <string, char>
06:15:03FromDiscord<j-james> oh, i am dumb, it's looking for a string
06:15:09FromDiscord<j-james> thanks lytedev
06:15:36FromDiscord<lytedev> ah sorry - the char overload requires a char to replace it - my bad
06:16:16FromDiscord<lytedev> (edit) `string.replace("\n")`?
06:45:51ForumUpdaterBotNew thread by Hazarre: Convert string into operator? , see https://forum.nim-lang.org/t/7210
06:51:26mipripretty disappointing day, but doing it again with sets at sequtils isn't bad. https://play.nim-lang.org/#ix=2GOL
07:17:08Zevvyeah I kind of hoped to get away without doing the washing and vacuuming today
07:17:36Zevvbut this is incommensurate
07:24:57FromDiscord<martinium> if using a threadpool how can I automatically create the max number of threads the cpu supports?
07:26:18FromDiscord<martinium> I'll be processing huge logs and want each thread of my 32core/64thread cpu fully utilized to speed up parsing
07:26:52miprithreadpool uses cpuinfo.countProcessors() and creates a pool size of min(that, MaxThreadPoolSize)
07:26:56FromDiscord<martinium> but would love to automatically adapt to any other cpus with less or more core counts automatically if I share my program
07:27:11FromDiscord<martinium> min to my understanding is 4
07:27:12mipriMaxThreadPoolSize is 256 and can be replaced at compiletime
07:27:54FromDiscord<martinium> so as long as there is enough work when I use spawn will that automatically create more threads?
07:32:56FromDiscord<j-james> i'm not particularly proud of my answer for today: https://play.nim-lang.org/#ix=2GOZ
07:33:01*habamax joined #nim
07:33:44FromDiscord<j-james> in particular, the `block` part is ugly and i didn't bother messing around with sets
07:33:46miprivery social media answer though, block everyone:
07:36:23FromDiscord<j-james> all these groups keep asking me to fill out their customs declarations forms
07:36:49FromDiscord<j-james> i can't take it anymore 😕
07:39:01FromDiscord<starl0rd> sent a code paste, see https://play.nim-lang.org/#ix=2GP4
07:39:02FromDiscord<lzoz> I did manage to solve in one-line today: https://play.nim-lang.org/#ix=2GP2
07:39:28FromDiscord<starl0rd> i could do `w[1] = 1.0000000001` and it gives me an error, like it should
07:39:45FromDiscord<starl0rd> but if i do something like `w[2] = 1.000000000000000000000000001` it takes it
07:40:08FromDiscord<starl0rd> is it a nim thing or a floating point standard thing ?
07:40:26miprifloating point thing.
07:40:37mipri!eval echo 1.000000000000000000000000001'f64 == 1'f64
07:40:39NimBottrue
07:40:48FromDiscord<starl0rd> smh
07:40:51FromDiscord<starl0rd> thx
07:42:10FromDiscord<j-james> absolutely poggers @lzoz
07:43:10miprimy first answer was more like https://play.nim-lang.org/#ix=2GP7 . only did it again to use sets
07:50:52narimiranmipri: which one is faster?
07:52:23mipriset version is marginally faster.
07:52:53narimirandidn't expect that
07:54:06mipriit's consistent, but very small, and probably changes with different inputs.
07:54:40miprithey're all short yes/no answers anyway so this could be replaced with bitmath and popcount
07:55:12mipriI'm still waiting for an actually interesting day. this year has been incredibly slow to ramp up.
07:55:39narimiranmipri: yeah, it seems the easiest year so far. but i don't mind
08:00:32narimiranmipri: on my machine, your array version is twice as fast than my set version
08:01:47mipriyour set version? you mean something other than https://play.nim-lang.org/#ix=2GOL ?
08:02:48narimiranyour set version might be smarter than mine ;)
08:03:56narimiranindeed is :)
08:04:13narimirantime to steal useful bits
08:04:44FromDiscord<ElegantBeef> Is there a reason why the jsobjects are always arrays in raw js?
08:53:48*NimBot joined #nim
08:54:09Zevvno
08:54:44FromDiscord<ElegantBeef> Ah ok, so i should try to fix it 😄
08:54:56FromDiscord<ElegantBeef> or atleast make an issue
08:58:25FromDiscord<ElegantBeef> Although it's weird since everywhere it uses the jsobject it attempts to assign the 0th except for on assignment
08:59:24FromDiscord<ElegantBeef> (edit) "assign" => "used" | "usedthe 0th ... except" added "index"
09:00:06FromDiscord<ElegantBeef> Like in this sample of generated code https://play.nim-lang.org/#ix=2GPs
09:20:04*Q-Master quit (Ping timeout: 256 seconds)
09:28:17*Q-Master joined #nim
09:36:13*mbomba joined #nim
09:46:23FromDiscord<mratsim> sent a long message, see http://ix.io/2GPN
09:48:08FromDiscord<mratsim> I recommend you use a service architecture with a queue/channel system. Logging is on a dedicated thread and workers post their log to that channel.
09:52:08*hnOsmium0001 quit (Quit: Connection closed for inactivity)
10:04:48*PMunch joined #nim
10:05:14PMunchThought I'd stream myself solving todays AoC
10:05:26PMunchHaven't looked at it yet
10:05:30narimiranPMunch: do it!
10:05:38PMunchJust grabbing something to eat before I start
10:24:48FromDiscord<Scarecrow> is it possible to use nim and python together? E.g write python libraries in nim. Or call python scripts from nim
10:25:00narimiransearch for `nimpy`
10:25:11FromDiscord<ElegantBeef> Cmon be modern
10:25:13narimiran~repo: nimpy
10:25:13disbotno footnotes for `repo:`. 🙁
10:25:15narimiran!repo: nimpy
10:25:16FromDiscord<ElegantBeef> !repo nimp
10:25:17disbotquery failed 😢
10:25:20FromDiscord<Scarecrow> https://github.com/yglukhov/nimpy
10:25:23narimiran!repo nimpy
10:25:24disbotquery failed 😢
10:25:36FromDiscord<ElegantBeef> Bot is dumb dumb now?
10:25:39narimirangoal for 2021: learn how to use disbot
10:26:17narimiran~rtfm
10:26:17disbotno footnotes for `rtfm`. 🙁
10:29:46FromDiscord<Scarecrow> sent a long message, see http://ix.io/2GQ7
10:30:26FromDiscord<Scarecrow> is it much different in nim? Im a bit confused regarding difference between using exceptions
10:30:41narimiranhttps://nim-lang.github.io/Nim/options.html
10:31:07PMunchStream should be live now: https://www.twitch.tv/pmunche and https://www.youtube.com/watch?v=TgPWtgZvCSE
10:31:23FromDiscord<Scarecrow> interesting
10:34:19*audiofile joined #nim
10:34:28FromDiscord<Scarecrow> yet another dumb question - can we work with cpp libraries somehow? Lets say, I want to make qt5 gui (and qt is written in cpp. No idea if there are nim bindings already)
10:39:00*mbomba quit (Quit: WeeChat 3.0)
10:39:08narimiran*bit* limited
10:39:30narimiranpmunc4 doing unintended puns
10:43:31*audiofile79 joined #nim
10:46:53narimiranPMunch: `Letters` exist ;)
10:47:44*audiofile quit (Ping timeout: 260 seconds)
10:48:41FromDiscord<Imperatorn> I know there C interop, is there also cpp?
10:49:09FromDiscord<Imperatorn> How much manual work is required if it exists?
10:51:03FromDiscord<haxscramper> C++ backend can wrap anything but most convoluted parts of templated ++ SFINAE-based API and default values for templates
10:51:04narimiranif only pmunc4 look at those venn diagrams a bit more :)
10:51:57FromDiscord<haxscramper> But it requires some manual work currently as there is no finished automated wrapper yet.
10:52:50FromDiscord<haxscramper> I need to finally find a week to finally finish this thing instead of telling everyone this is WIP,
10:53:41FromDiscord<haxscramper> Not significantly more than wrapping C - https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importcpp-pragma
10:54:26FromDiscord<haxscramper> There are no bindings for Qt C++ widgets, but there is https://github.com/filcuc/nimqml
10:55:00narimiranPMunch: intersection!! ;)
10:55:44narimiranwe can
10:55:57narimiranPMunch: look at those venn diagrams again ;)
10:56:59narimiranyay :)
10:59:42*luis1 joined #nim
11:00:43*letto quit (Quit: Konversation terminated!)
11:07:54Zevvdude
11:07:54Zevvreally
11:07:57Zevvmake a PCB for that stuff
11:07:59Zevveveryone can do it
11:08:33Zevvthis makes me cry. the pain you are going through
11:10:33*suchasurge quit (Quit: The Lounge - https://thelounge.chat)
11:11:25*BitPuffin quit (Ping timeout: 240 seconds)
11:11:36*leorize[m] quit (Ping timeout: 246 seconds)
11:11:37*guelosk[m] quit (Ping timeout: 244 seconds)
11:11:57*Avatarfighter[m] quit (Ping timeout: 246 seconds)
11:11:57*MTRNord quit (Ping timeout: 260 seconds)
11:11:58*reversem3 quit (Ping timeout: 260 seconds)
11:12:01*Clonkk[m] quit (Ping timeout: 268 seconds)
11:12:05*ache-of-head[m] quit (Ping timeout: 240 seconds)
11:12:12*lytedev[m] quit (Ping timeout: 244 seconds)
11:12:17*lnxw37d4 quit (Ping timeout: 246 seconds)
11:12:18*pixtum[m] quit (Ping timeout: 246 seconds)
11:12:23PMunchHaha, it's not that bad once you get the hang of it
11:12:24*ee7[m] quit (Ping timeout: 240 seconds)
11:12:32*Zoom[m] quit (Ping timeout: 260 seconds)
11:12:37PMunchAnd as long as you have a small-tipped soldering iron
11:12:38*Jitty[m] quit (Ping timeout: 268 seconds)
11:12:38*L[m] quit (Ping timeout: 268 seconds)
11:12:44*Northstrider[m] quit (Ping timeout: 240 seconds)
11:13:10*krux02 joined #nim
11:13:15*unclechu quit (Ping timeout: 268 seconds)
11:13:42*jonjitsu[m] quit (Ping timeout: 260 seconds)
11:14:34*Cthalupa quit (Ping timeout: 260 seconds)
11:14:52*jaens[m] quit (Ping timeout: 260 seconds)
11:15:18*leorize[m]1 quit (Ping timeout: 244 seconds)
11:15:42*Cthalupa joined #nim
11:20:25*audiofile79 quit (Ping timeout: 240 seconds)
11:22:07*Cthalupa quit (Ping timeout: 265 seconds)
11:22:37*Cthalupa joined #nim
11:26:40*krux02 quit (Read error: Connection timed out)
11:27:06*krux02 joined #nim
11:27:43*Northstrider[m] joined #nim
11:27:56*luis1 quit (Ping timeout: 240 seconds)
11:30:23*leorize[m] joined #nim
11:32:46*guelosk[m] joined #nim
11:33:06*BitPuffin joined #nim
11:33:40*audiofile joined #nim
11:35:36*Avatarfighter[m] joined #nim
11:36:01*ache-of-head[m] joined #nim
11:39:55*ee7[m] joined #nim
11:40:24*unclechu joined #nim
11:41:19*PMunch quit (Quit: leaving)
11:41:24*pixtum[m] joined #nim
11:41:51*leorize[m]1 joined #nim
11:42:06*Clonkk[m] joined #nim
11:42:08*lytedev[m] joined #nim
11:43:06*lnxw37d4 joined #nim
11:44:40*MTRNord joined #nim
11:46:51*L[m] joined #nim
11:47:00*reversem3 joined #nim
11:47:55*Jitty[m] joined #nim
11:48:01*Zoom[m] joined #nim
11:48:11*jaens[m] joined #nim
11:48:15*letto joined #nim
11:49:42*jonjitsu[m] joined #nim
11:55:41FromDiscord<dom96> Good morning all
12:06:02*supakeen quit (Quit: WeeChat 2.9)
12:06:34*supakeen joined #nim
12:17:58*Vladar joined #nim
12:20:40*luis1 joined #nim
12:21:34*lritter joined #nim
12:39:05Zevvoy dom96
12:41:46avassis relative imports the way to go when testing projects? see: https://github.com/albinvass/hatty/pull/13/files#diff-06a4913d7f29ab030930ca964ec03e57667288d05c8001ccbe48fa6682e1801e
12:41:47disbotadd tests
12:41:57avassor are there better ways to handle that?
12:48:38FromDiscord<haxscramper> Quotes and `.nim` extension is not necessary, and you can just use package name directly, like `project/submodule`
12:49:07FromDiscord<haxscramper> There is a `config.nims` in tests directory adds your project to import path accordingly
12:52:57avasshaxscraper: great thanks!
12:54:15*FromDiscord quit (Remote host closed the connection)
12:54:28*FromDiscord joined #nim
13:00:09*luis1 quit (Ping timeout: 260 seconds)
13:03:23narimiranZevv: regarding #16271 - do you `cd` into each directory before compiling, or is it compiled like `nim c a/t.nim`?
13:03:26disbothttps://github.com/nim-lang/Nim/issues/16271 -- 3Nimcache confusion compiling files with the same name in different directories ; snippet at 12https://play.nim-lang.org/#ix=2GQX
13:04:08Zevvcd in
13:04:21Zevvit's in the description
13:04:22narimirandon't do that. solved. :P
13:04:26*Zevv quit (Quit: leaving)
13:05:29*Zevv joined #nim
13:05:59Zevvah right, how could I not have thought of that myself
13:06:04Zevvhow silly of me
13:06:05narimiransilly you
13:06:24ZevvI was looking into fixing this
13:06:28Zevvbut now I don't have to
13:06:30narimiran:P
13:06:31ZevvI'll throw away my PR
13:06:44narimiranmakes sense
13:06:51avasshaxscamper: alright I figured out that you can use a nim.cfg as described here: https://github.com/nim-lang/nimble#tests
13:06:58*luis1 joined #nim
13:07:17avassnow the next question, why are my tests skipped when running them with `testament all` but not when running a specific test :)
13:07:18*spiderstew joined #nim
13:07:52avassthey show up as 'JOINED* in the terminal but skipped in the html results
13:08:13narimiranavass: maybe they need to be named `t*`
13:08:26narimiran(the first letter needs to be `t`)
13:09:03avassnarimiran: the file name? they are
13:09:12avassor it is I guess since I only have one test file so far
13:15:36avassoh I guess 'all' only looks for tests/*.nim ?
13:16:25avassor actually it finds more tests but doesn't run them since they don't they match the default pattern or something
13:17:49FromDiscord<haxscramper> I think it is `tests/t`
13:21:23*hmmm joined #nim
13:28:39*Kaivo joined #nim
13:28:55*narimiran quit (Ping timeout: 272 seconds)
13:29:19FromDiscord<flywind> `testament all` only tests `tests//t`
13:30:34*narimiran joined #nim
13:32:23FromDiscord<flywind> You could use `testament cat .` instead to test `tests/t`
13:36:41*sagax quit (Remote host closed the connection)
13:45:05avassyeah I used `testament pattern "tests/*/*.nim"` instead
13:45:52avasscat . might be a better fit though
13:56:51FromDiscord<krisppurg> Is there way to try pulling data from the child process as one call, and then using the fact that it tells you how many bytes you just put into the array?
14:01:36*audiofile quit (Ping timeout: 268 seconds)
14:20:51*luis1 quit (Ping timeout: 272 seconds)
14:26:33*sagax joined #nim
14:26:49FromDiscord<krisppurg> anyone?
14:28:11*luis1 joined #nim
14:29:57Zevvi think I dont understand what you're saying
14:40:47FromDiscord<krisppurg> oh sorry let me summarise it for you, is there a way to pull data from the stdout child process, that tells you how many bytes?
14:45:18Zevvyou can get the outputStream and do readData on that
14:45:42Zevvthat's the portable way. I usually use posix stuff myself if I target linux only, because I think the osproc interface is lacking in a lot of ways
14:46:16ZevvI think the streams interface might block, even, until the requested # of bytes are actually available
14:57:38FromDiscord<krisppurg> wait can you get the amount of bytes you can put into the array?
14:57:44FromDiscord<krisppurg> (edit) "array?" => "array, in streams?"
14:58:01FromDiscord<krisppurg> @Zevv
15:08:00FromDiscord<shadow.> !eval echo "a".char
15:08:02NimBotCompile failed: /usercode/in.nim(1, 9) Error: type mismatch: got <string> but expected 'char'
15:08:06FromDiscord<shadow.> rip
15:08:09FromDiscord<shadow.> [0] it is
15:08:52FromDiscord<krisppurg> !eval echo cast[uint8]("a")
15:08:54NimBot64
15:10:50*luis1 quit (Ping timeout: 264 seconds)
15:14:57FromDiscord<shadow.> fair enough
15:16:29FromDiscord<Rika> !eval echo "a".chr
15:16:30NimBotCompile failed: /usercode/in.nim(1, 9) Error: type mismatch: got <string>
15:16:38FromDiscord<Rika> or was it ord
15:16:50FromDiscord<Rika> i dont know lol
15:16:51FromDiscord<Rika> w/e
15:17:32Zevv!eval echo 'a'.int
15:17:34NimBot97
15:18:12FromDiscord<shadow.> yeah ord lol
15:18:14FromDiscord<shadow.> chr is the opposite
15:18:14FromDiscord<sealmove> Yo @PMunch I did the refactoring and the default endianness parameter https://github.com/PMunch/binaryparse/pull/13
15:18:15disbotParser & field options rework
15:18:37FromDiscord<shadow.> shoot i cannot figure out why my aoc solution is wrong lmao
15:18:52Zevvshadow.: share your stuff
15:19:11Zevvwe should be able to hint without spoilers
15:19:34FromDiscord<shadow.> kk
15:19:48FromDiscord<shadow.> https://hatebin.com/ykpmfsktap
15:20:20FromDiscord<shadow.> im getting `1636` for my input
15:20:22FromDiscord<shadow.> says it's too lo w
15:21:21ZevvLets rubberduck. talk about it. explain to me how your code works.
15:21:28FromDiscord<shadow.> kk
15:21:35FromDiscord<shadow.> so first it splits the groups on the "\n\n" delim
15:21:52FromDiscord<shadow.> a group looks like this
15:21:58FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GRO
15:22:13FromDiscord<shadow.> then it finds how many times any letter in "abcxyz" appears in the group using regex
15:22:22FromDiscord<shadow.> then it removes duplicates by turning the matches into a hash set
15:22:34Zevvwhere does "abcxyz" come from?
15:22:48FromDiscord<shadow.> those are the only questions that are considered
15:22:56FromDiscord<shadow.> all others are ignored
15:22:58*hmmm quit (Ping timeout: 246 seconds)
15:23:08FromDiscord<shadow.> WAIT
15:23:14FromDiscord<shadow.> is that only in the example....
15:23:23FromDiscord<shadow.> oh fuck
15:23:24FromDiscord<shadow.> LMAO
15:23:29Zevvyw :)
15:23:47Zevv"The form asks a series of 26 yes-or-no questions marked a through z."
15:23:53FromDiscord<shadow.> fuckk
15:23:54FromDiscord<shadow.> thank you
15:24:07FromDiscord<shadow.> welp
15:24:10FromDiscord<shadow.> i overcomplicated it lol
15:25:03*hmmm joined #nim
15:26:52FromDiscord<shadow.> part two time
15:28:25*vesper11 quit (Ping timeout: 240 seconds)
15:28:59hmmmhey dudes I was wondering...
15:29:31hmmmif I go around defining procs with T and never specifing the type, am I doing something very stupid?
15:30:06FromDiscord<shadow.> probably
15:30:11hmmm:3
15:30:21FromDiscord<Rika> I don't think so, unless you're not specifying the T either
15:30:37FromDiscord<shadow.> when you have a lot of code and the type isnt specified, how are you going to find your functions
15:30:44FromDiscord<shadow.> also zevv i finished part two lol
15:33:24*vesper11 joined #nim
15:35:18Zoom[m]Do I understand correctly that I can't pass an inline iterator anywhere?
15:36:23Zoom[m]I'd like to write some iterator adapters, but it seems I can't do it with inline ones in any way besides collecting it first into a sequence.
15:36:26*brainproxy joined #nim
15:41:44FromDiscord<Rika> You can write a template that makes a closure iterator with a body that just iterates the inline then yields the result
15:43:53*oddp joined #nim
15:45:52Zoom[m]Ugh, that's a hacky way. Not sure I understand fully how to do it but thanks
15:47:36*hmmm quit (Ping timeout: 240 seconds)
15:47:55Zevvinline iterators are not real
15:48:05Zevvthey are basically suger that gets rewritten
15:48:48Zevvclosure iterators *are*, these you can store, pass, etc
15:51:21*krux02 quit (Remote host closed the connection)
15:51:47Zoom[m]Yeah, I understand that and that is unfortunate.
15:53:04Zoom[m]There's not much use for the iterators if you can't chain/adapt them
15:53:31FromDiscord<shadow.> man do i love hash sets
15:53:35FromDiscord<shadow.> ive no idea how i woulda solved day 6 without them
15:55:18FromDiscord<Vindaar> with a regular `set[char]` of course!
15:55:27Zevvthat :)
15:55:42Zevvor just uint32 and some bitops
15:55:48Zevvso many ways
15:56:30FromGitter<xflywind> see https://github.com/nim-lang/Nim/pull/11992
15:56:32disbotevery symbol becomes 1st class; defines 0-cost lambda and aliases; inline iterators/templates/etc can be passed to any routine ; snippet at 12https://play.nim-lang.org/#ix=250A
15:56:59Zevvaraq has been opposed to that for some time I believe
15:57:23FromDiscord<shadow.> wait you can intersect char sets?
15:57:24ZevvI have no clue about the implications, but it promises good stuff
15:57:49Zevvshadow: * and + operators = intersect and join
15:58:16FromDiscord<shadow.> oh wow
15:58:22FromDiscord<shadow.> lemme try that
15:58:37FromDiscord<shadow.> how do i turn a string into a char set?
15:59:07Zevvby hand I guess: iterate the chars and .incl them
15:59:22FromDiscord<shadow.> ahh
15:59:23FromDiscord<shadow.> hmm
15:59:34ZevvHashSet is not *wrong*
15:59:38FromDiscord<shadow.> fair enough
15:59:43FromDiscord<shadow.> are builtin sets any more efficient?
15:59:46Zevvyea
15:59:50FromDiscord<shadow.> oh ok
16:00:04*leorize[m] quit (Quit: Idle for 30+ days)
16:00:05FromDiscord<shadow.> that would complicate my part one tho
16:00:12FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GS6
16:00:16FromDiscord<shadow.> my precious unreadable fp
16:00:17FromDiscord<shadow.> 😢
16:00:17Zevvthe only work on reasonaby small types and are implemented with an array of bits
16:00:24Zevvso there is no hashing involved
16:00:28FromDiscord<shadow.> ohhh
16:00:30FromDiscord<shadow.> yeah thats faster ok
16:00:36FromDiscord<shadow.> lemme make a function to convert string to set
16:00:49Zevvbut all this optimization for these aoc things is bull
16:01:01Zevvit all runs instantanious, whatever you choose
16:01:18Zevvsave your optimizations for later
16:02:13FromDiscord<shadow.> gamer
16:02:15FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GS8
16:02:30FromDiscord<shadow.> works fine lol
16:02:53FromDiscord<shadow.> but yeah ik what u mean
16:03:16FromDiscord<shadow.> but i do like cutting down on dependencies so
16:03:19FromDiscord<shadow.> even if they are stl
16:06:31FromDiscord<lqdev> @Zoom↵> There's not much use for the iterators if you can't chain/adapt them↵that's where you're wrong, kiddo
16:06:39FromDiscord<lqdev> imagine not having for loops
16:07:02FromDiscord<shadow.> lol
16:10:57narimiranZevv: but now's the perfect time to learn about HashSet vs set and similar "optimizations"
16:11:01Zoom[m]@lqdev I'm not wrong here. One use case is technically not much 😀
16:11:27FromDiscord<lqdev> well you're right that iterators could get some love
16:11:38FromDiscord<lqdev> but i can't imagine Nim being Nim without them
16:11:49Zoom[m]To put it mildly...
16:15:59FromDiscord<Rika> Zoom the issue of closure iterators is that they're slow I believe
16:16:32Zoom[m]That's why I'm trying to avoid them until I can't :D
16:18:00FromDiscord<Rika> Why do iterators have to be either closures or inlined, is there no middle ground possible?
16:18:45Zevvclosure iterators are not slow. its just that inline iterators are fast
16:18:56Zevvbecause they are not there. the just become a loop
16:19:26*Zevv quit (Quit: Lost terminal)
16:19:45*Zevv joined #nim
16:19:45*Zevv quit (Changing host)
16:19:45*Zevv joined #nim
16:19:46FromDiscord<shadow.> sorry could someone explain the inline pragma to me i've never rly understood it
16:19:52FromDiscord<shadow.> it just replaces the code instead of opening new scope?
16:20:03FromDiscord<shadow.> or is it diff than that
16:20:28*Zevv quit (Client Quit)
16:21:23*Zevv joined #nim
16:26:37*letto quit (Quit: Konversation terminated!)
16:27:23*letto joined #nim
16:29:30FromDiscord<Quibono> Has anyone thought about doing an NLP library?
16:31:42*hmmm joined #nim
16:33:54hmmmhey how can I comment out a multiline part
16:34:11hmmmusing """ doesn't work, it asks me to use it or discard
16:34:18FromDiscord<Rika> #[comment]#
16:34:22hmmmoh
16:34:23hmmmnaisu
16:34:31FromDiscord<Rika> """ is a multiline string
16:34:43FromDiscord<Rika> strings are strings and comments are comments in nim
16:35:02hmmmI see
16:35:06hmmmty rika <3
16:35:56FromDiscord<Rika> ~~python just slapped a multiline string on a function and called it a comment~~
16:39:47FromDiscord<ache of head> lul
16:44:29FromDiscord<shadow.> lmao exactly
16:44:37FromDiscord<shadow.> python doesn't really have multiline comments
16:45:01FromDiscord<shadow.> they're not ignored by the interpreter
16:45:20FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GSA
16:47:27Zevvwho cares, for practical reasons its a fine multiline comment solutin
16:47:33Zevvits simple and sufficient
16:47:37FromDiscord<shadow.> fair enough
16:48:06*habamax quit (Quit: leaving)
16:48:42FromDiscord<Rika> you do you regards operators
16:48:47FromDiscord<Rika> dont force us though
16:48:58FromDiscord<shadow.> ofc lmao
16:49:01FromDiscord<shadow.> i actually like div and mod ngl
16:49:04FromDiscord<shadow.> it was just for fun
16:50:01FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2GSG
16:50:05FromDiscord<Rika> i dream of the day people ask about the equivalents of nim things in python
16:50:12FromDiscord<shadow.> lmao
16:50:22FromDiscord<shadow.> then py devs will be like
16:50:26FromDiscord<shadow.> "wait thats not a thing in python"
16:50:27FromDiscord<shadow.> "weird"
16:50:47FromDiscord<Quibono> Rika they do already, whenever they ask for faster python lol.
16:50:50FromDiscord<shadow.> its funny bc other than dynamic typing most of the "cool" parts of python can be implemented easily in nim
16:50:57FromDiscord<shadow.> in a few lines w macros
16:51:06FromDiscord<shadow.> or any metaprogramming
16:51:18FromDiscord<shadow.> hmm
16:51:25FromDiscord<shadow.> has a brainfuck interpreter been uploaded to nimble yet or no
16:51:27FromDiscord<shadow.> bc
16:51:29FromDiscord<shadow.> i might upload mine LMAO
16:52:04FromDiscord<shadow.> aw shit
16:52:04FromDiscord<shadow.> it has
16:52:35FromDiscord<InventorMatt> I think there is also a tutorial for it on the learn nim page
16:52:47FromDiscord<shadow.> for a brainfuck interpreter?
16:53:01FromDiscord<shadow.> oh yeah wow
16:55:00FromDiscord<Quibono> Ya'll need space jesus.
16:55:14FromDiscord<Rika> good point
16:55:22FromDiscord<Rika> shadow get working on that whitespace interpreter
17:01:24FromDiscord<Avatarfighter> hello hello everyoone
17:02:44*a_chou joined #nim
17:02:51FromDiscord<Rika> hello avatar
17:11:29*brainproxy quit (Quit: WeeChat 3.0)
17:11:36FromDiscord<shadow.> hmm
17:11:42FromDiscord<shadow.> ive got everything working in the compiler except for while loops
17:11:45FromDiscord<shadow.> not sure how to do that
17:17:55*a_chou quit (Remote host closed the connection)
17:25:10FromDiscord<krisppurg> Repost:↵> "wait can you get the amount of bytes you can put into the array, in streams?"
17:29:27*habamax joined #nim
17:47:11FromDiscord<exelotl> I had >> and << in my codebase for a while
17:47:49*abm joined #nim
17:48:11FromDiscord<exelotl> cause I'm a visual thinker and I get my left and right mixed up, so shl and shr were really hard for me to get used to
17:50:31FromDiscord<Vindaar> GCs are confusing 😦
18:02:33FromDiscord<krisppurg> Any answers?
18:09:20*hmmm quit (Ping timeout: 256 seconds)
18:09:37*hmmm joined #nim
18:12:21FromDiscord<exelotl> I still don't really understand the question. But streams don't have a max capacity if that's what you mean
18:14:52*habamax_ joined #nim
18:17:39FromDiscord<haxscramper> I also dont' really get the question either, but if this is related to the earlier one - I don't think it is possible to determine how many bytes has been read from child process stdout without just reading it all and then calculating length
18:17:56FromDiscord<haxscramper> Using regular stream reading operations
18:23:04FromDiscord<Vindaar> if anyone with a good understanding of GCs can tell me if this code here is always broken or not, that'd be appreciated 🙂 https://github.com/nim-lang/Nim/issues/16274
18:23:07disbot[GC] possible ref counting bug when assigning to ptr UncheckedArray ; snippet at 12https://play.nim-lang.org/#ix=2GTt
18:29:52disruptekpointers are inherently untracked.
18:32:05FromDiscord<Vindaar> yes, I'm aware of that. But the issue is the thing that is defined is technically still tracked, even if it should not be, no?
18:32:17FromDiscord<Vindaar> assigned instead of defined
18:32:51disruptekif you cast a ref'd thing into a pointer, you're stashing the rc.
18:33:37disruptekoh, hmm, your code doesn't do that.
18:34:05FromGitter<deech> Is there a way to statically determine all the functions in scope that could be called on some value?, eg `let s = "hello world"; s._ ...`, fill in `_`.
18:34:26ForumUpdaterBotNew thread by Hazarre: Method/Procedure that returns values of multiple types? , see https://forum.nim-lang.org/t/7211
18:34:30disruptekyes, otherwise we couldn't compile code.
18:34:51FromGitter<deech> yes, but I want that as a typetrait or something ...
18:35:06disrupteknope.
18:35:29disruptekalso, why?
18:36:17disruptekvindaar: i don't understand this code.
18:37:05disruptekare you saying that arc successfully destroys the index but refc doesn't?
18:38:40FromDiscord<Vindaar> sent a long message, see http://ix.io/2GTD
18:38:42FromDiscord<Vindaar> yes with arc it works fine
18:39:47disruptekafaict, if arc adjusts the rc correctly, then it's a bug in the other gc.
18:40:14disrupteksurprising though that may be.
18:40:32FromDiscord<Vindaar> that at least makes me hopeful it can be fixed
18:40:49disruptekwell, don't take my word for it.
18:40:52*hnOsmium0001 joined #nim
18:41:11FromDiscord<Vindaar> yea, no worries
18:41:51disruptekit's interesting that arc is smart enough to catch that.
18:42:36FromDiscord<Vindaar> I'm wondering though if it just doesn't crash the program with ARC but isn't actually working correctly? i.e. leaking memory or something?
18:43:04disruptekeasy enough to check.
18:43:23disruptektry orc, first. then -d:useMalloc and valgrind.
18:44:08disrupteksince you're unsure, my guess is that it leaks. 😉
18:44:55FromDiscord<Vindaar> compiled with `--gc:orc -d:useMalloc` under valgrind: "==8882== All heap blocks were freed -- no leaks are possible"
18:44:56disruptekthe subtext here is that it's not a bug, of course.
18:45:14disruptekwow.
18:45:34FromDiscord<Vindaar> orc is magic 😉
18:45:45disruptekwait, they are values.
18:46:15disruptekoh, okay. i'm finally reading the code properly.
18:46:35FromDiscord<Vindaar> "they" being what?
18:46:38disruptekyou should dump that with expandArc and see what it does.
18:47:39FromDiscord<Vindaar> never used `expandArc`. Where does the expanded stuff go?
18:47:47disruptekto the console.
18:48:15FromDiscord<Vindaar> eh,
18:48:24FromDiscord<Vindaar> it didn't do anything
18:48:58FromDiscord<Vindaar> ohhh
18:48:59disrupteki still don't know how it could be smart enough for this. to put that another way, whether it /should/ be.
18:50:03FromDiscord<Vindaar> that's the thing I'm unsure about too. But to me it seems logical that something that is assigned to some untracked memory location is "gone" for the GC and should not be tracked anymore
18:50:49FromDiscord<Vindaar> expandArc just turns it into a `=copy(dat[idx], val)` call
18:52:16FromDiscord<Vindaar> well, then again that also does not make the most sense maybe, since `var a: ptr int; var b = 5; a[] = b; echo b` should still be valid code I guess
18:52:34FromDiscord<Vindaar> ahh, like I said, this is confusing to me 😛
18:53:46FromDiscord<Vindaar> in any case, the code isn't used like that anymore now. The thing is just that I still have some GC segfault and I don't know if it's just the same thing appearing in some more obscure way or something different
18:53:50disruptekthe unref doesn't even make sense.
18:54:10disruptekoh, it does. they are strings.
18:54:15FromDiscord<Vindaar> yes
18:58:27disruptekso i don't see a bug.
18:58:57disruptekyou'd think by now i'd have run this on my own machine.
18:59:01disruptekbut, nope.
19:00:19*habamax_ quit (Quit: Lost terminal)
19:10:00FromDiscord<sealmove> easy/efficient way to write `x` 0 bytes to a stream?
19:10:11FromDiscord<sealmove> were `x` is not known at CT
19:10:16FromDiscord<sealmove> where
19:11:37FromDiscord<sealmove> should I allocate a buffer and used `write` passing its address?
19:12:16*habamax quit (Ping timeout: 240 seconds)
19:12:25*thomasross joined #nim
19:18:38FromDiscord<Vindaar> disruptek: sorry was afk. Feel free to run it, but you probably won't see much different things. Thanks for your help 🙂
19:18:58ZevvI *hate* nimforums formatting
19:30:56disruptekthere are so many efficient ways to write 0 bytes to a stream...
19:30:59*PMunch joined #nim
19:34:20disruptekvindaar: i think what happens is that the first values are freed in toTensor, but the seq still owns the contents. then your $i is freed in the loop. then the original s and its contents are freed, which are all $i but, no one knows or cares.
19:34:43disruptekchange you loop and i bet you can confirm that.
19:35:07FromDiscord<dom96> Zevv: yeah, markdown would be far nicer
19:36:01disruptekvindaar: so, i still think there's no bug. 😉
19:36:30FromDiscord<sealmove> binaryparse is becoming so beautiful (_)
19:36:31disruptekgenerics, macros, static, concepts. how come the triangle of death has four sides?
19:36:36FromDiscord<sealmove> _
19:37:46FromDiscord<sealmove> I think it has the best syntax in the world for parsing binary data
19:38:03disruptekshow us.
19:38:15FromDiscord<sealmove> https://github.com/sealmove/n4n6/blob/main/parsers/windows_link_file.nim
19:39:34disruptekpretty tight, i admit.
19:40:54*vsantana quit (Quit: Leaving)
19:41:07FromDiscord<Vindaar> disruptek: hm, but in `toTensor` nothing is supposed to be freed, because as you say `s` owns its values. And the C code explicitly does not unref on assignment. So isn't the issue we have too many refs instead of too few?
19:41:50*waleee-cl joined #nim
19:43:25disrupteklet's say we have a string X in s.
19:43:32disruptekin toTensor it gets rc==2, right?
19:44:02FromDiscord<Vindaar> yes
19:44:58disruptekso even if the ref is overwritten in []=, it will still be freed by s.
19:46:20FromDiscord<Vindaar> but the string is copied, so the reference that counts is the one of the copied string
19:46:47disrupteki don't care. 😁
19:46:55disruptekthe point is, s frees it.
19:47:11FromDiscord<Vindaar> but how can s free something that isn't in it 🤣
19:47:33FromDiscord<Vindaar> or you mean it's triggering too many frees, which ends up freeing something that isn't even stored in s ?
19:47:46disruptekPMunch: please give us a way to run arc on playground. 😚
19:48:34PMunchOoh, good idea
19:49:03PMunchI mean, PRs welcome as usual, but I guess I could add it if I remember :P
19:49:09*oddp quit (Quit: quit)
19:50:01disruptekPMunch: please give us a way to run valgrind on playground. 😬
19:50:22FromDiscord<sealmove> @PMunch hey, I made the refactoring
19:50:32FromDiscord<sealmove> + added default endian
19:50:49ForumUpdaterBotNew thread by Adnan: My Gintro program is crashing, see https://forum.nim-lang.org/t/7212
19:50:55PMunchDefault endian?
19:51:01disrupteksealmove: this doesn't use nimitai does it?
19:51:10PMunch@disruptek, that's gonna require a bit more work..
19:52:21FromDiscord<sealmove> disruptek: no, binaryparse is a much better alternative to nimitai. nimitai proved to be a dead-end because its language doesn't map well to nim. it's inherently OO (pun intended).
19:52:40FromDiscord<sealmove> So now I am annoying PMunch with tons of PRs 😛
19:52:52PMunchNot annoying at all!
19:55:07disrupteki guess that's good news, but i thought nimitai was pretty powerful because it can consume existing schemas. will you write a convertor to binaryparse?
19:58:21disruptekvindaar: the frees are correct afaict, the problem is that the stuff they are freeing isn't -- due to []=.
19:58:37disruptekit just happens to work out in arc.
20:00:27FromDiscord<sealmove> ok here is the plan. eventually I will work on the official nim backend for kaitai (which is in scala). it already works partially (50% of the tests pass, you can track progress here: https://ci.kaitai.io/). so nim will be able to leverage kaitai schema, but not at CT. you will have to run kaitai compiler to get a nim module which you will import from your project.
20:00:31Zevvsealmove: what about Kaitai
20:01:35FromDiscord<sealmove> i was so put off when I realized using object variants won't do...
20:02:03FromDiscord<sealmove> will have to simulate java features 😛
20:02:49disruptekcan't the kaitai compiler be run at compile-time?
20:02:58Zevvright, you can just run it from nim at CT
20:03:06FromDiscord<sealmove> kaitai compiler is written in scala
20:03:08*luis1 joined #nim
20:03:10Zevvit's just a binary
20:03:13Zevvyou can exec
20:03:18PMunchstaticExec
20:03:18FromDiscord<sealmove> hmm
20:03:22disruptekZevv: didn't you hear?
20:03:30PMunch!eval echo staticExec("uname -a")
20:03:30disruptekkaitai compiler is written in scala.
20:03:31NimBotCompile failed: /usercode/in.nim(1, 16) Error: 'staticExec' can only be used in compile-time context
20:03:35disruptekscala, man.
20:03:38disruptekit's scala.
20:03:41Zevvofcourse not. I'm always the last to the party
20:03:43PMunch!eval echo static: staticExec("uname -a")
20:03:44NimBotCompile failed: /usercode/in.nim(1, 24) Error: 'staticExec' can only be used in compile-time context
20:03:52PMunch!eval echo static(staticExec("uname -a"))
20:03:52FromDiscord<sealmove> hmm but it spits out a nim module
20:03:54NimBotLinux 0473fe6856ac 4.15.0-126-generic #129-Ubuntu SMP Mon Nov 23 18:53:38 UTC 2020 x86_64 Linux
20:04:03Zevvconst a = staticExec("data"); echo a
20:04:04disruptekbut it's scala, right? so...
20:04:06Zevv!eval const a = staticExec("data"); echo a
20:04:08NimBot/bin/sh: data: not found
20:04:13Zevv!eval const a = staticExec("date"); echo a
20:04:15NimBotSun Dec 6 20:04:14 UTC 2020
20:04:31disruptekZevv: dude. pay attention.
20:04:33disruptekit's scala.
20:04:37Zevvso
20:04:39PMunch!eval echo static(staticExec("ip addr"))
20:04:41NimBot1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000↵ link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00↵ inet 127.0.0.1/8 scope host lo↵ valid_lft forever preferred_lft forever
20:04:48disruptekmtu 65k
20:04:57PMunchAh right, it runs in a container without networking
20:05:01FromDiscord<sealmove> let's say you execute it at CT and get a nim module in your disk. can you import that at CT?
20:05:10PMunchSure
20:05:11Zevvinclude it
20:05:18Zevvnot sure about ordering tho
20:05:21disruptekhow do you think the compiler compiles?
20:05:33PMunchJust write a macro that staticExec, staticRead, parseStmt
20:05:33disruptekTHIS
20:05:34disruptekIS
20:05:35disruptekSCALA
20:06:05ZevvI fail to see the implications
20:06:19FromDiscord<sealmove> ok I didn't think about it, but the kaitai compiler becomes a dependency. you depend on a binary. I was going for something better, but yeah this works too.
20:06:27PMunchZevv, he's just pulling your leg :P
20:06:41ZevvPMunch: I know my homies, do'nt worry
20:07:43FromDiscord<sealmove> btw other non-OO language backends like Golang's are have troubles as well.
20:08:42FromDiscord<sealmove> Oh and about kaitai -> binaryparse, yes, I'd like to write such a backend
20:08:51FromDiscord<sealmove> Will be much easier than kaitai -> nim
20:09:10PMunchBut binaryparse is just Nim :P
20:09:13disruptekvindaar: i'm wrong about why it works.
20:09:32disruptekbut X's rc != 2, afaict.
20:09:57FromDiscord<sealmove> sure but it's much much easier to produce binaryparse syntax than plain-nim syntax
20:10:43PMunchThat's good to hear :) Means binaryparse is working
20:10:47*vicfred joined #nim
20:10:48FromDiscord<sealmove> first binaryparse must get enough plugins to match kaitai's featurefulness
20:11:04PMunchWould be a shame if it was easier to write your own parser than to use binaryparse
20:11:04FromDiscord<Vindaar> thanks for thinking about it disruptek. I'm not mostly afk right now, but I'm reading what you write
20:11:14FromDiscord<sealmove> I've written `createConditionalParser` and `createSizedParser`
20:12:52FromDiscord<sealmove> the 2nd one reads specific amount of bytes from your stream, creates a substream with these bytes, and reads your type from the substream, meaning some bytes might be ignored in parsing and padding might be used in encoding.
20:13:56FromDiscord<sealmove> once the refactoring PR is merged I can make a new one for adding these 2 as plugins.
20:31:29*Guest94576 joined #nim
20:31:31*Guest94576 quit (Read error: Connection reset by peer)
20:48:50*spiderstew quit (Quit: Konversation terminated!)
20:49:46*spiderstew joined #nim
20:49:52*narimiran quit (Ping timeout: 246 seconds)
21:06:21FromDiscord<Vindaar> disruptek I think I finally found my underlying issue causing the real GC issues I kept having. I hid a `deepCopy` call in my code to use for the non ARC code path. That also applied to the new ptr + len tensors, which probably did something nasty ... 🙂
21:19:35*PMunch quit (Quit: leaving)
21:22:06disruptekbut it's not in your repro.
21:23:10FromDiscord<Vindaar> it's in ggplotnim
21:23:36FromDiscord<Vindaar> and yes, it's unrelated to the issue I reported
21:27:16*hmmm quit (Ping timeout: 256 seconds)
21:29:03*hmmm joined #nim
22:11:30ForumUpdaterBotNew thread by Reneha: ANN: NimternalSQL, an in-memory SQL database library for Nim, see https://forum.nim-lang.org/t/7213
22:20:28*hmmm quit ()
22:59:03disruptekman, sets are so tight i can't come up with something faster.
23:11:03*rockcavera joined #nim
23:12:08*NimBot joined #nim
23:23:13FromDiscord<Gyllou> after using nim for a bit now i gotta say i love this language so much
23:23:27disruptekit's pretty great.
23:24:14voltistdisruptek: Sets and hashes are my favorite things. Even though they are so fast, I sometimes get over-excited and use them were I shouldn't
23:24:25FromDiscord<Gyllou> still working on my graph lib, its getting there. ill be excited to do a release sometime in the near future
23:24:40disrupteknice, i'm really looking forward to that.
23:24:44FromDiscord<Gyllou> yea metoo, im really into set theory
23:24:49disrupteksets, enums, hashes.
23:25:22FromDiscord<Gyllou> right now i have 8 different types of graphs available based on different implementations
23:25:49disruptekyou're gonna make me port everything off of gram.
23:25:57disruptekwell, i hope so, anyway.
23:26:03FromDiscord<Gyllou> 5 of them are hpc/disrtributed focused though, the api for the others is more simplistic
23:26:56disruptekdo you have a bloom filter impl?
23:27:11disrupteksomeone posted one that made me realize we should have something in stdlib.
23:27:33FromDiscord<Gyllou> yea its still not like release worth rn bc ive been hopping around between algos and implementations. its mainly something ive been working on late at night. ive had alot of other stuff going on in the lab so i have to do it in my extra time
23:27:40FromDiscord<Gyllou> no i dont i can look into it though
23:28:44disrupteki mean, it's as simple as array[T, set[range[0 .. N-1]]] but shrinking the buckets may require a brain.
23:29:41FromDiscord<Gyllou> thats not too bad, i cant work something up
23:29:49disruptekbecause the sets would need to be int16 ofc.
23:29:58FromDiscord<Gyllou> (edit) "cant" => "can"
23:30:46FromDiscord<Gyllou> yea we decided to partially support android with our main platform recently and its been a headache getting started
23:31:23disruptekremind me, what's the codebase written in?
23:31:31FromDiscord<Gyllou> ive never really used kotlin, though i have a fair amount of java experience. android is its own whole deal though
23:31:48FromDiscord<Gyllou> c/python/cython and its being converted mostly to nim
23:32:08disruptekhow has that gone so far?
23:32:24FromDiscord<Gyllou> everything we've done in nim has been so much easier
23:32:40FromDiscord<Gyllou> the big ticket item is porting our distributed deep learning stuff over
23:32:44disrupteki imagine the speed delta is pretty sick.
23:33:00FromDiscord<Gyllou> yea omg, proper threading is a life saver too.
23:33:25disrupteki know, python is such a pita for anything fast/big.
23:33:42FromDiscord<Gyllou> we are going to peel off python microservices for natural language processing though, its tough to replace spaCy right now
23:33:46voltistAlso this implementation of a bloom filter could easily use Nim's existing hash library & procs by splitting the hash into multiple smaller ints to emulate having multiple hash functions
23:33:49voltistSo less extra work
23:34:08voltist@Gyllou spaCy is awesome
23:34:11FromDiscord<Gyllou> thats a good point
23:34:38FromDiscord<Gyllou> yea it is lol so easy to use. i mean its pretty much spacy, stanford, or nltk rn and spacy is by far the best.
23:35:14FromDiscord<Gyllou> we dont want to use cloud nlp solutions because we need the bandwidth, also connection isn't guarenteed
23:35:36FromDiscord<Gyllou> also we are the smol, so $$$ for dem cloud services ya know
23:36:02disruptekhmmph.
23:36:16voltistSorry I'm out of the loop. Who's "we" here?
23:36:25FromDiscord<Gyllou> my company
23:36:35FromDiscord<Gyllou> when i say my company i mean like 8 people lol
23:37:02FromDiscord<ElegantBeef> Also voltist i had seen you made that PR 😄
23:37:03disrupteki hear everyone say this but when i crunch the numbers i think the cloud is cheap.
23:37:28disrupteki probably overvalue TCO though.
23:37:30voltist@ElegantBeef Indeed
23:37:56*Vladar quit (Quit: Leaving)
23:38:13disrupteki can see how bandwidth would be an issue, though.
23:38:21voltistFun fact: Fruit flies use bloom filters to detect novel odors
23:38:22voltisthttps://www.ncbi.nlm.nih.gov/pmc/articles/PMC6304992/
23:38:37disrupteklittle computers, i call them.
23:39:14voltistBut implemented on a very different, and slightly squishier architecture
23:39:52FromDiscord<Gyllou> so it is a contender, but we often need custom solutions because we are research focused. that and yea, we literally connect our bot via two 5G/4G connections and do channel bonding. we've got alot of traffic due to the UDR and ZMQ stuff going in and out
23:39:56disruptektype Bloomable = concept c ... hash(c) is int
23:40:21disruptekproc bucket[K, N](bloom: Bloom[K, N]; item: Bloomable; z: int): int16 =
23:40:32FromDiscord<Gyllou> thats really cool
23:40:50disruptekresult = int16(((z + 1) * (int(hash item) and int16.high)) mod N)
23:40:56disruptekor whatever.
23:41:54disruptekgyllou: i still want a job from you. 😁
23:41:55FromDiscord<Gyllou> yea ill look into that maybe this week. the android stuff is going to be a continued headache, but itll be worth it
23:41:59FromDiscord<Gyllou> lol
23:42:10disruptekc'mon, i'm cheap.
23:42:11FromDiscord<Gyllou> gotta keep the lights on for now
23:42:26disruptekpfffbt who needs lights.
23:43:12FromDiscord<Gyllou> lol
23:43:15disruptekvoltist: the bucket proc should take the hash as input, i guess.
23:47:02disruptekwell, if you write it, let me know. i can use it in a few places to make things even faster.
23:47:24disrupteki need to have fewer little projects.