<< 24-12-2020 >>

00:05:35*jaz80 joined #nim
00:07:38jaz80Newbie question. Is there a way to reference an array instead of copy it by value? I would like: let a = [1, 2, 3]; var b = a; b[0] = 42; to also affect `a`'s memory.
00:11:13FromDiscord<ElegantBeef> `a.unsafeAddr` would let you get a's pointer
00:11:57FromDiscord<ElegantBeef> `addr` and `unsafeaddr` are both considered "unsafe" though
00:12:06jaz80any safe way like rust?
00:12:30jaz80or i guess most other languages that have arrays
00:13:35FromDiscord<ElegantBeef> Well you made a an `let` which means you can only mutate it unsafely
00:13:46jaz80assuming that both were var, then
00:13:48FromDiscord<ElegantBeef> (edit) "Well you made ... a" added "'a'" | removed "an"
00:15:39disruptekwhy aren't you using a ref?
00:18:04jaz80mostly because i'm a newbie and the official tutorial only talks about them in the context of a custom type declaration. not sure how to use them for arbitrary variables
00:18:21disruptekah. refs are nim's managed (safe) pointers.
00:18:24disruptek~memory
00:18:24disbotmemory: 11The Nim memory model: https://zevv.nl/nim-memory/
00:19:04*qwertfisch quit (Ping timeout: 272 seconds)
00:19:14jaz80so how to create a reference to an an arbitrary array variable's memory outside of a `type` definition ?
00:19:29jaz80i'll read that, thanks
00:20:50disruptekyou cannot create a ref to something that is not a ref; the whole idea is that it's managed.
00:21:04disruptekif you want to do it unsafely, you can use a pointer.
00:21:05*beatmox quit (Quit: ZNC 1.8.0 - https://znc.in)
00:21:51FromDiscord<ElegantBeef> Well you can do this hideousness https://play.nim-lang.org/#ix=2Jkq
00:21:59disruptekyou can have an array of refs, of course, in which case you can share the values (references) as much as you want.
00:22:36disruptekthat's two refs to the same array.
00:23:24FromDiscord<ElegantBeef> Yea i know
00:24:45*krux02 quit (Remote host closed the connection)
00:24:47FromDiscord<ElegantBeef> Guess with expirmental views we can do this https://play.nim-lang.org/#ix=2Jks
00:26:28FromDiscord<ElegantBeef> The less silly version i guess would just do `b: var a.typeOf = a`
00:33:33FromDiscord<InventorMatt> jaz80: you could also try this https://play.nim-lang.org/#ix=2Jku
00:34:59FromDiscord<ElegantBeef> I always forget byaddr exists
00:38:25FromDiscord<no name fits> πŸ‘‹ just joined. Was considering doing a renderer in Nim
00:42:20FromDiscord<ElegantBeef> Hello
00:48:05*beatmox joined #nim
00:49:39*qwertfisch joined #nim
00:54:28*qwertfisch quit (Ping timeout: 268 seconds)
01:21:29*jaz80 quit (Remote host closed the connection)
01:26:50*Tanger joined #nim
01:35:42*qwertfisch joined #nim
01:40:29FromDiscord<sealmove> is there a way to export fields with the `export` statement?
01:40:43*qwertfisch quit (Ping timeout: 268 seconds)
01:41:40voltist@mratsim Ping
01:42:42*qwertfisch joined #nim
01:51:43*hnOsmium0001 joined #nim
01:58:30*matlock quit (Quit: Connection closed for inactivity)
02:08:46*tiorock joined #nim
02:08:46*tiorock quit (Changing host)
02:08:46*tiorock joined #nim
02:08:46*rockcavera is now known as Guest82066
02:08:46*tiorock is now known as rockcavera
02:12:17*Guest82066 quit (Ping timeout: 265 seconds)
02:13:04*qwertfisch quit (Ping timeout: 260 seconds)
02:14:17FromDiscord<shadow.> if i wanted to pack a 4-bit int and another 4-bit int into a char side by side, would `((i1 shl 4) or i2).char` work?
02:15:01FromDiscord<sealmove> what type are your `i1` and `i2` vars?
02:15:12FromDiscord<sealmove> you probably want to mask them before anything
02:15:22FromDiscord<shadow.> well they're going to be bytes, but they won't need more than 4 bits
02:15:42FromDiscord<shadow.> `type == byte`
02:16:13FromDiscord<sealmove> if you are sure the upper 4 bits are clear then your code will work, but it's always safe to mask explicitely
02:18:39FromDiscord<shadow.> kk
02:19:01FromDiscord<sealmove> `import bitops; (i1.masked(0 .. 3) shl 4) or masked(i2, 0 .. 3)`
02:19:19FromDiscord<shadow.> thanks
02:19:26FromDiscord<ElegantBeef> I've never seen anyone space the range like that πŸ˜„
02:19:59FromDiscord<sealmove> i space all operators :P
02:20:25FromDiscord<ElegantBeef> So you do `arr[ index ]`:P
02:20:34FromDiscord<sealmove> ok not all :P
02:20:35FromDiscord<shadow.> or arr [ index ]
02:22:11FromDiscord<shadow.> f ( a ) ;
02:22:16FromDiscord<shadow.> (edit) ") ;" => ");"
02:22:18FromDiscord<shadow.> lol
02:22:41FromDiscord<shadow.> is there a way to do that mask without the bitops import?
02:22:45FromDiscord<shadow.> like using and or something
02:22:51FromDiscord<sealmove> dunno `1..<3` is cute but i find `1 ..< 3` easier to read
02:23:31FromDiscord<ElegantBeef> Yea you can shadow it's `il or 0xe` afaik
02:23:40FromDiscord<ElegantBeef> (edit) "or" => "and"
02:23:47FromDiscord<sealmove> shadow sure, just do `((i1 and 0x0F) shl 4) or (i2 and 0x0F)`
02:24:04FromDiscord<shadow.> is that just 4 bit limit?
02:24:05FromDiscord<ElegantBeef> `0xe` being `15` which should be all the first bits high
02:24:18*qwertfisch joined #nim
02:24:28FromDiscord<ElegantBeef> f
02:24:30FromDiscord<ElegantBeef> yes it's f
02:24:31FromDiscord<ElegantBeef> πŸ˜„
02:24:58FromDiscord<ElegantBeef> Guess i forgot 0 existed
02:25:33FromDiscord<sealmove> i spend too much time with binary these days >_<
02:25:37FromDiscord<ElegantBeef> Also shadow how is `scantuple`? πŸ˜„
02:25:51FromDiscord<shadow.> lol i tried it
02:25:56FromDiscord<sealmove> scantuple?
02:26:11FromDiscord<shadow.> how's sequtils in prelude? πŸ˜‰
02:26:35FromDiscord<ElegantBeef> scantuple is a macro wrapper for `scanf` that makes it so you dont have to predeclare variables
02:27:03FromDiscord<ElegantBeef> https://nim-lang.github.io/Nim/strscans.html#scanTuple.m%2Cuntyped%2Cstatic%5Bstring%5D%2Cvarargs%5Buntyped%5D
02:27:04FromDiscord<shadow.> it's quite spicy
02:27:25FromDiscord<shadow.> the only one of my pr's that has been accepted added like 10 characters
02:27:26FromDiscord<shadow.> feelsbadman
02:27:45FromDiscord<ElegantBeef> My colourise PR is now green on tests πŸ˜„
02:28:01FromDiscord<sealmove> sweet
02:28:01FromDiscord<ElegantBeef> So just a few things and it might be accpted
02:28:21FromDiscord<shadow.> welp my integer compressor is done
02:28:37FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Jl1
02:28:39FromDiscord<shadow.> compresses ints in strings to 50% size
02:28:45FromDiscord<shadow.> lol
02:28:56FromDiscord<shadow.> as long as string.len mod 2 == 0
02:29:03FromDiscord<shadow.> wouldnt be hard to make it work for odds too
02:29:33FromDiscord<ElegantBeef> what's with the - 48?
02:29:45FromDiscord<sealmove> but this does not compress ints, it compresses strings
02:29:45FromDiscord<shadow.> 48 == '0'.ord
02:29:46FromDiscord<ElegantBeef> `- '0'.ord.byte`
02:29:54FromDiscord<shadow.> yeah it compresses strings that are ints
02:30:00FromDiscord<shadow.> it can only do strrings with only digits tho
02:30:06FromDiscord<shadow.> bc digits only really need 4 bits
02:30:09FromDiscord<shadow.> rather than the full 8 used in a char
02:30:19FromDiscord<shadow.> like for instance this could store pi in a txt at 50% size
02:30:29FromDiscord<ElegantBeef> guess you can just do `'0'.byte` πŸ˜„
02:30:36FromDiscord<shadow.> yeah that works too
02:30:43FromDiscord<shadow.> or '0'.ord
02:30:48FromDiscord<sealmove> sounds unuseful πŸ‘€
02:30:57FromDiscord<ElegantBeef> It very much is
02:30:58FromDiscord<shadow.> lmaooo
02:31:04FromDiscord<ElegantBeef> We've got `zippy` now
02:31:09FromDiscord<shadow.> i mean how else am i gonna store my pi txt at 50% size πŸ™„
02:31:22FromDiscord<sealmove> there are many better ways
02:31:27FromDiscord<shadow.> i know its sarcasm
02:31:30FromDiscord<shadow.> im just doing it to learn bitops
02:31:33FromDiscord<Quibono> Haters gonna hate
02:31:39FromDiscord<ElegantBeef> I hate that phrase
02:31:49FromDiscord<Quibono> Said like a real hater.
02:32:09FromDiscord<shadow.> !eval echo 0b1111
02:32:09FromDiscord<ElegantBeef> Well that phrase is used to deflect actual criticism into a "they're just haters"
02:32:12NimBot15
02:32:16FromDiscord<shadow.> 15 i see
02:32:20FromDiscord<shadow.> nice
02:32:28FromDiscord<shadow.> ohhh i get how that works now
02:32:34FromDiscord<ElegantBeef> lol
02:32:49FromDiscord<shadow.> bit and 1 preserves bit, so anything higher than those first 4 1 bits is masked out
02:32:54FromDiscord<shadow.> ensuring that it fits in 4 bits?
02:32:56FromDiscord<ElegantBeef> yes
02:32:59FromDiscord<shadow.> smat
02:33:00FromDiscord<shadow.> smart
02:33:09FromDiscord<ElegantBeef> shart
02:33:11FromDiscord<shadow.> shut
02:33:19FromDiscord<shadow.> what shall i name the decompress function
02:33:20FromDiscord<shadow.> hmm
02:33:26FromDiscord<shadow.> uncrush or inflate
02:33:26FromDiscord<shadow.> lol
02:33:48FromDiscord<ElegantBeef> doubleSize
02:33:51FromDiscord<shadow.> lmao
02:33:56FromDiscord<shadow.> makeReadable()
02:34:01FromDiscord<shadow.> englishify()
02:34:16FromDiscord<ElegantBeef> Englishify is the name of my IP -> sentence idea
02:34:41FromDiscord<ElegantBeef> instead of numbers use a LUT with 255 words to make ip's more human readable
02:34:50FromDiscord<ElegantBeef> (edit) "instead of numbers use a LUT with 255 ... words" added " 4"
02:35:24FromDiscord<ElegantBeef> Dont mention ipv6
02:35:28FromDiscord<shadow.> if i say "first bit" does that refer to the leftmost or rightmost one
02:35:36FromDiscord<shadow.> (in a byte, not considering endianess)
02:35:41FromDiscord<ElegantBeef> Depends on if the system is big endianess
02:35:46FromDiscord<shadow.> even inside the byte?
02:35:51FromDiscord<sealmove> shadow it depends
02:35:53FromDiscord<shadow.> i thought endianess was for multiple bytes
02:35:55FromDiscord<ElegantBeef> No
02:35:58FromDiscord<shadow.> oh
02:36:05FromDiscord<ElegantBeef> Endianness is counting from left or right πŸ˜„
02:36:08FromDiscord<shadow.> ahh i see
02:36:25FromDiscord<sealmove> there is byte endianness and bit endianness, though bit endianness is quite uncommon, and most of the time we consider the first bit to be the leftmost one.
02:36:28FromDiscord<shadow.> i mean little ended processers have the little bit at the end, is that at the right
02:36:30FromDiscord<shadow.> oh
02:36:32FromDiscord<shadow.> hm
02:36:41FromDiscord<shadow.> so first bit is at the left aka front aka most significant place
02:36:46FromDiscord<ElegantBeef> See i count the first bit the furthest right due to our number system
02:36:54FromDiscord<ElegantBeef> Where the least significant value is the furthest right
02:37:11FromDiscord<shadow.> if i wanted to get the 4 leftmost bits out of a byte would i just do byte shr 4?
02:37:51FromDiscord<sealmove> depends on context actually. when you do `x.masked(0 .. 1)` it means "mask the 2 rightmost bits.
02:37:59FromDiscord<shadow.> yeah
02:37:59FromDiscord<ElegantBeef> `byte and 0xf0 shr 4` gets the upper half, and `byte and 0xf` gets the lower
02:38:08FromDiscord<shadow.> hmm i see
02:38:14FromDiscord<sealmove> yes
02:38:23FromDiscord<shadow.> why do you have to mask before shifting?
02:38:28FromDiscord<ElegantBeef> You dont
02:38:30FromDiscord<shadow.> wont they be yeeted out the end anyways
02:38:33FromDiscord<shadow.> lmfao
02:38:35FromDiscord<ElegantBeef> i just do it cause of the way i work
02:38:38FromDiscord<shadow.> fair
02:38:40FromDiscord<shadow.> i love my scientific terms
02:38:45FromDiscord<shadow.> "yeeted out the end"
02:39:33*qwertfisch quit (Ping timeout: 272 seconds)
02:39:58FromDiscord<ElegantBeef> Also if you havent noticed in hex `f` means that nibble is full of 1s
02:40:17FromDiscord<ElegantBeef> hence 15 πŸ˜„
02:40:28FromDiscord<sealmove> bits are confusing. in parsing the "first" bit is (usually) the leftmost, but when we refer to them as imaginary indices, we count from right to left (probably because of our number system as ElegantBeef said).
02:40:34FromDiscord<shadow.> yeah
02:40:51FromDiscord<shadow.> like if you "get the nth bit" bit 0 is typically the rightmost one on little ended processors right?
02:41:14FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Jl4
02:41:22FromDiscord<shadow.> lol
02:41:27FromDiscord<sealmove> shadow, bit endianness has nothing to do with processors
02:41:37FromDiscord<shadow.> oh lol
02:41:42FromDiscord<sealmove> processors only know about byte endianness
02:41:43FromDiscord<shadow.> what's it determined by?
02:41:43FromDiscord<ElegantBeef> I guess yea parsing the bits are typically considered in a left to right manner due to how our language is left to right
02:41:47FromDiscord<shadow.> ohhh
02:41:59FromDiscord<sealmove> it's just terminology, used differently depending on context
02:42:03FromDiscord<shadow.> fair enough
02:44:13FromDiscord<sealmove> not just that, when we say for example "next 14 bits", we want to think of them as continues
02:45:15FromDiscord<sealmove> with little bit endianness we would parse like this:↡8 7 6 5 4 3 2 1 - - 14 13 12 11 10 9
02:45:38FromDiscord<sealmove> while with big endianness:↡1 2 3 4 5 6 7 8 9 10 11 12 13 14
02:45:51FromDiscord<ElegantBeef> and with end endianess↡0
02:48:44*a_chou joined #nim
02:49:55FromDiscord<shadow.> lol
02:58:43*qwertfisch joined #nim
03:00:35FromDiscord<shadow.> from now on instead of `x = 0` im just doing `x = x shr 64`
03:00:54FromDiscord<shadow.> lmao
03:02:02FromDiscord<Rika> what
03:03:47*beatmox quit (Ping timeout: 260 seconds)
03:06:06*beatmox joined #nim
03:06:14FromDiscord<ElegantBeef> `int.high.div 0` is the better way
03:06:26FromDiscord<sealmove> why not `x = x xor x` :P
03:07:01FromDiscord<sealmove> "the classic way"
03:10:50*beatmox quit (Ping timeout: 264 seconds)
03:11:31*beatmox joined #nim
03:11:36FromDiscord<Rika> int.high.div (x (x - x)
03:11:48FromDiscord<Rika> )
03:11:51FromDiscord<Rika> left a parens
03:14:42FromDiscord<shadow.> wait that xor is smart lol
03:17:05FromDiscord<Rika> please dont do that
03:18:30FromDiscord<shadow.> its a joke
03:18:35FromDiscord<shadow.> i am being sarcastic lmao
03:19:33FromDiscord<shadow.> why not do `x = cast[array[1, int]]((x shl 64) xor (x shl 64))[0]`
03:19:47FromDiscord<shadow.> (edit) "shl" => "shr" | "shl" => "shr"
03:22:25FromDiscord<Rika> cast[int](nil)
03:22:35FromDiscord<Rika> (i do not actually know what this does...)
03:22:52FromDiscord<Rika> !eval echo cast[int](nil)
03:22:55NimBot0
03:22:59FromDiscord<Rika> lol
03:23:57PrestigeI guess it assumes the default int value if given invalid input?
03:24:22Prestige!eval echo cast[string](nil)
03:24:25NimBot<no output>
03:24:33PrestigeEmpty string
03:25:25FromDiscord<Quibono> sent a code paste, see https://play.nim-lang.org/#ix=2Jle
03:26:10FromDiscord<Rika> needs more data, that doesnt give much info
03:26:57FromDiscord<Quibono> sent a code paste, see https://play.nim-lang.org/#ix=2Jlf
03:27:28FromDiscord<Rika> cannot await outside of an async proc
03:27:34FromDiscord<Quibono> aaaaaaah
03:27:38FromDiscord<Quibono> Right
03:27:38FromDiscord<Rika> use waitfor instead if you need to do so
03:29:54FromDiscord<Quibono> Thank you. Async always messes me up
03:31:14*beatmox quit (Ping timeout: 264 seconds)
03:32:04FromDiscord<Rika> takes a while to get used to it
03:38:38*qwertfisch quit (Ping timeout: 258 seconds)
03:41:57*qwertfisch joined #nim
03:53:52voltistWhat's the best way to get the size (in bits) of the int type?
03:54:31FromDiscord<Rika> sizeof(int) 8
03:54:33FromDiscord<Rika> ?
03:56:22FromDiscord<Rika> voltist do you mean size consumed by the int or min size needed for the number to be represented properly
03:57:02*muffindrake quit (Ping timeout: 258 seconds)
03:59:23*muffindrake joined #nim
04:00:45voltistMean size yeah
04:00:52voltistSo sizeof should do it, right?
04:01:02FromDiscord<ElegantBeef> It returns byte size
04:01:21voltistx8 :)
04:01:34FromDiscord<Rika> yup thats what i said
04:02:34voltist`*8`? Interesting it didn't render like that on my IRC client
04:03:19voltistThanks for the help
04:03:27*beatmox joined #nim
04:03:50FromDiscord<shadow.> yeah asterisks get murdered along the dangerous irc bridge
04:04:29*rockcavera quit (Remote host closed the connection)
04:05:03*qwertfisch quit (Ping timeout: 272 seconds)
04:07:41FromDiscord<Rika> lmao
04:07:45FromDiscord<Rika> yardanicooooooooooooooo
04:07:49FromDiscord<Rika> fix thy bridge
04:08:26*beatmox quit (Ping timeout: 264 seconds)
04:23:46disruptekit's pointless to ask.
04:24:05FromDiscord<Rika> i know 😦
04:26:03disruptekyou should take it over.
04:29:20voltistAnyone want to judge my bloom filter implementation?
04:29:21voltisthttps://play.nim-lang.org/#ix=2Jlu
04:30:46PrestigeIs the bridge open source?
04:32:59FromDiscord<ElegantBeef> !repo ircord
04:33:00disbothttps://github.com/Yardanico/ircord -- 9ircord: 11Discord <-> IRC bridge in Nim 15 12⭐ 2🍴
04:34:18*narimiran_ joined #nim
04:36:17FromDiscord<Rika> i would if i had my programming keyboard, im suffering without it
04:47:05FromDiscord<ElegantBeef> Is your programming keyboard a powerglove modified to be a keyboard?
04:50:39*spiderstew_ quit (Ping timeout: 272 seconds)
04:51:03*spiderstew joined #nim
04:55:48*a_chou quit (Quit: a_chou)
05:03:36FromDiscord<Rika> lol
05:03:49*Tanger quit (Remote host closed the connection)
05:15:49Prestigehaving to use a laptop or something?
05:18:47*not_lum joined #nim
05:20:02*bozaloshtsh quit (Ping timeout: 260 seconds)
05:20:02*sirn quit (Ping timeout: 260 seconds)
05:20:12*bozaloshtsh joined #nim
05:20:12*bozaloshtsh quit (Changing host)
05:20:12*bozaloshtsh joined #nim
05:20:37*l1x quit (Ping timeout: 260 seconds)
05:20:37*hpyc9 quit (Ping timeout: 260 seconds)
05:20:52*hpyc9 joined #nim
05:22:05*sirn joined #nim
05:22:22*lum quit (Ping timeout: 260 seconds)
05:23:17*l1x joined #nim
05:23:42*qwertfisch joined #nim
05:26:17FromDiscord<Rika> yeah im on a laptop
05:36:44FromDiscord<ElegantBeef> Rika just be productive and add the import path to modules docgen πŸ˜„
05:51:53FromDiscord<Rika> lost me at import
05:53:40FromDiscord<ElegantBeef> lol
05:54:11FromDiscord<ElegantBeef> for all modules a `import std/with` for instance should be added to the docgen for using it
05:55:29FromDiscord<Rika> did i suddenly regress in english comprehension skills or is that sentence incomprehensible
05:57:10FromDiscord<shadow.> ditto
06:00:49FromDiscord<ElegantBeef> Here we go for the third time destroying english. All docs generated for modules should have a import path(`import std/with` for the with module) added to the top of the file
06:02:56FromDiscord<Rika> full (aka std/ for all std modules and pkg/ for all third party)?
06:03:09FromDiscord<Rika> sounds difficult to implement
06:04:22FromDiscord<ElegantBeef> Yea
06:04:51FromDiscord<ElegantBeef> I briefly looked at docgen and went "hmmm, i dont see anything making sense here"
06:05:18FromDiscord<Rika> then no thanks
06:06:13FromDiscord<ElegantBeef> Yea i'll probably look at it after my colourise gets accepted
06:45:08FromDiscord<Cohjellah> Hey guys, why does asyncnet require the termination of mesages through .send to end with \c\l
06:45:16FromDiscord<Cohjellah> doesn't make sense to me, can't find anything in the docs
06:46:53FromDiscord<Rika> \c\l == \r\n
06:50:43*beatmox joined #nim
06:56:24FromDiscord<Cohjellah> yeeep
06:56:29FromDiscord<Cohjellah> figured that out now ahaha.
07:16:52*fowl quit (Read error: Connection reset by peer)
07:17:08*kwilczynski quit (Read error: Connection reset by peer)
07:17:38*sirn quit (Read error: Connection reset by peer)
07:18:34*sirn joined #nim
07:18:58*kwilczynski joined #nim
07:19:04*saem quit (Remote host closed the connection)
07:20:07*fowl joined #nim
07:50:16FromDiscord<Cohjellah> Just have a problem surrounding a terminal chat app. When client A receives a message from client B, whilst client B is typing his own message, the echo on client B will print everything they're writing, as well as the new message
07:50:40FromDiscord<Cohjellah> So they'll have to rewrite there message, and it gets ugly
07:50:51FromDiscord<Cohjellah> Soz
07:50:53FromDiscord<Cohjellah> Other way around
07:51:00FromDiscord<Cohjellah> Client B receives message from client A
07:51:11FromDiscord<Cohjellah> (edit) "A" => "B" | "B," => "A,"
07:51:26FromDiscord<ElegantBeef> Store the currently written characters, clear the line, write the recieved characters then print the users input without a `\n` then carry on
07:53:19FromDiscord<Cohjellah> That's what I want to do
07:53:23FromDiscord<Cohjellah> But I'm not sure how
07:53:35FromDiscord<Cohjellah> Tried used readline but it wait for the user to press enter
07:53:48FromDiscord<Cohjellah> readAll didn't do anything
07:54:18FromDiscord<Cohjellah> Also not sure how to print the stored temp message back into the terminal enter spot... Whatever that's called
07:56:48FromDiscord<ElegantBeef> if you use `getCh` to get the current input you can add it to a buffer, then do all the logic i mentioned
07:56:52FromDiscord<ElegantBeef> No clue if there is a better way
07:59:58FromDiscord<ElegantBeef> Ah there is `eraseLine`
08:03:45FromDiscord<Cohjellah> GetCh hey?
08:03:46FromDiscord<Cohjellah> Okay
08:03:54FromDiscord<Cohjellah> How do I add that back to the input line?
08:04:24FromDiscord<ElegantBeef> you do `stdout.write(ch)` and store it into input
08:05:19FromDiscord<ElegantBeef> This isnt an amazing example but https://play.nim-lang.org/#ix=2Jna
08:08:56FromDiscord<Cohjellah> Hey, Thank you
08:09:00FromDiscord<Cohjellah> Wishing you a merry Christmas
08:10:08Zevvtoo soon
08:10:09Zevvtoo early
08:10:22FromDiscord<Rika> its literally christmas eve tho :ThonkDumb:
08:12:00FromDiscord<Cohjellah> Lmao too soon
08:12:34FromDiscord<ElegantBeef> But yea hopefully you understand that you'll need to use the ascii form of keyboard inputs for things like deleting and the like
08:12:59FromDiscord<ElegantBeef> And getch blocks, so... you need to implement your own quite for `3.char`
08:13:10FromDiscord<ElegantBeef> Well blocks the input from the terminal i mean
08:14:07FromDiscord<ElegantBeef> own quit
08:15:31*tane joined #nim
08:21:05FromDiscord<CodeHz> question:↡Is it possible to implement method in dynlib(so/dll), and call it in main application? I tried but seems the dynamic dispatching is not working
08:27:01FromDiscord<ElegantBeef> Are you making the dynlib aswell?
08:29:32*habamax joined #nim
08:34:01FromDiscord<CodeHz> Yes, I want to use dll as plugin
08:56:20FromDiscord<mratsim> Nim methods need to know all existing method for dynamic dispatch, so you can't add an override to methods exposed in a DLL.
08:56:40*hnOsmium0001 quit (Quit: Connection closed for inactivity)
08:56:53FromDiscord<mratsim> you need to have a base object with callbacks instead that you override. Aka, Do your Own Vtable.
08:58:10FromDiscord<mratsim> in general dynamic dispatch doesn't exist in C and a DLL requires a C compatible ABI.
09:01:01*fowl quit (Ping timeout: 268 seconds)
09:01:34*kwilczynski quit (Read error: Connection reset by peer)
09:01:54*sirn quit (Read error: Connection reset by peer)
09:02:56*fowl joined #nim
09:03:01*kwilczynski joined #nim
09:03:59*sirn joined #nim
09:09:17*sirn quit (Ping timeout: 260 seconds)
09:11:02FromDiscord<Cohjellah> Uhh so yeah confused by getch because it gets a single character? Why does it block?
09:11:06FromDiscord<Cohjellah> 3.char?
09:15:41FromDiscord<ElegantBeef> it doesnt block, it doesnt give the terminal the characters
09:15:51FromDiscord<ElegantBeef> `3.char` is `ctrl + c`
09:16:28FromDiscord<ElegantBeef> If you want to see all ascii chars and their shortcut https://theasciicode.com.ar/ascii-control-characters/backspace-ascii-code-8.html
09:19:41*klaufir_ joined #nim
09:20:01*tane quit (Quit: Leaving)
09:20:53*sirn joined #nim
09:23:55*Tanger joined #nim
09:25:01FromDiscord<ElegantBeef> @Cohjellah https://play.nim-lang.org/#ix=2Jnv here is a more complete example
09:25:39FromDiscord<Cohjellah> Ok I'll have a play around and see what's up
09:25:41FromDiscord<Cohjellah> Cheers!
09:30:49*habamax quit (Ping timeout: 246 seconds)
09:32:27FromDiscord<Cohjellah> So, if a message is received, can I loop to get all the getch characters?
09:32:33FromDiscord<Cohjellah> How does it actually work
09:32:56FromDiscord<Cohjellah> Looking at the example I'm a bit confused
09:33:01FromDiscord<ElegantBeef> So the whole while loop would be the client
09:33:13FromDiscord<ElegantBeef> when you type a `c` it's like getting a message
09:33:38FromDiscord<ElegantBeef> So when you pull your socket you'd call onrecieved if you get a message and pass it that string
09:33:44FromDiscord<ElegantBeef> (edit) "pull" => "poll"
09:35:08FromDiscord<Cohjellah> I see. You are making this more complex than I was thinking but it's good to know all these extra commands and cases
09:35:16FromDiscord<Cohjellah> Just in case I want it to be fancy
09:35:53FromDiscord<ElegantBeef> It's gotta be a tad bit more complex
09:36:54FromDiscord<Cohjellah> Hahaha not at this point. I literally just want to read what's typed in the input line
09:37:24FromDiscord<Cohjellah> That's all. Do I have to change my main loop to store each character that is typed?
09:37:42*Arrrrrrrr joined #nim
09:37:43FromDiscord<Cohjellah> Surely there's an easy way to just get all the characters on the input line
09:38:07FromDiscord<Cohjellah> (edit) "easy" => "easier"
09:38:57FromDiscord<ElegantBeef> You might be able to find the last line of characters
09:39:51FromDiscord<Cohjellah> Oh so will I have to print what is written to the terminal, read that line, delete it and then re add it to the input line?
09:41:23FromDiscord<Cohjellah> HMMM
09:46:25FromDiscord<ElegantBeef> You might be able to read the stdout, but i'm uncertain if it'd be possible considering there isnt an end of line char afaik
09:49:16FromDiscord<Cohjellah> How is a new line created then?
09:49:27FromDiscord<Cohjellah> There's no \n at the end of each terminal line?
09:54:06FromDiscord<ElegantBeef> Not a clue πŸ˜„
10:09:24*superbia joined #nim
10:12:00FromDiscord<CodeHz> Oh, that's sounds reasonable, so I'm going to create a nimble package for create rust-style trait and impl for my purpose...
10:14:59FromDiscord<ElegantBeef> Is that... sarcasm? πŸ˜„
10:21:20FromDiscord<haxscramper> !repo nimtraits
10:21:20disbothttps://github.com/haxscramper/nimtraits -- 9nimtraits: 11Automatic trait implementation for nim types 15 4⭐ 0🍴
10:21:47FromDiscord<haxscramper> The idea was absolutely pointless, but API for implementing custom traits is here
10:21:59FromDiscord<haxscramper> Wrote it
10:22:00FromDiscord<haxscramper> never used
10:22:03FromDiscord<haxscramper> Never needed to
10:22:26FromDiscord<CodeHz> (I mean dyn trait ( generate vtable in callsite
10:23:12FromDiscord<haxscramper> Well, that is what this library is supposed to be used - more convenient API for custom trait implementation
10:24:02FromDiscord<haxscramper> Though if you need single vtable trait it would be easier to just implement it manually, yes
10:24:38FromDiscord<haxscramper> https://github.com/haxscramper/hax-nim/tree/master/wraptests/callback_override and this one might be interesting if you need to override implementation of things in DLL - quite hacky, but should work
10:24:41FromDiscord<haxscramper> In theory
10:27:13FromDiscord<CodeHz> (Oh, I'm not going to compatible with c++ vtable, just pure nim
10:30:40*narimiran_ is now known as narimiran
10:30:49FromDiscord<CodeHz> so the basic idea is create two macro to generate left side code, it seems not to hard https://media.discordapp.net/attachments/371759389889003532/791613846745251840/unknown.png
10:34:30FromDiscord<CodeHz> BTW, will the `=destrory` be called if it defined in the dynlib (wrapped as `ref RootObj`) ?
10:35:25*krux02 joined #nim
10:56:44FromDiscord<mratsim> good question for an `object`, a `ref RootObj` cannot have a destructor unless they are now syntax sugar for finalizers?
10:57:21FromDiscord<mratsim> that's the longterm plan but I don't remember if =destroy is equivalent to a finalizer already
10:58:28FromDiscord<CodeHz> oh, it will call destructor https://media.discordapp.net/attachments/371759389889003532/791620800897482762/unknown.png
10:58:32FromDiscord<CodeHz> but crashed
10:59:32FromDiscord<CodeHz> https://gist.github.com/codehz/18dfd092a5f318bbf13472f046da6661
10:59:59FromDiscord<CodeHz> (edit) "https://gist.github.com/codehz/18dfd092a5f318bbf13472f046da6661 ... " added " If it got confirm, I will create a bug report ("
11:00:06FromDiscord<CodeHz> (edit) "confirm," => "confirmed,"
11:05:26FromDiscord<CodeHz> ps: also crash if X contains another ref object like string
11:05:59FromDiscord<CodeHz> (edit) "ps: also crash ... ifno" added "even" | "X contains another ref object like string" => "no `=destroy` defined"
11:12:18FromDiscord<CodeHz> (edit) so the basic idea is create two macro to generate left side code, it seems not too hard https://media.discordapp.net/attachments/371759389889003532/791613846745251840/unknown.png
11:31:29FromDiscord<Recruit_main707> I’m not sure, but you might be mixing vars and refs, try making your destroy proc argument a var ref X instead
11:36:36FromDiscord<Recruit_main707> And also make your create function return X, and define it in the other file
11:38:29FromDiscord<Recruit_main707> It’s also weird that it prints destroy, since the function is not exported nor imported
11:42:53FromDiscord<CodeHz> sent a code paste, see https://play.nim-lang.org/#ix=2Jo0
11:43:05FromDiscord<CodeHz> (compiling with --gc:arc
11:43:31FromDiscord<CodeHz> I think the problem is they use different heap for allocate..
11:43:44FromDiscord<CodeHz> (edit) "allocate.." => "allocate and deallocate.."
11:44:05FromDiscord<Recruit_main707> iirc arc has a shared heap
11:44:24FromDiscord<CodeHz> but they don't shared across dll
11:44:45*habamax joined #nim
11:44:46FromDiscord<CodeHz> (and nimrtl doesn't work for arc/orc
11:47:42*rockcavera joined #nim
11:47:56FromDiscord<CodeHz> if -d:useNimRtl https://media.discordapp.net/attachments/371759389889003532/791633249507999764/unknown.png
11:49:28FromDiscord<mratsim> report it
11:51:11FromDiscord<CodeHz> I'm going to repro it with devel branch
11:52:57FromDiscord<sealmove> sent a code paste, see https://play.nim-lang.org/#ix=2Jo4
11:53:38FromDiscord<sealmove> Is `=>` used in some languages for pattern matching? I think I've seen it.
11:53:53FromDiscord<CodeHz> (I prefer `of`
11:55:02FromDiscord<sealmove> sent a code paste, see https://play.nim-lang.org/#ix=2Jo5
11:56:37FromDiscord<sealmove> I am asking what `->` and `=>` do in languages so I can pick the most natural one
11:58:51FromDiscord<CodeHz> wait, what is ParserName
11:59:13FromDiscord<CodeHz> (edit) sent a code paste, see https://play.nim-lang.org/#ix=2Jo0
11:59:33FromDiscord<CodeHz> (edit) (compiling with --gc:arc without -d:useMalloc
11:59:45FromDiscord<CodeHz> a type?
12:00:18FromDiscord<sealmove> not exactly, it's a tuple of 2 procs, but in the macro I use it to get to a type
12:00:34FromDiscord<CodeHz> I think fieldName should be placed in left side of `:` ...
12:01:07FromDiscord<sealmove> yes I see why you would say so, but my whole DSL does it the other way
12:01:18FromDiscord<CodeHz> ok
12:03:45FromDiscord<Vindaar> for the "braces are superior" crowd: Just read about this bug in the C++ code base of some colleagues 🀣 https://i.imgur.com/AuyqGbw.png
12:11:42FromDiscord<exelotl> lol
12:12:17FromDiscord<mratsim> @zevv https://media.discordapp.net/attachments/371759389889003532/791639377842929664/unknown.png
12:12:30FromDiscord<mratsim> https://www.youtube.com/watch?v=YrrUCSi72E8&lc=UgzbMFTogM9PZRbU7xF4AaABAg
12:21:00FromDiscord<mratsim> and @dom96 and disruptek ^, still watching but it starts like it could be madnatory to watch the first few minutes to understand the RFC
12:39:56*Arrrrrrrr quit (Ping timeout: 256 seconds)
12:48:33ForumUpdaterBotNew thread by Sdmcallister: Is anyone using duckdb with Nim?, see https://forum.nim-lang.org/t/7285
12:50:33*Arrrrrrrr joined #nim
13:22:37FromDiscord<whisperdev> Where can I test regexes for Nim regex implementation?
13:26:07FromDiscord<exelotl> @whisperdev looks like nim-regex is available in the playground
13:28:42*superbia quit (Quit: WeeChat 3.0)
13:29:44FromDiscord<dom96> Lots of interesting discussions here https://news.ycombinator.com/item?id=25520353
13:31:03FromDiscord<dom96> Including the assertion that tokio is slow at multi threading. So it’s being used in single threaded workloads specifically
13:34:02FromDiscord<whisperdev> i was thinking about online tester. https://play.nim-lang.org/#ix=2JoD
13:34:17FromDiscord<whisperdev> Should not this capture everything after !v_ ?
13:34:37*dilawar_uchiha[m joined #nim
13:34:56FromDiscord<Rika> Aren't you looking for match and not split
13:36:39FromDiscord<whisperdev> No split
13:40:37ForumUpdaterBotNew thread by 19: Nim Seqs to C backend, see https://forum.nim-lang.org/t/7286
13:43:59*NimBot joined #nim
13:45:56FromGitter<gogolxdong> Is there any alternative to Channel of Nim?
13:53:28Q-MasterHi all. I've got a question: I see that the default async implementation has futures not cancelable. So if i fail or complete any future the underlying proc will be kept on eventloop and complete to work. https://play.nim-lang.org/#ix=2Jof
13:53:34Q-MasterIs this normal?
13:56:13FromGitter<gogolxdong> How about async pipe of chronos?
14:27:48FromDiscord<Deleted User 5bd78114> Heya everyone! I'm wonderinv if.i should write a small wrapper around a Nim YAML parser to use in Python, is that a good idea or should i just stick to using Python's normal YAML parser? I was thinking of implementing some C functions with Nim anyway
14:47:19mipriin general, Nim's fine for making little shared objects for other languages to load through C FFI, especially with the non-GC options.
14:47:34miprifor Python specifically, 'nimpy' might be useful.
14:48:06FromDiscord<Deleted User 5bd78114> Yeah that's what i thought
14:48:31FromDiscord<Deleted User 5bd78114> But if i used Nimpy with the ARC gc? Would anything happen?
14:51:46leorizenothing bad should happen
14:52:31leorizesince python's memory and Nim's memory is not directly shared (as in Python don't control Nim's (de)allocation), any gc would work
14:53:11FromDiscord<Deleted User 5bd78114> Thanks!
14:57:35*abm joined #nim
15:04:39FromDiscord<Recruit_main707> I’m not sure if nimpy supports arc yet
15:04:45ForumUpdaterBotNew thread by QMaster: Cancelation points in async, see https://forum.nim-lang.org/t/7287
15:06:01*ex_nihilo quit (Quit: Leaving)
15:15:10FromDiscord<Quibono> Great way to find out
15:28:55*Vladar joined #nim
15:34:50ForumUpdaterBotNew thread by Archnim: ToBin, see https://forum.nim-lang.org/t/7288
15:38:11FromDiscord<CodeHz> so https://github.com/codehz/nim-vtable
15:39:38FromDiscord<Recruit_main707> Looks great
15:41:22FromDiscord<krisppurg> is there a way to set proc aliases?
15:44:49FromDiscord<haxscramper> `let aliased = yourProc` or `const aliased = yourProc`
15:45:25FromDiscord<haxscramper> `yourProc` should not be overloaded though, maybe there is an alternative that doesn't suffer from this limitation
16:04:52*muffindrake quit (Ping timeout: 260 seconds)
16:05:03*leorize quit (Ping timeout: 240 seconds)
16:06:37*muffindrake joined #nim
16:07:16*leorize joined #nim
16:11:54FromDiscord<krisppurg> I don't know if I'm either having a mandela effect, but I swore there was an alias pragma
16:21:19FromDiscord<shadow.> if you need it overloaded maybe just template it
16:26:52*narimiran quit (Ping timeout: 268 seconds)
16:28:08*abm quit (Quit: Leaving)
16:30:17ForumUpdaterBotNew question by SyTax: I installed Nim without any problem, but it gives me this error, what should I do?, see https://stackoverflow.com/questions/65440902/i-installed-nim-without-any-problem-but-it-gives-me-this-error-what-should-i-d
16:46:53FromDiscord<CosmicLivest> because in the nim compiler it tells me that the permission is denied.
16:50:16*xet7 quit (Quit: Leaving)
16:55:10*xet7 joined #nim
17:10:16*letto quit (Ping timeout: 240 seconds)
17:10:27*letto joined #nim
17:18:51disruptekdom96: recent tokio is much faster.
17:27:01*natrys joined #nim
17:39:55*a_chou joined #nim
18:05:36*habamax quit (Ping timeout: 272 seconds)
18:22:27*lf_ joined #nim
18:22:50FromDiscord<PizzaFox> hello
18:22:54FromDiscord<PizzaFox> i am here to complain about nim js generation again
18:23:18FromDiscord<PizzaFox> sent a code paste, see https://play.nim-lang.org/#ix=2Jqc
18:23:20FromDiscord<PizzaFox> note the `new Array(ln)`
18:23:34FromDiscord<PizzaFox> this creates a holey array, which the v8 engine is very very bad at dealing with efficiently
18:28:38*lf_ quit (Remote host closed the connection)
18:32:15disruptekwhat do you propose?
18:32:50disruptekalso, where can we read about holey arrays?
18:33:49disruptek!repo nodejs
18:33:50disbothttps://github.com/juancarlospaco/nodejs -- 9nodejs: 11NodeJS Standard Library for Nim 15 39⭐ 1🍴 7& 4 more...
18:33:55disruptekmay be of interest to you.
18:36:47FromDiscord<PizzaFox> i am making a pr to fix that one instance
18:37:19*a_chou quit (Quit: a_chou)
18:43:25FromDiscord<shadow.> how do you accomplish complex numbers in nim
18:43:41FromDiscord<shadow.> kind of like python's j
18:43:53FromDiscord<PizzaFox> https://github.com/nim-lang/Nim/pull/16461
18:43:54disbotβž₯ Avoid creating a holey array in makeNimstrLit for JS target
18:44:01FromDiscord<PizzaFox> https://nim-lang.org/docs/complex.html
18:44:14FromDiscord<shadow.> thank you
18:48:17disruptekpizzafox: do you have a link to some holey array info?
18:48:47FromDiscord<PizzaFox> there's a link to v8 in there
18:48:48FromDiscord<PizzaFox> 1 sec
18:48:59FromDiscord<PizzaFox> https://v8.dev/blog/elements-kinds#packed-vs.-holey-kinds↡> V8 makes this distinction because operations on packed arrays can be optimized more aggressively than operations on holey arrays. For packed arrays, most operations can be performed efficiently. In comparison, operations on holey arrays require additional checks and expensive lookups on the prototype chain.
18:49:21FromDiscord<shadow.> is there an easier way to "toggle" an item in a set other than `if n in s: s.excl n else: s.incl n`
19:00:11*hnOsmium0001 joined #nim
19:00:55FromDiscord<shadow.> also, for anyone doing aoc this is a good read
19:00:56FromDiscord<shadow.> https://www.redblobgames.com/grids/hexagons/
19:01:54ArrrrrrrrMaybe cast it to int (or whatever) and neg it
19:02:08FromDiscord<shadow.> wdym?
19:02:31FromDiscord<shadow.> wdym neg it lol
19:02:51*leorize quit (Remote host closed the connection)
19:03:26Arrrrrrrrcast[set[whatever]](not(cast[byte](mySet))) in case it is 1 byte sized
19:03:27*leorize joined #nim
19:03:58FromDiscord<sealmove> nimx vs fidget?
19:05:30*rockcavera quit (Remote host closed the connection)
19:16:00disruptekfidget
19:16:26FromDiscord<shadow.> hmm
19:16:30FromDiscord<shadow.> this is with a hashset
19:16:33FromDiscord<shadow.> nvm its fine
19:17:18Zevvinteresting that there have not been any "hard" problems on aoc this year
19:17:21ArrrrrrrrOh, for some reason I thought you wanted to flip completely a set
19:17:26Zevvsome were tedious, some needed some insight
19:17:54Zevvbut not like the one with finding the closest 2 starts in a 3D space
19:18:39disruptekpizzafox: if i'm reading this correctly, this is not a holey array.
19:19:03FromDiscord<PizzaFox> explain
19:19:09disruptekwe create a new array of the given length. is it not initialized with values?
19:19:24FromDiscord<PizzaFox> no
19:19:26FromDiscord<PizzaFox> its filled with
19:19:36FromDiscord<PizzaFox> empty items
19:19:38FromDiscord<PizzaFox> not undefine
19:19:39FromDiscord<PizzaFox> (edit) "undefine" => "undefined"
19:19:41FromDiscord<PizzaFox> e m p t y
19:19:49disruptekokay, you're right, then.
19:19:59FromDiscord<PizzaFox> sent a code paste, see https://play.nim-lang.org/#ix=2Jqm
19:20:26disruptekyeah; i never write raw js anymore. 😁
19:20:55FromDiscord<shadow.> yeahh
19:20:59FromDiscord<shadow.> today's was really easy for part one actually
19:21:01FromDiscord<shadow.> and part two seems doable
19:21:13FromDiscord<shadow.> zevv: does part two start with the flips from part one?
19:21:17FromDiscord<shadow.> or am i being dumb
19:21:57Zevvyeah, it's just life on a hex grid
19:22:13Zevvand if you choose your coordinate system wisely, it's pretty straightforward
19:22:14FromDiscord<shadow.> fair enough
19:22:16FromDiscord<shadow.> i mean
19:22:22FromDiscord<shadow.> i used the doubles horizontal system
19:22:25Zevvhttps://www.redblobgames.com/grids/hexagons/
19:22:28FromDiscord<shadow.> yup
19:22:40FromDiscord<shadow.> sent a long message, see http://ix.io/2Jqn
19:22:47ZevvI happened to know the trick; did the cube coords
19:22:53Zevvmakes it pretty trivial
19:22:54FromDiscord<shadow.> does the doubles not work for part two?
19:23:01FromDiscord<shadow.> bc it worked for part one fine
19:23:10Zevvsure it does
19:23:12FromDiscord<shadow.> kk
19:23:14FromDiscord<shadow.> then my logic is just bad
19:23:35Zevvbut the life game exceeds the original tiles, your floor is infinite
19:23:49Zevvso you need to iterate all of your current board, plus some
19:24:00FromDiscord<shadow.> yep
19:24:02FromDiscord<shadow.> im just iterating like
19:24:08FromDiscord<shadow.> x -100..100 and y -100..100
19:24:15FromDiscord<shadow.> i tried expanding it more and same answer so i assumed it worked
19:24:15FromDiscord<shadow.> LMAO
19:24:17FromDiscord<shadow.> https://play.nim-lang.org/#ix=2Jqo
19:24:27FromDiscord<shadow.> so something other than my tile flipping and grid size
19:29:19FromDiscord<ElegantBeef> Psh shadow using a table for a LUT πŸ˜› https://play.nim-lang.org/#ix=2Jqp
19:30:25FromDiscord<shadow.> i needa index by string tho dont i?
19:30:31FromDiscord<ElegantBeef> Why?
19:30:34FromDiscord<shadow.> bc im parsing
19:30:38FromDiscord<ElegantBeef> `parseEnum`
19:30:41FromDiscord<shadow.> well
19:30:43FromDiscord<shadow.> whats wrong w using a table
19:30:46FromDiscord<shadow.> lol
19:30:59FromDiscord<ElegantBeef> Nothing aside from it's slower πŸ˜„
19:31:47FromDiscord<shadow.> fair enough
19:32:02FromDiscord<shadow.> ill figure out why part two isnt working then i can do it lol
19:32:11FromDiscord<ElegantBeef> I never deal with strings
19:32:15FromDiscord<ElegantBeef> Too ugly πŸ˜„
19:32:59*blueberrypie quit (Quit: Ping timeout (120 seconds))
19:33:14FromDiscord<shadow.> fair enough
19:33:18*blueberrypie joined #nim
19:38:20disruptekthat's how i feel about blondes.
19:38:46Arrrrrrrrheh
19:40:16FromDiscord<ElegantBeef> When i said that and there wasnt an instant comment i figured you werent around
19:42:26disrupteki'm not as rotund as yourself, but that doesn't mean i'm not waiting to pounce on the subtlest double-entendre.
19:43:00disruptekmy bandwidth is devoted to git right now.
19:43:53FromDiscord<shadow.> figured out my issue
19:43:58FromDiscord<shadow.> i did {2..6} instead of {3..6}
19:44:01FromDiscord<shadow.> one of my many issues
19:44:05FromDiscord<ElegantBeef> inclusive ranges
19:44:12FromDiscord<shadow.> yep
19:44:14FromDiscord<shadow.> well no
19:44:19FromDiscord<shadow.> just me being dumb
19:44:25FromDiscord<shadow.> bc every range is bottom inclusive
19:44:26FromDiscord<shadow.> even non-nim
19:44:47FromDiscord<ElegantBeef> I've never used ranges outside nim, so sure
19:44:54FromDiscord<notchris> merry xmas eve all
19:45:02FromDiscord<ElegantBeef> Hello totally not chris
19:45:24FromDiscord<notchris> heyyyo the most elegant of beefs
19:46:44FromDiscord<shadow.> fuck it works on the test input but not on my input
19:46:50FromDiscord<shadow.> this means my world is over
19:49:05FromDiscord<notchris> @shadow. it ended a long time ago
19:49:10FromDiscord<notchris> welcome to dystopia
19:49:48FromDiscord<shadow.> ah i fixed it
19:49:53FromDiscord<shadow.> it was bc my check range was too low
19:49:56FromDiscord<notchris> glad i could help
19:51:10FromDiscord<shadow.> ty ty
19:52:18FromDiscord<notchris> @shadow. i was just near buckland
19:52:26FromDiscord<notchris> waited 30min in traffic
19:53:15FromDiscord<shadow.> lol rip
19:53:35FromDiscord<notchris> i bet west farms is worse tbh
19:54:40FromDiscord<shadow.> i go to west farms often
19:54:43FromDiscord<shadow.> big traffic
19:54:43FromDiscord<shadow.> lmao
19:54:56FromDiscord<notchris> ur stompin grounds
19:55:02FromDiscord<shadow.> periodt
19:59:35FromDiscord<SirJosh> does anybody know of the performance of `nlvm` (<https://github.com/arnetheduck/nlvm>) versus the C backend nim uses?
20:00:24FromDiscord<ElegantBeef> I assume it's similar to what you can get with the C backend and the right optimisation flags
20:01:27FromDiscord<notchris> t minus 5 min till my doordash arrives
20:01:28FromDiscord<notchris> yass
20:09:47FromGitter<ynfle> Why doesn't `1` get translated in to a `Natural` automatically here? https://play.nim-lang.org/#ix=2Jqy
20:11:57mipriyou mean, why doesn't it do that when the type of S.list is seq[Natural]?
20:12:31FromGitter<ynfle> No it's the index
20:14:59Zevvshadow.: You found your problem then?
20:17:18*narimiran joined #nim
20:19:33FromDiscord<mratsim> @Zevv I found your talk for Fosdem: https://www.youtube.com/watch?v=YrrUCSi72E8
20:19:49ZevvGo away
20:19:50ZevvI don't talk
20:19:56ZevvI don't understand any of that stuff
20:19:58FromDiscord<mratsim> I think this should be mandatory explainer for everyone confused about CPS
20:20:10ZevvIt's pretty good indeed
20:20:23Zevvi skimmed it today
20:20:31FromDiscord<mratsim> They use state machine instead of splitting into functions
20:20:43ZevvI'll allow it
20:20:54Zevvdisruptek and me had a good talk the other day
20:20:57FromDiscord<mratsim> Also I tried to look under the cover of disruptek repo but none of the CPS exampel compile, even the one he gave in the RFC
20:21:04Zevvabout the "where does the environment go" issue
20:21:23Zevvdisrupteks repo works for the 0.0.13
20:21:27Zevvyou can run the stash/ examples
20:21:45Zevvthat repo is wild, it's a perpetual state of chaos
20:22:21FromDiscord<mratsim> For me environment does into an object, since we know it's max size at compile-time
20:22:43FromDiscord<mratsim> then the rules:↡- if there are ref/seq/string, it's a ref object
20:22:56FromDiscord<mratsim> -if there is a destructor, for now it's a ref object as well
20:23:19Zevvbut if it's not a ref, we can't use inheritence like we do now
20:23:29FromDiscord<mratsim> -if it's just say number, we put a note "TODO: put that on the stack once Araq gets heap allocation elision sorted"
20:23:32Zevvso there's no common convertible type that can be passed around in the trampolines or schedulers
20:23:46FromDiscord<mratsim> Yes so that's what I wanted to look into
20:23:53FromDiscord<mratsim> how you use inheritance.
20:23:57Zevvok.
20:24:05Zevvlike I said, the 0.0.13 actually works
20:24:08Zevvwith stash/
20:24:16Zevvthen look at a relative simple one like iterator.nim
20:24:21FromDiscord<mratsim> yes
20:24:29FromDiscord<mratsim> all of disruptek example are about eventqueue :/
20:24:41Zevvthat guy is such a jerk
20:24:46Zevvhe really doesn't get it
20:25:27ForumUpdaterBotNew thread by Adnan: Is it possible to generate a list of all transient dependencies and their sources?, see https://forum.nim-lang.org/t/7290
20:25:30FromDiscord<mratsim> Also for conversion I'm not too worried, asyncdispatch, channel, weave are all typed outside, type-erased inside, as long as the external object/handle retains the type we should be good.
20:25:45FromDiscord<mratsim> anyway, gotta go check my foie gras
20:26:17Zevvthe problem is that if we go pointer, how will we leverage normal GCing of the original refs
20:26:35Zevvbut sure, foie gras goes firs, everybody knows that
20:27:05FromDiscord<mratsim> if ref, we don't go pointer
20:27:13Zevvright
20:27:14FromDiscord<mratsim> if not ref we can go union: https://github.com/mratsim/chirp8/blob/master/src/cpu.nim#L18-L23
20:27:25Zevvso I think disruptek and me kind of decided that if you would go pointer, you'd lose us
20:27:28Zevvso this is good, right :)
20:27:45FromDiscord<mratsim> πŸ™‚
20:27:46Zevvbecasue this stuff should be /totally/ frictionless on the user
20:27:59Zevvwe can't have users go casting their stuff like in weave
20:28:02Zevvthat will just not fly
20:28:20FromDiscord<mratsim> users don't cast in Weave
20:28:51*letto_ joined #nim
20:28:59Zevvhttps://github.com/mratsim/weave#data-parallelism ?
20:29:04Zevvlet bufIn = cast[ptr UncheckedArray[float32]](input[0].unsafeAddr)
20:29:12*letto quit (Ping timeout: 256 seconds)
20:29:38FromDiscord<mratsim> well refc has heap local garbage management I can't do otherwise
20:29:44Zevvright
20:29:46FromDiscord<shadow.> yeah i found the problem
20:29:49FromDiscord<mratsim> arc is supposed to fix data
20:29:52FromDiscord<mratsim> that
20:29:56FromDiscord<shadow.> it was that i was checking x y -100..100
20:29:58FromDiscord<shadow.> -125..125 worked
20:30:04FromDiscord<shadow.> i know, i should check bounds but i like bodging
20:30:12FromDiscord<mratsim> wow when you replace that by data it's probably very serious
20:30:12Zevvmratsim: right - so that is why CPS was designed to go fully ARC from day 1
20:30:19Zevvshadow.: backfired on you, ha ha ha
20:30:32FromDiscord<mratsim> I think Weave kind of pushed arc :p
20:30:47Zevvthat's how it should go, right
20:31:01Zevvand CPS pushes fixing of async :)
20:31:31FromDiscord<mratsim> https://github.com/weavers-guild/weave-io/blob/master/design/design_1_coroutines.md#use-cases
20:32:02FromDiscord<mratsim> I have found some use cases where CPS and/or coroutines are awesome but heap alloc is extremely discouraged
20:32:18ZevvI bet.
20:32:26Zevvbut for practical reasons, that's /some/ use cases, right
20:32:45FromDiscord<mratsim> - kernel drivers (say wifi, bluetooth, ...) especially the one with sessions↡- crypto protocol with state machine like TLS handshake
20:33:18FromDiscord<mratsim> that's use case where you want high performance, very clear code and hopeful not a mess of a state machine and no alloc
20:33:34Zevvok, but I still have this hole in my brain
20:33:41FromDiscord<mratsim> https://media.discordapp.net/attachments/371759389889003532/791765560295686144/81551481-386e3680-9382-11ea-81f9-e0a7b55e62b4.png
20:33:50FromDiscord<shadow.> yeah it did backfire
20:33:52Zevvif not heap, then the alternative is a fix-size prereserved pool somewhere, right
20:33:53FromDiscord<mratsim> ^ like if someone need to impelment TLS
20:34:11Zevvmratsim: these kind of state machines is in my days job
20:34:21Zevvdaily
20:34:22Zevvjob
20:34:53FromDiscord<mratsim> it's type MyLocalObject = object; fn: ContinuationProc, buf: array[computedMaxEnvSize, byte]
20:35:25FromDiscord<mratsim> or the buf hides an union type that can be reinterpreted depending on the "stage" of the continuation we are
20:35:53FromDiscord<mratsim> https://github.com/disruptek/cps/blob/master/talk-talk/manual1.nim#L45-L63
20:35:57ZevvRight. So how can we make this a hibrid so that in the disruptek and zevv cases we just have the env a real nim memory managed object, and the mratsim case where you do your magic to alloc/pool/manage that yourself
20:36:16FromDiscord<mratsim> when supportsCopyMem(T)
20:36:45Zevvhmm
20:36:47FromDiscord<mratsim> https://github.com/mratsim/Arraymancer/blob/master/src/arraymancer/laser/tensor/datatypes.nim#L35-L42
20:37:04Zevvthat's pretty smart
20:42:27Zevvso the kotlin stuff is basically just what we do, except they split with a switch instead of creating "real" continuation functions.
20:43:03FromDiscord<mratsim> for the proper supports copymem we need this fix: https://github.com/nim-lang/Nim/issues/13193
20:43:05disbotβž₯ Type tyAnything can't be matched to proc argument of typedesc type ; snippet at 12https://play.nim-lang.org/#ix=2iWM
20:43:13ZevvTheir stuff looks simple, but that will quickly get hairy when as well you mix this with regular control flow
20:44:03FromDiscord<mratsim> One thing I'm curious about is about try/except. I've noted that C++ explicitly forbid to suspend in a try except block
20:44:24FromDiscord<mratsim> I think that's not a fundamental limitation but something to ease implementation though
20:44:25ZevvI think disruptek spent some time on that
20:44:57FromDiscord<mratsim> note that some of our async code is flaky because closure iterators have issues with try/finally
20:45:00ZevvI believe he handles that in the scheduler
20:45:12Zevvbut indeed, it's important
20:46:05FromDiscord<mratsim> does it require exceptions:goto?
20:46:16Zevvi don't know
20:46:51Zevvbecause there is no magic going on, any thrown exception will propagate to the trampoline or its caller
20:47:58Zevvkotlin is just nim
20:49:04FromDiscord<mratsim> yeah, I've hit a roadblock on the C++ like coroutine design, there is a polymorphic return type that either return a coroutine or a value ...
20:49:22FromDiscord<mratsim> possibly Rust stuff can help
20:50:02FromDiscord<mratsim> https://axelforsman.tk/2020/08/24/rust-style-futures-in-c.html
20:50:27FromDiscord<mratsim> but I'd like to deep dive into the continuation first
20:52:34FromDiscord<Quibono> Can you do an enum of function returns? like x = isGreen("Yellow")
20:53:02ZevvQuibono: rephrase that question
20:53:09FromDiscord<mratsim> I don't understnd. Ther eis nothing enumy here?
20:53:38FromDiscord<Quibono> I want to differentiate between message types quickly and cleanly by seeing if they contain certain text.
20:53:49FromDiscord<Quibono> So I can then do different things with them.
20:54:32FromDiscord<mratsim> use object variant?
20:54:38Zevvyes that's good, but what is your question
20:55:29FromDiscord<Quibono> My question is, I think a case statement would be best, but can I have an enum where each item is just the same function with a different argument? lol
20:55:56FromDiscord<mratsim> you can have an object variant of callbacks
20:56:21FromDiscord<mratsim> but yeah just write proc dispatch(x: string) = case x ...
20:56:59FromDiscord<mratsim> it really depends how often you will need to dispatch those. Without more code can't say
20:57:06FromDiscord<mratsim> write something that works first.
20:57:42FromDiscord<mratsim> btw @Zevv, any idea why I have an extra 0 here: https://play.nim-lang.org/#ix=2JqK I slept on it and I still don't understand.
20:58:11FromDiscord<mratsim> if it's a bug it seems like async framework may always add an extra iteration?
20:58:25*narimiran quit (Ping timeout: 240 seconds)
20:58:53Zevv"Note that system.finished is error prone to use because it only returns true one iteration after the iterator has finished:"
20:58:56Zevvsays the manual
20:59:05ZevvI tried doing things with iterators, but I find them just too funny
20:59:11FromDiscord<mratsim> omg!
20:59:56FromDiscord<mratsim> yeah but still, there is still my <= condition
21:00:02Zevviterators is what I started with at the beginning of this journey, but something is wrong with my brain, or with iterators
21:00:57FromDiscord<mratsim> ah I know why
21:01:04FromDiscord<mratsim> wow that's complex
21:01:16miprihttps://play.nim-lang.org/#ix=2JqO
21:02:31FromDiscord<mratsim> so I think what's happening is that there is a suspension point in the while loop. r is saved at this suspension point. WHen I reach the count of 4, r isn't saved but left at the default value of 0
21:02:40FromDiscord<mratsim> and that's what ends up being displayed
21:03:20FromDiscord<mratsim> @mipri, nice
21:03:32FromDiscord<mratsim> very unintuitivee though
21:04:06Zevvit is
21:04:58FromDiscord<mratsim> I've seen in HN and stackoverflowthat in some language (C# I think) programmers had to take a lot of precaution with state around suspension point
21:11:57FromDiscord<mratsim> leaving, see you
21:12:58Zevvciao
21:17:40*nyaayaya quit (Quit: byeee~)
21:32:13FromDiscord<Quibono> Any clue why this code is making minmaxheap freak out? https://play.nim-lang.org/#ix=2JqX
21:37:57*Arrrrrrrr quit (Remote host closed the connection)
21:38:38FromDiscord<Quibono> Other than I totally don't understand how minmaxheaps work
21:42:12*kwilczynski quit (Ping timeout: 272 seconds)
21:43:08*sirn quit (Read error: Connection reset by peer)
21:45:52*fowl quit (Ping timeout: 260 seconds)
21:47:14*sirn joined #nim
21:47:37*fowl joined #nim
21:47:50*kwilczynski joined #nim
21:57:37*jaz80 joined #nim
21:58:13jaz80Does nim have anything that will get compiled to a copysignf intrinsic with the C backend? ie; not a library/stdlib call
22:17:31*Vladar quit (Quit: Leaving)
22:49:42*def- quit (Quit: -)
22:50:53*def- joined #nim
22:57:59*natrys quit (Quit: natrys)
22:58:05disruptekmratsim, zevv: the kotlin technique (and/or variant objects) is fine for mratsim's application, but it doesn't meet my desire for arbitrary continuation return types. also note that variant objects are not really a long-term nim support target per se... just something to keep in mind.
22:59:36disruptekthere's a tiny needle to thread here and i fully expect mratsim to thread it, but i haven't managed to figure out how he will do it in a way that accomodates all our other guarantees. so i await his application of genius. 😁
23:00:46disruptekmaybe i'll be able to download the kotlin video by christmas. here's hoping santa comes early.
23:16:44FromDiscord<Cohjellah> Alrighty. Merry Christmas from Australia!!
23:22:52FromDiscord<ElegantBeef> All of australia
23:31:57*jaz80 quit (Remote host closed the connection)
23:44:50FromDiscord<Cohjellah> All of it
23:44:51FromDiscord<Cohjellah> every inch
23:44:58FromDiscord<Cohjellah> Also, I'm still having problems with my terminal app ahaha
23:45:17FromDiscord<Cohjellah> driving me nuts. The docs aren't too clear, and I've run out of terminal options lmao
23:49:00FromDiscord<Cohjellah> Should I make a forum post?
23:53:42FromDiscord<shadow.> hm?
23:53:44FromDiscord<shadow.> what's the issue
23:55:38FromDiscord<mratsim> I've pushed a POC, just like the C++ dev I think function call are easier to optimize than state machines for compiler and CPU and they are surely easier to debug than goto state machine so the current codegen is fine
23:55:52FromDiscord<mratsim> @disruptek see: https://godbolt.org/z/enMhad
23:56:19FromDiscord<mratsim> no kotlin technique and no variant, just monkey patching your base code.