<< 24-02-2021 >>

00:00:54FromDiscord<lithdew> I'd personally just use a bigint lib and do it hackily if it's for something quick, but wrapping OpenSSL works: https://www.openssl.org/docs/man1.0.2/man3/RSA_generate_key.html
00:01:24FromDiscord<Rika> In reply to @Avatarfighter "<@!259277943275126785>": lol no i dont sounds interesting tho maybe wrap an existing C lib
00:01:28FromDiscord<Rika> would prolly be most secure
00:01:53FromDiscord<gollark> Doing it yourself would probably be vulnerable to horrible side channel attacks.
00:01:57FromDiscord<Rika> openssl is already wrapped by nim by default
00:02:05FromDiscord<Rika> i think
00:02:45FromDiscord<Avatarfighter> @gollark I think you'll fully enjoy reading my hacky implementation of xchacha2020-poly1305, I translated a JS library for it ๐Ÿ™‚
00:02:58FromDiscord<Rika> ytho
00:03:32FromDiscord<Avatarfighter> to be honest I don't really have an answer, I was looking for a simple to read library and then Leorize helped me fix it when the JS didn't translate directly to nim lol
00:05:03*dv^_^9691 quit (Quit: The Lounge - https://thelounge.chat)
00:35:14FromGitter<gogolxdong> I remembered arc is faster than manual using object pooling.
00:37:31FromDiscord<lithdew> Got two questions: how can I convert a seq<char> into a string, and is there anything I need to be concerned about using gc:arc with async?
00:38:51FromDiscord<lithdew> Oh another question, what kind of hash map are Tables? round-robin open-addressing, etc.? Does it support incremental rehashing?
00:38:59FromDiscord<konsumlamm> iirc async doesn't work with arc
00:39:11FromDiscord<ElegantBeef> `strutils.join` and i believe arc works fine with async
00:39:46FromDiscord<lithdew> In reply to @ElegantBeef "`strutils.join` and i believe": strutils.join worked, thanks ๐Ÿ˜„
00:40:07FromDiscord<lithdew> I read something about cycle detection needed with async just yesterday while skimming through docs, though I'm not fully sure why
00:40:37FromDiscord<ElegantBeef> Well safe bet is to use orc, though i dont touch async much ๐Ÿ˜„
00:41:02FromDiscord<lithdew> ๐Ÿ‘
00:42:06FromDiscord<ElegantBeef> Ah async doesnt capture cycles and it seems async creates cycles from this quote "Nim's current async implementation creates a lot of cycles in the graph, so ARC can't collect them."
00:54:57FromDiscord<Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2QB6
00:55:28FromDiscord<Anonymous Poet> I've tried doing `const size = 4` and use that instead of the literal but that didnt fix it either. any ideas?
00:56:20FromDiscord<ElegantBeef> Did you know about `net.parseIpAddress`?
00:57:04FromDiscord<Anonymous Poet> no, but trying to write up my own implementation
00:59:30FromDiscord<ElegantBeef> Well you have 0 reason to make `arr`
00:59:32FromDiscord<ElegantBeef> result exists
00:59:49FromDiscord<ElegantBeef> I'm uncertain what line that issue comes from
01:00:02FromDiscord<Rika> prolly the result.add line
01:00:04FromDiscord<Anonymous Poet> it comes from the `result.add` in the while loop
01:00:22FromDiscord<ElegantBeef> what's the IpAddress constructor?
01:00:30FromDiscord<Rika> exactly as it says
01:00:33FromDiscord<Anonymous Poet> `IpAddress = array[4, uint8]`
01:00:33FromDiscord<Rika> cant you read smh
01:00:55FromDiscord<ElegantBeef> Lol rika, there is no type declared so there is no way of knowing that it was an array alias
01:01:07FromDiscord<Rika> "the error is Error: type mismatch: got <array[int, uint8]> but expected 'IpAddress = array[0..3, uint8]'"
01:01:10FromDiscord<Rika> "no type declared"
01:01:20FromDiscord<ElegantBeef> I didnt see that part
01:01:23FromDiscord<Rika> bruh
01:02:14FromDiscord<Anonymous Poet> so is there a way to have an int literal be the generic?
01:02:47FromDiscord<ElegantBeef> `N: static int`
01:04:13FromDiscord<Anonymous Poet> `toArray[:uint8, 4: static int]` ? that doesnt work
01:04:26FromDiscord<ElegantBeef> No in the generic declaration
01:05:02FromDiscord<Anonymous Poet> hmm, that gives me `Error: type expected`
01:05:23FromDiscord<ElegantBeef> !eval proc test[N: static int]: array[N, byte] = discard;echo test[3]()
01:05:24NimBot<no output>
01:05:36FromDiscord<ElegantBeef> Well fuck you too bot https://play.nim-lang.org/#ix=2QBc
01:05:38FromDiscord<Rika> here we go again
01:06:02FromDiscord<Rika> ; doesnt end proc scope blah blah blah
01:06:17FromDiscord<ElegantBeef> Yea i figured
01:06:56FromDiscord<Anonymous Poet> should i just not bother using the generic size here? i dont need it, was just hoping to learn to do something new in nim
01:07:40FromDiscord<Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2QBd
01:08:58FromDiscord<ElegantBeef> need `[S;N: static int]`
01:09:08FromDiscord<ElegantBeef> you dont want S to be a static int, only N
01:09:38FromDiscord<Anonymous Poet> wtf
01:09:42FromDiscord<Rika> this looks like a bug regards the version wihout static int
01:09:58FromDiscord<Rika> https://media.discordapp.net/attachments/371759389889003532/813940749556777000/unknown.png
01:10:04FromDiscord<Anonymous Poet> you're right, the semi colon did it
01:10:15FromDiscord<Anonymous Poet> and i guess its supposed to match `x, y: int` style decls
01:10:22FromDiscord<Anonymous Poet> but i did not expect that at all
01:10:30FromDiscord<ElegantBeef> Well rika that generates a `array[int, uint8]` array
01:10:36FromDiscord<ElegantBeef> Which should be valid
01:10:39FromDiscord<ElegantBeef> I guess?
01:10:46FromDiscord<Rika> i dont think it should
01:11:02FromDiscord<ElegantBeef> Why not you can do `array[bool, uint8]` or any other ordinal
01:11:05FromDiscord<Rika> i mean
01:11:11FromDiscord<Rika> rather
01:11:19FromDiscord<Rika> it would be valid, but the error should not happen
01:11:31FromDiscord<ElegantBeef> Yea i agree
01:11:55FromDiscord<Rika> i was pointing out the error, not the invalidity of the array type
01:12:18FromDiscord<ElegantBeef> Ok so any int above 16bit seems to cause an issue
01:13:34FromDiscord<Anonymous Poet> ty for the help
01:13:56FromDiscord<ElegantBeef> No problem, sorry for being so inept at reading ๐Ÿ˜›
01:14:38FromDiscord<Rika> cant believe you can read worse than someone who has been up for 15 hours so far
01:15:14FromDiscord<ElegantBeef> Eh reading is easy properly reading is hard
01:20:18FromGitter<xflywind> we need this too https://github.com/golang/go/issues/44551
01:24:42*Tanger joined #nim
01:25:08*abm quit (Quit: Leaving)
01:26:33leorize[m]it shouldn't be too hard given that we can generate C++
01:26:49leorize[m]clang's libfuzzer can handle this
01:27:48FromDiscord<lithdew> Is there an idiomatic way to do the following: if a statement in a while loop has an error, break the while loop
01:28:06FromDiscord<lithdew> sent a code paste, see https://play.nim-lang.org/#ix=2QBi
01:28:23FromDiscord<Rika> while outside, try inside, replace discard with break
01:29:05FromDiscord<Rika> or just keep the same code, i dont see the issue
01:29:19FromDiscord<lithdew> Oh, the try inside is nice
01:29:29FromDiscord<lithdew> sent a code paste, see https://play.nim-lang.org/#ix=2QBj
01:29:42FromDiscord<Rika> try except isnt usually recommended for async
01:29:58FromDiscord<ShadowElf37> out of curiosity, does `try-except` have a lot of overhead?
01:30:10FromDiscord<Rika> depends on what exceptions you're using
01:30:10FromDiscord<ShadowElf37> i always assumed it did and avoided them in loops like that
01:30:26FromDiscord<Rika> defaults have a sizable overhead
01:30:41FromDiscord<Rika> if you change the exception kinds maybe itll become better
01:31:17FromDiscord<ShadowElf37> "maybe"
01:31:27FromDiscord<Rika> i mean i never tested it so i wouldnt know
01:31:32FromDiscord<ShadowElf37> fair enough
01:31:38FromDiscord<lithdew> In reply to @Rika "try except isnt usually": Oh, even after calling `await` on a future?
01:31:48FromDiscord<Rika> yeah i believe even if
01:32:24FromDiscord<Rika> https://nim-lang.org/docs/asyncdispatch.html#asynchronous-procedures-handling-exceptions
01:32:58FromDiscord<Avatarfighter> welp time to refactor a couple things
01:33:06FromDiscord<Avatarfighter> I was doing try except
01:34:13FromDiscord<lithdew> Reading the `await` template though, it looks like it's doing the same thing ๐Ÿค”
01:35:10*vicfred joined #nim
01:38:59*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
01:39:17*njoseph joined #nim
01:41:01FromDiscord<lithdew> Is there any way to call `shutdown(socket_fd)` on an AsyncSocket?
01:41:24FromDiscord<lithdew> (edit) "`shutdown(socket_fd)`" => "`shutdown(socket_fd, R/W/RW)`"
02:01:18FromDiscord<lithdew> Got my first program done ๐Ÿ˜„ https://media.discordapp.net/attachments/371759389889003532/813953670348537946/unknown.png
02:01:33FromDiscord<lithdew> I tried it with --gc:arc and valgrind, looks like there's no leaks
02:07:56FromDiscord<Avatarfighter> something kind of fun to note is that you don't actually need to specify the module you're calling procs from
02:08:33FromDiscord<Avatarfighter> `let event_closed = new_future[void]()` will work just fine
02:09:04FromDiscord<lithdew> Ah yep, I do it just so I know exactly what modules each proc is from
02:09:29FromDiscord<ElegantBeef> It ruins the method call syntax so it's a pain in some cases ๐Ÿ˜„
02:09:50FromDiscord<Avatarfighter> I just realized but is `new_future[void]` valid ? I was under an impression it should be `newFuture[void]` ?
02:10:12FromDiscord<ElegantBeef> Nim's case style insensitivity
02:10:15FromDiscord<lithdew> Yep
02:10:28FromDiscord<Avatarfighter> damn I never tried anything other than whats in the docs
02:10:30FromDiscord<ElegantBeef> only the first character sensitivity matters and `_` isnt emitted
02:10:35FromDiscord<Avatarfighter> that's really neat ahah
02:10:52FromDiscord<lithdew> Lets me keep the casing I use in C which is nice ๐Ÿ˜„
02:11:07FromDiscord<lithdew> I prefer snake casing personally
02:11:22FromDiscord<ElegantBeef> Well it also lets me shun you but i can use your code without issue ๐Ÿ˜›
02:11:40FromDiscord<lithdew> Lol xD
02:12:17FromDiscord<lithdew> Oh yeah, what do you mean by specifying modules when calling procs causing pains with the method call syntax?
02:13:32FromDiscord<ElegantBeef> well in Nim you can do `echo("HelloWorld")` or `"HelloWorld".echo`
02:13:35FromDiscord<ElegantBeef> Not a great example
02:14:05FromDiscord<ElegantBeef> But the point stands that Nim allows you do not do the C style function call like in my favourite example `10.3.floor.int.mod(2)` ๐Ÿ˜„
02:14:18FromDiscord<ElegantBeef> (edit) "do" => "to"
02:14:44FromDiscord<lithdew> Woah, never seen that before in a lang
02:15:08FromDiscord<ElegantBeef> And as you've probably noticed you can drop `()` if the left hand is the only arguement
02:16:10FromDiscord<lithdew> For large modules I personally prefer specifying the module names, but I can imagine not specifying it being really nice for templating/scripts
02:16:30FromDiscord<lithdew> (edit) "the" => "imported" | "names," => "names when calling procs,"
02:17:11*sknebel quit (Ping timeout: 246 seconds)
02:17:13FromDiscord<ElegantBeef> Not like i can force you to use the superior method ๐Ÿ˜›
02:17:19FromDiscord<Avatarfighter> I feel like you'd enjoy Macros lithdew once you're comfortable with the language ๐Ÿ˜›
02:17:30*sknebel joined #nim
02:18:04FromDiscord<lithdew> I fear making metalangs for certain modules once I get into macros lol
02:18:21FromDiscord<Avatarfighter> its honestly pretty dope what people have done with macros
02:18:24FromDiscord<ElegantBeef> Fear... that's the fun
02:18:32FromDiscord<ElegantBeef> I love macros and making DSLs
02:18:56FromDiscord<lithdew> I really like the route DSL in jester, afraid my apps are gonna start being config files ๐Ÿ˜…
02:19:29FromDiscord<Avatarfighter> Beef: do you know if there is an easy way to do string to cuchar ?
02:19:39FromDiscord<ElegantBeef> What's cuchar again?
02:19:58FromDiscord<Avatarfighter> unsigned char
02:20:05FromDiscord<Avatarfighter> C's unsigned char
02:20:08FromDiscord<Rika> compat. unsigned char. more of
02:20:15FromDiscord<Avatarfighter> o
02:20:19FromDiscord<Rika> the c in c(type) is compat, not C
02:20:23FromDiscord<Avatarfighter> oh
02:20:37FromDiscord<Avatarfighter> well that's good to know
02:35:18*lkjasdf1 joined #nim
02:35:34*lkjasdf quit (Read error: Connection reset by peer)
02:39:45FromDiscord<Pixtum> is there a recommended formatting utility for nim? kinda like clangformat
02:39:55*blueberrypie quit (Quit: leaving)
02:40:18FromDiscord<ElegantBeef> You've got `nimpretty` and `morepretty` afaik
02:42:08*blueberrypie joined #nim
02:48:48FromDiscord<Yardanico> @lithdew you shouldn't use async with arc
02:49:08FromDiscord<Yardanico> Valgrind didn't show leaks because Nim has its own allocator by default
02:49:45FromDiscord<Yardanico> Compile with -d:useMalloc and you'll see that it leaks. Instead you should use gc:orc
02:51:13FromDiscord<lithdew> In reply to @Yardanico "<@679373976677384204> you shouldn't use": ๐Ÿ˜ฎ gotcha, thanks for that
02:52:22FromDiscord<lithdew> Huh, I tried it with orc and I still get leaks reported
02:53:04FromDiscord<Yardanico> Some leaks are fine - e.g. global variables that exist for the whole program lifetime
02:53:23FromDiscord<Yardanico> What's your Nim version btw?
02:53:31FromDiscord<lithdew> 1.4.2
02:58:18*krux02 quit (Remote host closed the connection)
02:59:46*^Q-Master^ quit (Ping timeout: 256 seconds)
03:00:13FromDiscord<lithdew> The leaks I'm getting seem to be from local vars
03:01:07*Q-Master joined #nim
03:13:12*sknebel quit (Quit: sknebel)
03:13:36FromDiscord<Pixtum> is there a way to have a custom format with nimpretty?
03:14:01*sknebel joined #nim
03:25:17*lkjasdf1 quit (Quit: Good night!)
03:33:02*muffindrake quit (Ping timeout: 264 seconds)
03:34:33*muffindrake joined #nim
03:38:34*vicfred quit (Quit: Leaving)
03:47:08*casaca quit (Remote host closed the connection)
04:33:46*spiderstew joined #nim
04:35:11*spiderstew_ quit (Ping timeout: 272 seconds)
04:36:25FromDiscord<lithdew> How do I create a HashSet of a bunch of references?
04:39:10FromDiscord<ElegantBeef> `tables`
04:39:55FromDiscord<lithdew> HashSet doesn't work w/ refs?
04:40:05FromDiscord<ElegantBeef> Ah sorry set
04:40:13FromDiscord<Yardanico> it can work if you define a `hash` proc for your ref type(s)
04:40:25FromDiscord<ElegantBeef> Yea you to look at `hashes` https://nim-lang.org/docs/hashes.html
04:40:53FromDiscord<lithdew> In that case, how would I hash a ref? I want it to be a set of pointers basically
04:41:16FromDiscord<Yardanico> do you want to treat two refs with same value but different address as identical?
04:41:24FromDiscord<lithdew> Nope
04:41:31FromDiscord<lithdew> Only the same address
04:42:07FromDiscord<ElegantBeef> `cast[int](yourRef[].addr)` then hash that, right yard?
04:42:20FromDiscord<Yjuq> Hi, does the import prefers local files first? Let's say I have some packages installed via nimble but my project includes files that are named like some packages. If I import it now via "import name" does it fetch the nimble package or the local package?
04:42:37FromDiscord<Yardanico> local package
04:42:41FromDiscord<ElegantBeef> I'd wager it'd search locally first
04:42:50FromDiscord<Yardanico> to specify that you specifically want a nimble package use the `pkg` prefix like `import pkg/cligen`
04:43:03FromDiscord<Yardanico> same goes for stdlib - prefer `import std/strutils` to `import strutils`
04:43:13FromDiscord<Yjuq> Ah, thank you
04:43:16FromDiscord<Yardanico> new stdlib modules are _only_ available in the `std` "namespace"
04:43:39FromDiscord<ElegantBeef> And you can do `std/[]` and have all your imports inside the `[]` ๐Ÿ˜„
04:43:40FromDiscord<Yjuq> I need to modify a nimble package and probably just put it locally in my project x)
04:43:44FromDiscord<Yardanico> @ElegantBeef exactly
04:44:00FromDiscord<Yardanico> @Yjuq you can fork it and put it as a github link of your fork in your .nimble file
04:44:18FromDiscord<ElegantBeef> Well you can just `nimble develop url` and it'll automatically point nimble to that folder
04:44:35FromDiscord<ElegantBeef> Then you can push that to a fork and point the nimble to that url
04:45:06FromDiscord<Yjuq> why should i do that? It's just one code line
04:45:10FromDiscord<Yjuq> x)
04:45:13FromDiscord<lithdew> How do I get a reference to a stack object?
04:45:33FromDiscord<lithdew> e.g. a Server object with a heap-allocated Connection object containing a ref back to Server
04:45:37FromDiscord<ElegantBeef> In reply to @Yjuq "why should i do": What do you mean?
04:45:56FromDiscord<ElegantBeef> In reply to @ElegantBeef "`cast[int](yourRef[].addr)` then hash that,": This should work for you no?
04:46:24FromDiscord<lithdew> Yep that worked, this one's another question on grabbing a ref
04:46:28FromDiscord<Yardanico> @lithdew generally you'd just want to make Server a `ref object` too, but it's not required of course
04:46:43FromDiscord<Yardanico> You can't just "grab" a ref safely because stack-allocated objects will get destroyed
04:46:43FromDiscord<ElegantBeef> `new T` generates a ref
04:46:56FromDiscord<Yardanico> You can copy a stack-allocated object into a heap allocated one
04:47:16FromDiscord<lithdew> In reply to @Yardanico "<@!679373976677384204> generally you'd just": Right, how would I do it unsafely then if I can guarantee it'll still be alive on the stack?
04:47:46FromDiscord<Yardanico> well you can use `addr` to get the raw address of it, but I'd advise against it
04:47:48FromDiscord<ElegantBeef> You could use the `lent` keyword if it's read only afaik
04:47:53FromDiscord<Yardanico> why use unsafe features when you can do it with safe ones? :)
04:47:58FromDiscord<Yjuq> In reply to @ElegantBeef "What do you mean?": Well, why should I create a fork and bundle everything again with nimble? I don't even use it for my project, I just use it to download the c-bindings i need.
04:48:24FromDiscord<ElegantBeef> Well if it's not OSS there is no reason to
04:48:47FromDiscord<ElegantBeef> If it's OSS you want to have reproducible build across platforms with `nimble build`, and you dont want to ship other libraries inside typically
04:49:50FromDiscord<Yjuq> It's not OSS - The whole project will be commercial
04:50:00FromDiscord<Yjuq> I already checked all licenses
04:50:01FromDiscord<Yjuq> x)
04:50:26FromDiscord<Yardanico> most nim libraries are MIT anyway, so yeah
04:51:12FromDiscord<Yardanico> or Apache 2/BSD-2|3/ISC but they fall in the same league
04:51:55FromDiscord<ElegantBeef> Yea i forgot you arent making OSS software ๐Ÿ˜„
04:56:35FromDiscord<Yjuq> by the way, where are get the nimble packages downloaded to?
04:56:52FromDiscord<ElegantBeef> on unix `~/.nimble/pkg`
04:57:03FromDiscord<ElegantBeef> (edit) "`~/.nimble/pkg`" => "`~/.nimble/pkgs`"
04:57:30FromDiscord<Yjuq> ah thanks
05:02:03FromDiscord<Yjuq> is nimble capable of managing dependencies from local git repositories?
05:02:05*Tanger quit (Ping timeout: 240 seconds)
05:02:09*Tlangir joined #nim
05:02:17FromDiscord<Yjuq> maybe i would reconsider my project structure
05:02:58FromDiscord<Yardanico> @Yjuq AFAIK yes
05:03:00FromDiscord<ElegantBeef> > Nimble currently supports installation of packages from a local directory, a Git repository and a mercurial repository. The .nimble file must be present in the root of the directory or repository being installed.
05:03:21FromDiscord<Yardanico> @ElegantBeef "local git repository"
05:03:43FromDiscord<ElegantBeef> refer back to earlier of me not being able to read
05:03:51FromDiscord<Yardanico> e.g. see https://github.com/nim-lang/nimble/issues/167
05:04:00FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/813999649337507840/unknown.png
05:04:12FromDiscord<Yardanico> this is how you specify a git-over-ssh local repo
05:04:29FromDiscord<Yardanico> for http(s) there's no difference of course
05:06:17FromDiscord<Yjuq> Ah, thank you. Everything in the moment is a bit overwhelming for me. I like to go in production ASAP but kinda still sitting here and thinking about the project structure
05:30:35FromDiscord<lithdew> Is there any way to have a Future[void] that, when completed, triggers all other Future's it's chained to?
05:30:49FromDiscord<lithdew> So that I can emulate smth like select{} in Go
05:30:50*Tlanger joined #nim
05:33:25FromDiscord<ElegantBeef> Where are all the async users when you need them ๐Ÿ˜›
05:33:34*Tlangir quit (Ping timeout: 272 seconds)
05:37:12FromDiscord<Yardanico> @lithdew wdym "triggers"?
05:38:32FromDiscord<Yardanico> for example you can set callbacks or use https://nim-lang.org/docs/asyncfutures.html#all%2Cvarargs%5BFuture%5BT%5D%5D if you want to get a future that'll return when all futures in the arguments complete
05:38:37FromDiscord<lithdew> So say for example I have a global `closed: Future[void]`, and in some other future's I have `yield closed or other_future_here` - I want those other futures to be resumed
05:38:46FromDiscord<Yardanico> hm
05:39:02FromDiscord<Yardanico> you can check the completion status and do stuff based on that I guess?
05:39:09*rockcavera quit (Remote host closed the connection)
05:39:39FromDiscord<lithdew> I basically want to cancel a list of pending futures when Ctrl+C is pressed
05:39:43FromDiscord<lithdew> for graceful shutdown
05:39:48FromDiscord<Yardanico> you can't really cancel futures
05:41:33FromDiscord<Yardanico> You can do that with https://github.com/status-im/nim-chronos AFAIK though
05:42:23FromDiscord<Yardanico> but then you won't be able to use existing Nim projects/libs that use Nim's stdlib async without modification
05:44:43FromDiscord<Yardanico> See https://forum.nim-lang.org/t/7287
05:52:07*haxscramper joined #nim
06:07:56FromDiscord<Yardanico> https://www.python.org/dev/peps/pep-0654/
06:31:20*waleee-cl quit (Quit: Connection closed for inactivity)
06:41:19*narimiran joined #nim
06:44:15ForumUpdaterBotNew thread by Halloleo: Is it possible to tell testament to print the values of an failing assert statement?, see https://forum.nim-lang.org/t/7552
06:58:40FromDiscord<PizzaFox> does the nim ecosystem have something like https://goreleaser.com/
06:59:25FromDiscord<PizzaFox> if i can have nimble compile a bunch of binaries for different OSs, architectures etc. i can upload those to GH releases myself
07:01:24FromDiscord<ElegantBeef> I dont think it does, but hmmm possible new project? ๐Ÿ˜„
07:02:05FromDiscord<PizzaFox> eh
07:02:27FromDiscord<PizzaFox> maybe a snippet that's just 20 lines of `nimble c ...`
07:03:07FromDiscord<ElegantBeef> Huh?
07:03:52FromDiscord<PizzaFox> there are already tools to make github releases and upload binaries
07:04:12FromDiscord<PizzaFox> i will just write a big bash script that compiles a bunch of nim binaries for different architectuers
07:04:15FromDiscord<PizzaFox> (edit) "i will just write a big bash script that compiles a bunch of nim binaries for different ... architectuers" added "cpu"
07:04:34FromDiscord<slymilano> Hi gang, how can I grab the last N chars from a string? My google fu is failing me! `"hello world"[??]`
07:04:49FromDiscord<ElegantBeef> `[^n..^1]`
07:05:12FromDiscord<ElegantBeef> `^n` being backwards index
07:05:20FromDiscord<ElegantBeef> So 1 is last element and so on
07:05:46FromDiscord<ElegantBeef> You can use normal indices aswell
07:06:43FromDiscord<slymilano> thank you ๐Ÿ˜„
07:15:36FromDiscord<slymilano> And with that exercise 4 landed ๐Ÿ™‚ https://github.com/sergiotapia/nimlings/blob/master/src/exercises/exercise_04_strings.nim
07:15:44FromDiscord<slymilano> thanks again @ElegantBeef
07:15:51FromDiscord<ElegantBeef> No problem
07:15:57*letto quit (Quit: Konversation terminated!)
07:16:00*krux02 joined #nim
07:16:03FromDiscord<ElegantBeef> Feel free to submit it to this month with nim ๐Ÿ˜›
07:16:12FromDiscord<slymilano> once it's beefier
07:16:56FromDiscord<slymilano> I found a thread on nim forums from 2016 complaining about docs being very complicated and bad. hopefully this project helps newcomers navigate better. I was (and still am sometimes) totally lost in the docs
07:17:22FromDiscord<slymilano> https://forum.nim-lang.org/t/2364 - lot of the sentiment here still applies today
07:17:25FromDiscord<ElegantBeef> And it apparently helps you learn ๐Ÿ˜›
07:17:48*letto joined #nim
07:18:15FromDiscord<ElegantBeef> Well that's about the old docs
07:18:28FromDiscord<ElegantBeef> The current ones have a search bar and are a bit better i assume
07:18:38FromDiscord<Yardanico> also we have more community resources in https://nim-lang.org/learn.html
07:18:43FromDiscord<Yardanico> and in 2016 we didn't have nim in action :P
07:19:07FromDiscord<ElegantBeef> Like you can search split and look at all the results! https://media.discordapp.net/attachments/371759389889003532/814033650059968532/unknown.png
07:19:26FromDiscord<slymilano> i still couldn't find a way to get the last chars in a string easily ๐Ÿ˜ฆ
07:19:36FromDiscord<Yardanico> that's more of a manual/tutorial thing
07:19:40FromDiscord<Yardanico> rather than module docs
07:19:45FromDiscord<ElegantBeef> ^
07:19:50FromDiscord<Yardanico> https://nim-lang.org/docs/tut1.html#advanced-types-slices :P
07:19:53FromDiscord<mratsim> In reply to @slymilano "i still couldn't find": a[^3..^1]
07:19:58FromDiscord<mratsim> you get the last 3
07:20:09FromDiscord<ElegantBeef> Yea we already explained that
07:20:10FromDiscord<slymilano> yeah elegant helped me
07:20:33FromDiscord<ElegantBeef> There is also substr iirc
07:20:37FromDiscord<Yardanico> yes
07:20:38FromDiscord<slymilano> so a manual/tutorial with the most common 80% should help adoption or least give newcomers a taste to execute ideas
07:20:47FromDiscord<flywind> our wiki is a great resource too.
07:20:48FromDiscord<Yardanico> well we have tut1, tut2, tut3
07:20:52FromDiscord<Yardanico> nim basics
07:21:14FromDiscord<ElegantBeef> The tutorials are meant for teaching nim and the most of the basics of programming
07:21:16FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/814034190597226546/unknown.png
07:21:26FromDiscord<ElegantBeef> The module docs are for documenting implementations
07:21:52FromDiscord<slymilano> yeah the tuts are nice
07:22:44FromDiscord<ElegantBeef> And the system module does have slices/substr documented as they need to be https://nim-lang.org/docs/system.html#%5B%5D%2Cstring%2CHSlice%5BT%2CU%5D
07:23:06FromDiscord<ElegantBeef> But yes you wouldnt know where to look unless you knew how Nim did slice operations
07:23:37FromDiscord<ElegantBeef> And do that i say read the tutorial
07:23:42FromDiscord<ElegantBeef> (edit) "do" => "to"
07:27:56FromDiscord<ElegantBeef> One thing to note is there is no enforced way to do indexing types or slices, since users can define any operator to do that, kinda just convention that `[]` is how you index everything ๐Ÿ˜„
07:30:19FromDiscord<XeroOl> one thing that I found relatively difficult was switching between learning the library and the language
07:32:12FromDiscord<XeroOl> it's hard to know when to look for something as a language feature vs the library
07:32:40FromDiscord<XeroOl> I found slicing in the standard library way too late
07:35:37*tane_ joined #nim
07:35:46FromDiscord<ElegantBeef> Just read the tutorial 10-20 times and then you'll need to read it about three times that many
07:39:42krux02I am not particularly happy about the slicing operator in seq/string
07:39:59krux02`v[i]
07:40:29krux02`v[i]` references object at position i, no copy
07:41:13krux02`v[i..<j]` copies all object from i up to j and creates a new seq/string object out of them.
07:42:05FromDiscord<ElegantBeef> Yea i dont like that either, there wasnt a reasonable solution until views afaik
07:42:39FromDiscord<ElegantBeef> After all i did whip this together <https://github.com/beef331/strviewutils> just as small test sample ๐Ÿ˜„
07:43:53krux02openArray as values that can be stored?
07:44:02krux02That looks like a timotheecour feature
07:44:02FromDiscord<ElegantBeef> Yea
07:44:34FromDiscord<ElegantBeef> Well it's an experimental feature, that's pretty nice as it gives a ton of borrow features/borrow checking
07:44:57FromDiscord<ElegantBeef> https://nim-lang.org/docs/manual_experimental.html#view-types Since you dont seem to know of them
07:45:32FromDiscord<ElegantBeef> Also allows `var T` which is pretty nice for references to already existing types
08:06:00*ForumUpdaterBot quit (Remote host closed the connection)
08:06:09*ForumUpdaterBot joined #nim
08:07:17FromDiscord<mratsim> That's the main draw of Rust
08:07:25FromDiscord<mratsim> the borrow checker enables safe slices
08:07:40FromDiscord<mratsim> it's very useful for implementing streams and parsers
08:08:01FromDiscord<mratsim> and even for Arraymancer I could use unowned views.
08:10:52FromDiscord<ElegantBeef> Yea it's a pretty big deal if Nim gets it fully implemented, as it's an opt in feature without much reasoning about it, so you can still use all the more unsafe features aswell.
08:11:20FromDiscord<ElegantBeef> Unsafe in this context meaning the Rust "safe"
08:11:31FromDiscord<Nerdie> how do i do dll injection with nim?
08:12:08FromGitter<yglukhov> Morning everyone. I'm trying to recall the name of pragma which is applied to `var` definition and gives it a cpp-referenc-ish semantics. I'm pretty sure i've seen it somewhere on the forum, but can't find it now.
08:12:25FromDiscord<ElegantBeef> `{.byaddr.}`?
08:12:45FromDiscord<ElegantBeef> It's in `decls`
08:13:19FromDiscord<ElegantBeef> If it's not that i should just shush and let someone else speak.... as usualy ๐Ÿ˜›
08:13:25FromDiscord<ElegantBeef> (edit) "usualy" => "usual"
08:13:48FromGitter<yglukhov> @ElegantBeef that's it. thanks!
08:14:00FromDiscord<ElegantBeef> Yay i helped!
08:14:16FromDiscord<PizzaFox> sent a code paste, see https://play.nim-lang.org/#ix=2QD5
08:17:09*PMunch joined #nim
08:18:17ForumUpdaterBotNew post on r/nim by Unaimend: Problem with the package maybe, see https://reddit.com/r/nim/comments/lr7gqn/problem_with_the_package_maybe/
08:20:59FromDiscord<ElegantBeef> It could be the fact that you can pass a value that's not within that range which would cause the result to not be set... but it's a struct so that's weird
08:21:44FromDiscord<PizzaFox> yeah i just replaced it with `int` and added an `assert` statement to check that it's in 400-599
08:21:54FromDiscord<ElegantBeef> I mean you can leave the range in there
08:22:09FromDiscord<PizzaFox> > This will become a compile time error in the future.
08:22:15FromDiscord<PizzaFox> seems like a bad idea
08:22:26PMunchThat message has been there for at least a year now :P
08:22:38FromDiscord<ElegantBeef> Well my follow up was going to be file an issue, or fix it yourself ๐Ÿ˜„
08:22:39FromDiscord<mratsim> I header about that about the strange structures of my packages as well
08:22:46FromDiscord<mratsim> (edit) "header" => "heard"
08:23:08FromDiscord<ElegantBeef> I dont get why it's there, since like i said it's a value object
08:23:10*Tlanger quit (Quit: Leaving)
08:23:39FromDiscord<ElegantBeef> Fairly certain it's just the fact it can error on assignment to that range value
08:25:58FromDiscord<Yardanico> i think in this case it's a valid warning since there's no guarantee that the json will contain `statusCode`
08:26:15FromDiscord<Yardanico> and even if it does there's no guarantee that it's in that range :P
08:26:15FromDiscord<ElegantBeef> But it goes away with an int
08:26:19FromDiscord<ElegantBeef> The type def is the issue
08:26:23FromDiscord<Yardanico> because for int 0 is a valid value
08:26:28FromDiscord<Yardanico> for statusCode it's not
08:26:33FromDiscord<Yardanico> so the default value will be invalid
08:26:53FromDiscord<ElegantBeef> No... `error: range[400..599]` warns `error: 400..599` doesnt ๐Ÿ˜„
08:27:31FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2QD8
08:27:52FromDiscord<ElegantBeef> Feel free to try those two, that's indeed weird warning
08:27:54FromDiscord<PizzaFox> huh
08:28:06FromDiscord<PizzaFox> that is very strange
08:29:09FromDiscord<ElegantBeef> You're telling me, i accidently found this behaviour
08:30:59PMunchDoes anyone have a reply to this? No very relevant for me, but I'm curious what this change entails: https://www.reddit.com/r/nim/comments/lququb/how_did_ssl_certification_change_for_windows/
08:31:26FromDiscord<Yardanico> it's a breaking chance
08:31:34FromDiscord<lithdew> Is there any way to grab a reference to a Future within itself?
08:31:42FromDiscord<Yardanico> but yes, basically you now need to provide a root cert file for SSL verification which is enabled by default
08:31:47FromDiscord<lithdew> (edit) "grab" => "self-reference" | "reference to a Future within itself?" => "Future?"
08:32:05FromDiscord<Yardanico> (edit) "chance" => "change"
08:32:06FromDiscord<lithdew> (edit) "Is there any way to self-reference a Future? ... " added "(e.g. I can grab a reference to Future[void] within a method that is a future)"
08:32:08PMunch@lithdew, don't think so, what are you trying to do?
08:32:44FromDiscord<lithdew> Trying to keep a seq of Future's where Future's would add themselves to it, and when a close() method is called, await all of them
08:33:43FromDiscord<mratsim> That sounds broken
08:33:59FromDiscord<mratsim> a future isn't executed until run.
08:34:20PMunchThat sounds like you want to use the async execution pool :P
08:34:47FromDiscord<PizzaFox> can i set `nimble build` to always pass `-d:ssl`
08:34:55FromDiscord<Yardanico> you can specify that in the .nims file
08:35:02FromDiscord<Yardanico> or in your build task in the .nimble file
08:35:29PMunchYou can also add it to your global config file if by always you mean always
08:35:29FromDiscord<PizzaFox> how can i set it in the nimble file
08:35:58FromDiscord<PizzaFox> switch()
08:36:09FromDiscord<Yardanico> yes
08:36:23FromDiscord<lithdew> In reply to @mratsim "a future isn't executed": If it's grabbing a reference within the function body itself, it could be presumed it's running though right?
08:36:25FromDiscord<Yardanico> although it's probably a bit better to put it in the .nims or .cfg file next to the main file
08:36:47FromDiscord<lithdew> e.g. grabbing a pointer to the stack frame reference for the future
08:36:54FromDiscord<PizzaFox> how can i use the .nims file
08:37:16FromDiscord<Yardanico> create a file named `yourmainappfile.nims` next to `yourmainappfile.nim` and put `switch("define", "ssl")` inside
08:37:49FromDiscord<PizzaFox> cool
08:38:39FromDiscord<Araq> looks like I switched to discord...
08:38:46FromDiscord<Yardanico> woah
08:38:55FromDiscord<mratsim> In reply to @lithdew "e.g. grabbing a pointer": What you are trying to do is equivalent to entering in a room twice and getting out of it twice.
08:38:58FromDiscord<PizzaFox> did you enable the compact display mode
08:39:02FromDiscord<mratsim> (edit) "twice" => "once"
08:39:16FromDiscord<PizzaFox> (edit) "did you enable the compact display mode ... " added "https://zws.im/๓ ฐ๓ ฃ๓ ฏ๓ ต๓ ญ๓ ฐ๓ ข"
08:41:07FromGitter<offbeat-stuff> Yo, I have a type say VkApplicationInfo with fields sType,pApplicationName All of them are exported say, How can I get list of these fields as strings inside a macro
08:41:17FromDiscord<ElegantBeef> He now gets to see all the inane fucketry ๐Ÿ˜„
08:41:31FromDiscord<Yardanico> i prefer the cozy mode btw :)
08:42:13FromDiscord<Yardanico> @offbeat-stuff you need to have a typed macro and then use https://nim-lang.org/docs/macros.html#getType%2CNimNode
08:43:33FromDiscord<Yardanico> sorry https://nim-lang.org/docs/macros.html#getTypeImpl%2CNimNode
08:45:18FromDiscord<Yardanico> By the way @Araq you had an older discord account, did you lose access to it?
08:45:25FromDiscord<Yardanico> that one - @Araq
08:45:36FromDiscord<Yardanico> ah nvm
08:52:47FromGitter<offbeat-stuff> Well with getTypeImpl I also want to have the strval of the input and and also the input is a typedesc so How do I do both
08:53:59FromGitter<offbeat-stuff> Well Lets say I passed a nimnode to macro how to do the expr value through the compiler
08:54:22FromGitter<offbeat-stuff> Like for typeof(x) is just a nimnode typeof(x) how do I get the value behind it
08:57:35FromDiscord<mratsim> Well come to the underground sect of macro users that deal with types.
08:58:08FromDiscord<mratsim> Welcome
08:58:57FromDiscord<mratsim> there is an issue (closed) that bluenote10 raised a couple of years ago with the exact same question
08:59:03FromDiscord<ElegantBeef> Hey i've dealt with them for constructors it wasnt so bad!
08:59:06FromDiscord<mratsim> and no clean resolution
08:59:29FromDiscord<ElegantBeef> That's the stockholm syndrome kicking in, eh?
08:59:40FromDiscord<mratsim> you can't extract a type from a typedesc node and in the past you didn't have to because typedesc weren't transformed into NimNode.
09:00:42FromDiscord<mratsim> anyway, personally I forward to a result quote do and do `Foo` is `Bar`, and create another macro/template that has the correct type.
09:00:56FromDiscord<mratsim> sometimes you can also use getTypeInst
09:01:21FromDiscord<mratsim> hopefully you don't have generics because the generic types might be eaten somewhere in the compiler nom nom nom
09:01:43FromDiscord<mratsim> Finally: good luck, you will need it.
09:02:09FromDiscord<mratsim> don't forget to communicate everyday so that we know you are still alive.
09:02:35FromDiscord<ElegantBeef> Or dont that part is up to you!
09:02:59FromDiscord<ElegantBeef> But really depending on what you're doing you might actually survive completely in blissful ignorance of these issues
09:03:07FromDiscord<ElegantBeef> I havent ran into any of them yet
09:04:13FromGitter<offbeat-stuff> btw why doesn't static[typedesc] work
09:04:36FromDiscord<Yardanico> because typedesc is already static
09:04:42FromDiscord<mratsim> static only makes sense with values.
09:04:49FromDiscord<mratsim> but I understand what you want
09:05:33FromDiscord<mratsim> the issue I'm referring to: https://github.com/nim-lang/Nim/issues/6785
09:07:05FromDiscord<mratsim> this is an example workaround to it: https://github.com/mratsim/constantine/commit/e9462bce8add71982385c0143d1e10e1c2d16466#diff-d0aca63dc4a9d36a573360eafd3df15089ec5a057909d399ab64507de6574d24R42-R71
09:08:01FromDiscord<mratsim> basically it really depends on what you want, do you want to check if 2 types are equal `is` do you want to just extract the type.
09:09:03FromDiscord<Araq> getType was designed for type introspection, like generating serializers
09:09:39FromDiscord<Araq> I have no idea why you want it to turn it into a `typedesc`
09:09:54FromDiscord<mratsim> here it's a typedesc input that is turned into a NimNode
09:10:08FromDiscord<mratsim> which was done without RFC at the time
09:10:19FromDiscord<mratsim> for "consistency" even
09:10:46FromDiscord<Araq> it's often the case that features work ok'ish for what they were designed for. and then users find more creative usages and it breaks down
09:11:17FromDiscord<mratsim> Personally want to be able to use `is` to ensure types are the same.
09:11:37FromGitter<offbeat-stuff> Well I am trying yo do this https://play.nim-lang.org/#ix=2QDm
09:11:39FromDiscord<mratsim> but sameType doesn't work with generics, and I can't convert a NimNode back into a typedesc.
09:11:56FromGitter<offbeat-stuff> Here the first one comes from another file the type decleration
09:12:09FromGitter<offbeat-stuff> the proc is what I want to make
09:12:13FromDiscord<ElegantBeef> Oh
09:12:26FromGitter<offbeat-stuff> autogenerate for each type
09:12:28FromDiscord<ElegantBeef> Introducing constructors https://github.com/beef331/constructor
09:12:58FromDiscord<ElegantBeef> Oh wait this doesnt help here
09:13:07FromDiscord<ElegantBeef> I dont have one that generates all field required
09:13:30FromDiscord<ElegantBeef> Although `Awbject.construct(false)` probably should
09:14:19FromDiscord<ElegantBeef> At the very least it's a heavily documented macro doing something very similar to what you want
09:14:34FromGitter<offbeat-stuff> This is super cool
09:16:06FromDiscord<Araq> @mratsim I need a minimal example, once you have the `typedesc` from the NimNode, what are you gonna do with it? You would still be in macro land where everything is NimNodes
09:18:11FromGitter<offbeat-stuff> getTypeImpl(VkApplicationInfo)
09:18:36FromDiscord<ElegantBeef> offbeat i'm going to make a minor change and make a push to support making constructors with the aforementioned syntax if you just want to wait?
09:18:37FromDiscord<ElegantBeef> (edit) "wait?" => "wait"
09:20:54FromGitter<offbeat-stuff> Well I just want getTypeImpl(input) to not return typeDesc[VkApplicationInfo]
09:21:02FromDiscord<ElegantBeef> Ah
09:21:23FromGitter<offbeat-stuff> Can't I do this inside templates
09:21:56FromDiscord<mratsim> sent a code paste, see https://play.nim-lang.org/#ix=2QDq
09:22:03FromDiscord<mratsim> there are types in macros
09:22:42FromDiscord<mratsim> `Foo is var` would be very useful also for closures like in CPS or Weave.
09:24:52FromDiscord<mratsim> or for creating variadic iterators: https://github.com/numforge/laser/blob/master/laser/strided_iteration/foreach_common.nim#L11-L14
09:25:17FromDiscord<mratsim> or I need to drop to quote do: https://github.com/numforge/laser/blob/master/laser/strided_iteration/foreach_common.nim#L62-L66
09:26:07FromGitter<offbeat-stuff> Well This works for me
09:26:08FromGitter<offbeat-stuff> template genC(x: untyped)= โŽ โŽ ```genConstructor(x,getTypeImpl(x))``` [https://gitter.im/nim-lang/Nim?at=60361bb0e0d7284c7355db1f]
09:26:38FromGitter<offbeat-stuff> It passes the getTypeImpl to macro So I am saved kinda
09:29:53*Kiloneie joined #nim
09:30:04*Kiloneie left #nim (#nim)
09:30:18*sepples_ is now known as sepples
09:32:32FromGitter<offbeat-stuff> It's not passing the output of getTypeImpl to the macro
09:36:44FromDiscord<Kiloneie> @Araq Hey!
09:39:16*narimiran quit (Ping timeout: 240 seconds)
09:58:12FromDiscord<dom96> In reply to @Araq "looks like I switched": Yay
09:58:46FromDiscord<Kiloneie> huh, it confused me why why it shown online status
10:01:26FromDiscord<Kiloneie> Do you wanna continue the conversation we had last week @Araq ? im not sure where to message you now xD...
10:01:38FromDiscord<Araq> PM me here
10:08:18FromDiscord<carpal> is Nanos(getTicks) really get nanoseconds?
10:08:28FromDiscord<carpal> (edit) "Nanos(getTicks)" => "Nanos(getTicks())"
10:08:38FromDiscord<carpal> in system/timers
10:13:05FromDiscord<Unaimend> So if I understand sequence correctly, they are continous block of memory is that correct, so when I add an element and the sequence has no space left it has to, in the worst case, reallocate . So my question is how do sequences grow(Linear, or exponential)?
10:13:26FromDiscord<Unaimend> I tried looking at the nim source but could not find it
10:13:33FromDiscord<Araq> factor of 1.5, like God intended
10:13:57FromDiscord<Unaimend> ๐Ÿ˜„ thx
10:15:08FromDiscord<Unaimend> I think Bjarne Stroustrup(guy behind c++) would like to have a word with you, but actually I am pretty sure its implementation defined in c++ ๐Ÿ˜‚
10:15:52FromDiscord<ElegantBeef> I like the premise araq has never heard of the C++ creator until now, it's a good joke ๐Ÿ˜„
10:16:49FromDiscord<Unaimend> I have to admit I don't know who Araq is, should I?
10:17:14FromDiscord<ElegantBeef> He's the creator of this language ๐Ÿ˜„
10:17:41FromDiscord<carpal> In reply to @ElegantBeef "I like the premise": bjarne who? ahahha cit elon musk
10:17:51FromDiscord<Unaimend> Damn it ๐Ÿ˜‚ I had a suspicion, after you mentioned it
10:18:01FromDiscord<Araq> https://github.com/nim-lang/Nim/pull/15251 so be happy, further PRs welcome
10:18:29FromDiscord<Araq> no promises but I'll merge it today if no "important package" disagrees
10:18:39FromDiscord<ElegantBeef> Nice
10:18:44FromDiscord<carpal> huys help me a second, is there a sheet where I cant read the description of each of of these? https://media.discordapp.net/attachments/371759389889003532/814078850945646612/unknown.png
10:18:58FromDiscord<ElegantBeef> https://nim-lang.org/docs/gc.html
10:19:36FromDiscord<carpal> oh thank you so much
10:19:45*abm joined #nim
10:19:56FromDiscord<Unaimend> In reply to @carpal "bjarne who? ahahha cit": ๐Ÿ˜‚ we should as him, what is preferred way of growth is
10:20:42FromDiscord<carpal> wow this is so fast -> gc:markAndSweep
10:21:00*Vladar joined #nim
10:21:42FromDiscord<mratsim> Well referece counting was never known for throughput
10:22:10FromDiscord<ElegantBeef> Nervously looks at the `rc` in orc/arc ๐Ÿ˜›
10:22:35FromDiscord<mratsim> latency, throughput, determinism is a design choice that depends on your application.
10:22:53Oddmongerhow to test if a ref is allocated or not ? if o.myvar == 0 doesn't do it
10:22:59FromDiscord<mratsim> but ORC/ARC throughput was benched vs Boehm/mark-and-sweep at least on tree datastructures
10:23:07FromDiscord<ElegantBeef> `.isNil`
10:23:07FromDiscord<mratsim> == nil
10:23:38Oddmongerah nil
10:23:39Oddmongeromg
10:23:42FromDiscord<Yardanico> `a.isNil and a == nil`
10:23:43Oddmongerthank you
10:23:44FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/814080111007629392/1.png
10:24:03FromDiscord<Yardanico> (edit) "`a.isNil and a == nil` ... " added "(joke)"
10:30:47FromDiscord<Araq> <insert ad for --gc:orc here>
10:33:11FromDiscord<ElegantBeef> Clearly the best ad is just whenever not using orc just get clippy in the compiler output saying "Do you need help? It doesnt look like you're using Orc, you really should"
10:33:18FromDiscord<mratsim> But the compiler doesn't compile with gc:orc :/
10:33:42FromDiscord<Yardanico> shhhh
10:34:09FromDiscord<ElegantBeef> Implementation details
10:35:02FromDiscord<carpal> my rot13 is performed faster with marksweep, is arc faster on long time? marksweep will pause the program to collect the memory right? https://media.discordapp.net/attachments/371759389889003532/814082956200378378/unknown.png
10:35:15FromDiscord<Yardanico> how are you measuring time?
10:35:28FromDiscord<Yardanico> do you do 10k iterations of your code?
10:35:30FromDiscord<carpal> yes, something stupid like that
10:35:34FromDiscord<Yardanico> you can try https://github.com/treeform/benchy
10:35:59FromDiscord<carpal> In reply to @Yardanico "do you do 10k": how many? while i < 10000?
10:36:07FromDiscord<carpal> (edit) "10000?" => "10000: rot13()?"
10:36:19FromDiscord<Yardanico> see benchy
10:36:43FromDiscord<Yardanico> although benchmarking is hard to get right
10:36:43FromDiscord<ElegantBeef> Arc will not always be faster than the other options, isnt this just to be expected depending on their work load
10:36:46FromDiscord<ElegantBeef> (edit) "load" => "load?"
10:37:20FromDiscord<Unaimend> Wouldn't it make sense to have a hash implementation for openArray in the standard?
10:37:20FromDiscord<Araq> @mratsim I'm using Status's codebase to fix orc bugs
10:37:32FromDiscord<Unaimend> (edit) "Wouldn't it make sense to have a hash implementation for openArray in the standard? ... " added "Or am I missing something?"
10:37:44FromDiscord<Araq> not the Nim compiler. though the Nim compiler would be more fun ๐Ÿ˜›
10:40:17FromDiscord<mratsim> In reply to @carpal "my rot13 is performed": why is even the GC a factor? you might just be benching alloc/dealloc speed
10:42:18FromDiscord<PizzaFox> is providing `--passC:-m32 --passL:-m32` still required to make an amd64 linux host compile an i386 linux binary
10:42:25*krux02` joined #nim
10:42:50FromDiscord<Yardanico> of course, that's how you say to the C compiler that you want to compile to i386 instead of amd64 :)
10:42:56FromDiscord<Yardanico> (edit) "of course, that's how you say to the C compiler that you want to compile to i386 instead of amd64 :) ... " added "and also --cpu:i386 of course"
10:43:12FromDiscord<PizzaFox> surely when i pass `--cpu:i386` the nim compiler should just do that for me
10:43:43FromDiscord<Araq> it could do that but nobody ever implemented it
10:43:49FromDiscord<PizzaFox> unfortunate
10:44:02FromDiscord<PizzaFox> the docs also don't mention that passc passl thing either, a 5 year old forum post did
10:44:05FromDiscord<Yardanico> @PizzaFox you can always put those into a .nims or .cfg file
10:44:19FromDiscord<Yardanico> @PizzaFox they do - https://nim-lang.org/docs/nimc.html
10:44:23FromDiscord<PizzaFox> sent a code paste, see https://play.nim-lang.org/#ix=2QDO
10:44:26FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/814085317623283732/unknown.png
10:44:41FromDiscord<PizzaFox> the docs do not tell me i need to specifically pass 32 bit options to gcc
10:45:05FromDiscord<PizzaFox> it was my assumption passing the cpu:i386 flag would set the necessary gcc options for a 32 bit cpu
10:45:13FromDiscord<PizzaFox> cross compilation only mentions mingw for windows
10:45:21FromDiscord<mratsim> PR open to update the docs
10:45:37FromDiscord<Araq> or better implement the logic
10:45:53FromDiscord<Araq> it's a weird omission indeed
10:48:24FromDiscord<haxscramper> What is the state of IC in 1.4.4? Since current compiler is not shipped with it (`Error: the compiler was not built with incremental compilation features; bootstrap with -d:nimIncremental to enable`) I assume it is still too early to try it out, correct?
10:49:14FromDiscord<Araq> https://github.com/nim-lang/Nim/pull/17150 @haxscramper
10:49:29FromDiscord<Araq> the codegen has some weird bug
10:49:34FromDiscord<Unaimend> So is there any way to get the underlying data of an openArray, I need to calculate the hash of the underlying string
10:50:34FromDiscord<Yardanico> iterate over it?
10:50:36FromDiscord<Unaimend> (edit) "string" => "string, so in my case I have `openArray[char]`"
10:50:47FromDiscord<Unaimend> In reply to @Yardanico "iterate over it?": Seems pretty slow
10:51:12FromDiscord<Araq> Nim is not Python, you don't have to avoid basic iterations
10:51:18FromDiscord<Unaimend> I will have to do this for thousands of strings
10:51:54FromDiscord<Unaimend> (edit) "strings" => "strings, more likely ten thousands"
10:51:59FromDiscord<Yardanico> well, that's not a big number
10:52:14FromDiscord<Yardanico> even for `string` hashes just does usual iteration - https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/hashes.nim#L285
10:52:27FromDiscord<Yardanico> nothing magical
10:52:53FromDiscord<mratsim> In reply to @Unaimend "So is there any": any hash worth it's salt work on openarray[byte|char]
10:53:06FromDiscord<mratsim> (edit) "it's" => "its"
10:53:33FromDiscord<Unaimend> In reply to @mratsim "any hash worth its": Inserting in a table does not work at the monent, or I am doing sth. wrong
10:53:35*xet7 quit (Quit: Leaving)
10:53:48FromDiscord<Yardanico> for openarray there's https://nim-lang.org/docs/hashes.html#hash%2CopenArray%5BA%5D
10:53:50FromDiscord<Araq> well... Ihope the backend produces SSE for these things and I'm usually disappointed but still, it's not too bad
10:53:55*xet7 joined #nim
10:54:29FromDiscord<mratsim> SSE only helps if your bottleneck is CPU
10:54:33FromDiscord<mratsim> usually it's memory
10:54:50FromDiscord<mratsim> or IO
10:55:14FromDiscord<Unaimend> In reply to @Yardanico "for openarray there's https://nim-lang.org/docs/has": Ahh I see, thank you. Why does my nim compiler complain when i insert an open array to table ?
10:55:16FromDiscord<mratsim> you can do 4 xor/add/shift/not or whatever in a cycle.
10:55:22FromDiscord<Yardanico> @Unaimend can you show the code and the error?
10:55:24FromDiscord<mratsim> same thing with SSE
10:55:33FromDiscord<Unaimend> In reply to @Yardanico "<@!287576619718279178> can you show": gimme a sec
10:55:56FromDiscord<mratsim> because a Table needs to own its data and openarray is a view to unowned data.
10:56:14FromDiscord<mratsim> openarray as a key is OK, but not as a value.
10:57:03FromDiscord<Unaimend> In reply to @Araq "well... Ihope the backend": I will look into it, I am trying to use Nim instead of C++, and the application has to be pretty fast. A genome assembler should be pretty optimized, since those tools sometimes run for days on "big" computing clusters
10:58:16FromDiscord<Unaimend> In reply to @Yardanico "<@!287576619718279178> can you show": https://play.nim-lang.org/#ix=2QDX
10:58:42FromDiscord<Yardanico> yeah you can only store openArray with experimental:views
10:58:44FromDiscord<mratsim> kMer is a value.
10:58:46FromDiscord<Yardanico> and it's, well, experimental
10:58:58FromDiscord<mratsim> can't be openarray unless what Yardanico says
10:59:00FromDiscord<Yardanico> https://nim-lang.org/docs/manual_experimental.html#view-types
10:59:23FromDiscord<Unaimend> In reply to @Yardanico "and it's, *well*, experimental": I think also my table definition is wrong
10:59:32FromDiscord<mratsim> @Unaimend ask @brentp in the science channel for genomics, if you have specific perf issue you can ask me.
10:59:59FromDiscord<mratsim> https://github.com/brentp
11:00:20FromDiscord<Unaimend> In reply to @mratsim "<@!287576619718279178> ask <@724048650850009190> in": Thanks, will do that. But atm the moment most of my performance issues will probably stem from my bad coding skills in Nim ๐Ÿ™‚
11:00:31FromDiscord<Yardanico> I already linked brentp on a reddit post :P
11:00:41*krux02 quit (Quit: Leaving)
11:00:59FromDiscord<Unaimend> In reply to @Yardanico "yeah you can only": {.experimental: "views".}โ†ตโ†ตI included that
11:01:25FromDiscord<Unaimend> In reply to @Yardanico "I already linked brentp": Yes you did ๐Ÿ˜„
11:01:51*krux02_ joined #nim
11:02:35FromDiscord<mratsim> In reply to @Unaimend "Thanks, will do that.": Regarding string processing, Nim strings have the same caveats as C++ std::string (and no small strng optimizations)
11:02:44FromDiscord<mratsim> so same optimizations apply
11:03:21FromDiscord<Yardanico> heck, only now I realised what question should've been in the survey
11:03:33FromDiscord<Yardanico> "what platform(s) do you talk about nim most frequently?" or something like that
11:03:43FromDiscord<Yardanico> check % of discord/irc/etc users
11:03:53FromDiscord<Yardanico> (edit) ""what platform(s) do you talk about nim ... most" added "on"
11:03:59FromDiscord<Unaimend> In reply to @mratsim "Regarding string processing, Nim": Yeah, I don't think thats a problem for me, since in C++ I only work with views, so I dont have to copy
11:04:19*krux02` quit (Ping timeout: 258 seconds)
11:04:21FromDiscord<mratsim> maybe you can use memfiles if you only need views
11:04:36*krux02``` joined #nim
11:04:37FromDiscord<Araq> I still want COW strings and O(1) slices, it's what people expect nowadays, avoids the "borrowing" aspect that view types imply and isn't compatible with `seq[byte]` but so what
11:06:18FromDiscord<Araq> "can the compiler prove the borrow not to outlive the owner" is a pretty masochistic way of looking at the problem when you can simply keep it alive for as long as required at runtime
11:07:59FromDiscord<Unaimend> So thank for all the help guys, I will try to fix it later. How to learn for university exams ๐Ÿ˜ฆ I would prefer to learn more about Nim. So Cya
11:08:58FromDiscord<carpal> is this called every time the condition is checked? https://media.discordapp.net/attachments/371759389889003532/814091494986219520/unknown.png
11:09:08FromDiscord<carpal> text.len() I mean
11:09:26*krux02``` quit (Ping timeout: 240 seconds)
11:09:27FromDiscord<Yardanico> yes
11:09:42FromDiscord<carpal> but string is a stringbuilder
11:09:43*krux02`` joined #nim
11:09:44FromDiscord<carpal> ?
11:10:05FromDiscord<carpal> so it is not differently by doing let len = text.len() while i < len?
11:12:58ForumUpdaterBotNew thread by Alexeypetrushin: When multiple proc match the call, use the most specific one?, see https://forum.nim-lang.org/t/7553
11:13:09FromDiscord<Yardanico> string has an internal length field, so I'm not sure if storing the value will be faster
11:14:14FromDiscord<carpal> yea, what I was saying
11:16:26*krux02`` quit (Ping timeout: 240 seconds)
11:16:43*krux02` joined #nim
11:21:42*krux02` quit (Ping timeout: 260 seconds)
11:24:36FromDiscord<carpal> compiling to cpp makes problem on my pc https://media.discordapp.net/attachments/371759389889003532/814095429632917504/unknown.png
11:25:22FromDiscord<Yardanico> interesting
11:25:25FromDiscord<Yardanico> do you mind sharing the code?
11:25:38FromDiscord<Yardanico> also -d:release is redundant with -d:danger
11:25:52FromDiscord<Yardanico> (in other words - you don't need to specfiy -d:release when you specify -d:danger)
11:25:53Clonkk[m]Anyone familiar with Zippy knows if there is a way to use ``tarballs.extractAll`` on current directory ?
11:26:23FromDiscord<carpal> In reply to @Yardanico "also -d:release is redundant": mhh, I read in a nim forum post that there was a bug: danger didn't include release, but I think it is fixed now
11:26:35FromDiscord<Yardanico> yes, that post was by me and it's fixed now
11:26:52FromDiscord<carpal> https://play.nim-lang.org/#ix=2QE8
11:26:55FromDiscord<carpal> (edit) "https://play.nim-lang.org/#ix=2QE8" => "<https://play.nim-lang.org/#ix=2QE8>"
11:26:58FromDiscord<Yardanico> @Clonkk for one you can just get current dir and put it as dest
11:26:59FromDiscord<Yardanico> or try "."
11:27:22FromDiscord<Yardanico> @carpal weird, works here
11:27:33FromDiscord<carpal> on the nim playground?
11:27:34FromDiscord<carpal> yes
11:27:36FromDiscord<carpal> on my pc no
11:28:03FromDiscord<Yardanico> works for me on my pc
11:28:09FromDiscord<Yardanico> can you paste the full error somewhere?
11:28:13FromDiscord<Yardanico> e.g. here :)
11:28:15FromDiscord<carpal> yes
11:28:27Clonkk[m]<FromDiscord "<Yardanico> @Clonkk for one you "> Somehow, zippy expects the target directory to not exists so it can create it. But it's weird having a compression uncompression library that can't untar into an existing folder (since the archive already contains a folder)
11:28:34*krux02 joined #nim
11:28:59ForumUpdaterBotNew thread by B3liever: How to move a destructor based object's memory , see https://forum.nim-lang.org/t/7554
11:29:02Clonkk[m]So I'm wondering if there's still a way to trick it without resorting to creating a local folder, untar everything, move everything delete local folder
11:29:28FromDiscord<Yardanico> maybe it's better to just open an issue and/or patch zippy in the meantime? :P
11:29:54Clonkk[m]If there's no solution, then yes
11:30:15FromDiscord<carpal> https://media.discordapp.net/attachments/371759389889003532/814096845247610950/unknown.png
11:30:15Clonkk[m]But I'd rather ask to avoid opening issue that are actually a chair / monitor interface problem
11:30:42FromDiscord<Yardanico> I don't see how it can be solved easily provided zippy explicitly says that the dest folder should not exist
11:30:44FromDiscord<Yardanico> https://github.com/guzba/zippy/blob/master/src/zippy/tarballs.nim#L184
11:30:57FromDiscord<Yardanico> @carpal oh that one is "simple" :)
11:31:05FromDiscord<Yardanico> your C++ compiler's target arch doesn't match your nim's target arch
11:31:12FromDiscord<carpal> arch?
11:31:15FromDiscord<Yardanico> architecture
11:31:18FromDiscord<carpal> ah yesss
11:31:29FromDiscord<carpal> okay so I should download g++ x64
11:31:45FromDiscord<Yardanico> it would be better to do so, yes, but you can also compile to 32-bit
11:31:52FromDiscord<Yardanico> it's better to just download x64 compiler though
11:32:03Clonkk[m]<FromDiscord "<Yardanico> I don't see how it c"> Yes, but why ?
11:32:15FromDiscord<carpal> I try first to compile 32 bit
11:32:22FromDiscord<Yardanico> @Clonkk I have no clue :P
11:32:34FromDiscord<Yardanico> @carpal then pass --cpu:i386 in nim compiler options
11:33:15FromDiscord<Yardanico> also @Clonkk seems like zippy creates a temp folder to unpack files into at first anyway
11:33:19FromDiscord<Yardanico> and then moves that temp dir to the destination
11:33:48Clonkk[m]<FromDiscord "<Yardanico> also @Clonkk seems l"> But then there's no reason to forbid unpacking ito an existing folder ?
11:33:59Clonkk[m]> <@freenode_FromDiscord:matrix.org> <Yardanico> also @Clonkk seems like zippy creates a temp folder to unpack files into at first anyway
11:33:59Clonkk[m] * But then there's no reason to forbid unpacking into an existing folder ?
11:34:14FromDiscord<Yardanico> with how it does things right now there is since it uses `moveDir` (moves the whole directory)
11:34:51Clonkk[m]hmm
11:35:21FromDiscord<Yardanico> so it would either error or your dest will be overwritten (with existing files being deleted or something like that)
11:35:31FromDiscord<Yardanico> it's better to open an issue in zippy for discussion than to ask me honestly :P
11:35:41FromDiscord<Yardanico> heh https://github.com/guzba/zippy/issues/8
11:37:17Clonkk[m]Well I guess it's time to make a PR
11:53:45FromDiscord<Clyybber> In reply to @Araq "no promises but I'll": not a good idea IMO, it should be behind an experimental flag at least I think
12:18:12FromGitter<redblack3_gitlab> Hi again guys. Is there a way to import a module in such a way that all types must be qualified but the procs can be used without qualification? The only way I could think of was import <path>
12:18:28FromGitter<redblack3_gitlab> ...import <path> except <types>
12:18:45FromDiscord<Araq> @Clyybber too late ๐Ÿ™‚
12:20:06FromGitter<redblack3_gitlab> if there was a way to do so without explicitly mentioning all types in the importing module...
12:21:34FromDiscord<Araq> just qualify the types if you feel the need for it
12:24:16FromGitter<redblack3_gitlab> Thanks Araq. Was hoping there was a "you can write a macro for that" response, but ya, looks like I will have to do it that way. Just feels awkward qualifying certain types and not others from the same module based on what how symbols are named in the importing module
12:24:51FromDiscord<Araq> there is nothing awkward about "if ambiguous, resolve the ambiguity"
12:29:11FromGitter<redblack3_gitlab> What about, "if I rename the conflicting type, do I or do I not remove the qualification for the type imported from this other module that doesn't conflict anymore because it doesn't need qualification anymore?" I guess it depends on how you look at it, so no arguments from me. Thanks!
12:36:01*rockcavera joined #nim
12:42:35FromDiscord<Araq> while we avoid conflicts in the stdlib for this reason, in general IMHO it's fine to simply give the types the names that make most sense
12:42:43FromDiscord<Araq> and let the client code use qualifiers or not
12:44:17*narimiran joined #nim
12:47:55*Tanger joined #nim
12:54:56*haxscramper quit (Remote host closed the connection)
12:55:21*haxscramper joined #nim
12:57:18*haxscramper quit (Remote host closed the connection)
13:48:53*lkjasdf joined #nim
14:04:44*asdflkj_ joined #nim
14:27:01*rockcavera quit (Remote host closed the connection)
14:27:33FromDiscord<Araq> https://www.vidarholen.net/~vidar/An_Empirical_Investigation_into_Programming_Language_Syntax.pdf
14:31:23FromDiscord<Araq> summary: '=' for assignment is good, '==' for comparisons is bad, 'and' and 'or' operators are good
14:31:29FromDiscord<zetashift> In this snippet: https://play.nim-lang.org/#ix=2QF0 should I make the `cells` field a TableRef or should I pass the Distances parameter `d` as a `d: var Distances` to add a new entry to the table?
14:32:58FromDiscord<konsumlamm> i'd recommend the latter
14:33:22FromDiscord<zetashift> uh I made a typo in my comment too just noticed
14:33:38FromDiscord<konsumlamm> that way you don't need to allocate on the heap and it also gets harder to accidentally modify your value (because you have to declare it as `var`)
14:33:51FromDiscord<zetashift> alright thank you ๐Ÿ˜„
14:33:58FromDiscord<konsumlamm> and it get's passed by reference either way afaik
14:34:24FromDiscord<Araq> if possible, prefer precise `var` 'ness over `ref`
14:35:07FromDiscord<zetashift> In reply to @konsumlamm "and it get's passed": that's what I thought too but vscode-nim mentions it's a type mismatch if I don't change anything
14:35:38FromDiscord<konsumlamm> what is a type mismatch?
14:35:53FromDiscord<zetashift> I'll go with the `var` and note down to prefer precise `var`ness over ref's
14:36:17FromDiscord<zetashift> In reply to @konsumlamm "what is a type": the expected type didn't match what I was giving it
14:37:59FromDiscord<konsumlamm> because you didn't declare your variable as `var`?
14:39:40FromDiscord<zetashift> yea
14:42:03*waleee-cl joined #nim
14:43:45FromDiscord<Araq> gah, here I am, wondering why bootstrapping is suddenly so slow
14:43:53FromDiscord<Araq> I mistyped 'release'
14:44:22PrestigeDidn't fail from that?
14:45:08*NimBot joined #nim
14:45:14FromDiscord<Araq> it's a --define, they are not checked for typos
14:45:35FromDiscord<Araq> also, the M1 really hates full debug mode
14:47:11FromDiscord<Araq> probably it's AI chip understands that nobody expects a result anytime soon and saves energy aggressively
14:48:49*haxscramper joined #nim
14:53:25PMunchSo because the program isn't going to terminate in the near future the M1 clocks it down? That sounds dubious..
14:53:27*rockcavera joined #nim
14:54:42FromDiscord<mratsim> we prolonged battery by 10 hours ... oh and all computing as well
14:54:59FromDiscord<Araq> I'm not sure but it feels this way
14:57:21FromDiscord<Araq> btw should our generics use `linkonce_odr` ?
14:57:33FromDiscord<Araq> @mratsim any idea?
14:58:19FromDiscord<mratsim> I don't know what linkonce_odr is
14:59:06FromDiscord<mratsim> are you working on LLVM IR generation?
15:01:37FromDiscord<Araq> no but I assume there is a way to access every LLVM feature from C
15:02:05FromDiscord<mratsim> bold assumption
15:06:21*vicfred joined #nim
15:24:05federico3perhaps a --define that is never matched could trigger an error
15:29:01FromDiscord<Unaimend> Where is the difference between `kMerMap: Table[openArray[char], ID]` and `kMerMap: var Table[openArray[char], ID]` . So what das the var mean here?
15:30:31*letto quit (Quit: Konversation terminated!)
15:33:32FromDiscord<Araq> C++'s `&` type
15:34:07FromDiscord<Unaimend> Ahh thanks
15:39:03FromDiscord<Unaimend> So I have to ask, I this the right place to spam all my question because it seems like I have another one every 5 minutes. I already read half of nim in action.
15:40:00FromDiscord<Unaimend> And most of my question are really basic syntactic question, but it seems they were not covered by nim in action until now
15:42:44FromDiscord<Araq> nim in action does not offer a c++ centric view
15:43:49FromDiscord<Araq> we really need a "Nim for C++ programmers"
15:44:14FromDiscord<Araq> I had a slide for it somewhere
15:45:04FromDiscord<mratsim> 1 slide?
15:45:37FromDiscord<Unaimend> In reply to @Araq "nim in action does": I think thats a good thing ๐Ÿ™‚ but atm the moment my head just thinks in c++ and then tries to translate to nim, which probably results in very unidiomatic code
15:45:51FromDiscord<no name fits> Is that why you can get the address of a var with addr but you need unsafeAddr for let?
15:46:43FromDiscord<mratsim> In reply to @no name fits "Is that why you": because an address can be used to mutate the location, and let guarantees that you cannot mutate a location
15:47:02FromDiscord<no name fits> Oh, so it's more a syntactic thing alright. That makes sense
15:47:12FromDiscord<mratsim> if there is mutation we want people to be able to grep for `var` or at least `unsafeSomething`
15:47:50FromDiscord<no name fits> That makes a lot of sense to me
15:48:16FromDiscord<no name fits> Thanks for the asnwer
15:51:27FromDiscord<Unaimend> sent a code paste, see https://play.nim-lang.org/#ix=2QFT
15:51:58FromDiscord<Unaimend> (edit) "https://play.nim-lang.org/#ix=2QFT" => "https://play.nim-lang.org/#ix=2QFU"
15:53:04FromDiscord<no name fits> So is there a suggested way to use let for opaque handles? Like I'm doing graphics for the moment, and there's a lot of "make the variable, pass the addr of the variable to a function to get the handle, use the variable" where I essentially want the variable to be a let (because I don't plan to change a handle once I have it). What I'm doing now is using var. It's just a uint btw
15:54:25FromDiscord<haxscramper> In reply to @Unaimend "so there 3 different": `ref` is `std::shared_ptr<T>` basically - heap-allocated, GC-tracked
15:54:39FromDiscord<haxscramper> `var A` is `T& arg`
15:55:13FromDiscord<haxscramper> Just `T` does not necessarily copy, it if `sizeof(T) > 3 sizeof(float)` then it is passed by reference
15:55:39FromDiscord<Unaimend> In reply to @haxscramper "Just `T` does not": but an immutable reference, I presume?
15:55:44FromDiscord<haxscramper> yes
15:55:52FromDiscord<haxscramper> IIRC for strings copy occurs not when you pass slice to argument, but when you slice string
15:56:05FromDiscord<Unaimend> Thank you very much for using c++ terminology xDD
15:56:48FromDiscord<haxscramper> In reply to @Unaimend "but an immutable reference,": Basically the rule is `arg T` is the same as `const& T` for "large enough" objects
15:56:56narimiran...and be aware that in nim 'float' == 'float64'
15:57:11FromDiscord<Unaimend> sent a code paste, see https://play.nim-lang.org/#ix=2QFW
15:57:44FromDiscord<Unaimend> (edit)
15:58:57FromDiscord<Unaimend> (edit) "https://play.nim-lang.org/#ix=2QFW" => "https://play.nim-lang.org/#ix=2QFY"
15:59:08FromDiscord<haxscramper> You have experimental views enabled? Can you give specific error message and/or source code?
15:59:21FromDiscord<Unaimend> yeah I have
15:59:53FromDiscord<Unaimend> In reply to @haxscramper "You have experimental views": https://play.nim-lang.org/#ix=2QFZ
16:01:15FromDiscord<Unaimend> Is it complaining that the value of kmerL could change under the hood?
16:02:01*hoijui joined #nim
16:04:48FromDiscord<haxscramper> I'm not exactly sure, but you pass `graph` as mutable reference, but `kmerL` as immutable view to a part of mutable (`t.source`) object
16:05:25FromDiscord<haxscramper> And graph might relocate
16:05:42FromDiscord<haxscramper> When you add new element with `[]=`, it might relocate it's contents, making view invalid
16:05:45FromDiscord<haxscramper> In theory
16:05:59*Tanger quit (Remote host closed the connection)
16:06:37FromDiscord<haxscramper> I understand what you want to do here, but not sure now how to do this
16:06:40FromDiscord<Unaimend> Ahh ok, yeah if graph whight relocate that would be a problem
16:06:49FromDiscord<Unaimend> (edit) "whight" => "might"
16:07:36FromDiscord<Unaimend> But why should graph relocate, its size should change?
16:07:52FromDiscord<Unaimend> Or are tables and sequences stored in the memory of graph
16:08:12FromDiscord<haxscramper> You add element to table, which is internally implemented using hashtable, so adding new element might require increasing it's capacity
16:08:26FromDiscord<haxscramper> Do you have your base strings immutable?
16:08:43FromDiscord<haxscramper> And just slice them over and over?
16:09:05FromDiscord<haxscramper> Maybe you can create lightweigh `type MyView` which uses indexes
16:09:11FromDiscord<Unaimend> In reply to @haxscramper "You add element to": Yeah sure, but that should not be a problem
16:09:38FromDiscord<Unaimend> In reply to @haxscramper "Do you have your": no, but I have to read it from user input
16:11:23FromDiscord<Unaimend> In reply to @haxscramper "Do you have your": That only porblem which i could think of is when graph relocates, but since all the variables in graph are data structures which should store there data not in Graph type itself, I think it should work
16:11:31FromDiscord<Unaimend> (edit) "That" => "The" | "porblem" => "problem"
16:12:56FromDiscord<haxscramper> I think this is the case of conservative safety checks where you know it is impossible, but compier does not have enough information to prove that, so it creates error
16:13:15FromDiscord<Unaimend> hmm, that would be quite annoying.
16:17:00FromDiscord<haxscramper> https://play.nim-lang.org/#ix=2QGv
16:17:32FromDiscord<haxscramper> Good thing you can just write custom operators etc. and make custom views feel like completely native type if you need
16:17:48FromDiscord<Unaimend> WOW
16:18:14FromDiscord<Unaimend> Crazy how fast you did that
16:19:22FromDiscord<haxscramper> (edit) "https://play.nim-lang.org/#ix=2QGz" => "https://paste.rs/gSg"
16:19:24FromDiscord<haxscramper> sent a code paste, see https://paste.rs/QgK
16:19:25FromDiscord<Unaimend> Thanks man, thats was way to friendly and helpfull ๐Ÿ™‚
16:37:10FromDiscord<Unaimend> In reply to @haxscramper "I think this is": Works like a dream, now have to make is as fast as possible
16:42:10*letto joined #nim
17:03:10FromDiscord<Unaimend> In reply to @haxscramper "Also you can add": There seems to be a problem with the hash function it always returns 0
17:05:23FromDiscord<haxscramper> Looks like you got reversed indices: `i, (i-1)+(kmerLength-1)`, so `for` loop in hash function does not iterate over anything
17:05:42FromDiscord<Unaimend> yes, already changed a few things
17:06:44FromDiscord<Unaimend> because toOpenArray, worked a little bit different then your view, but I prefer yours, since its more like c++
17:07:02FromDiscord<Unaimend> An ind my opinion more usefull in this way
17:08:31FromDiscord<Unaimend> Nvm, I just failed sth
17:10:06FromDiscord<Unaimend> Your implementation is totally correct
17:17:57*zedeus quit (Ping timeout: 264 seconds)
17:19:26*zedeus joined #nim
17:32:53*sacredfrog quit (Quit: ZNC 1.8.2 - https://znc.in)
17:33:33*sacredfrog joined #nim
17:38:28FromDiscord<Bimbo> Hello everyone, how to i go about unzipping a compressed page that i fetch with httpclient in nim? I noticed that some pages return a binary stream that needs to be unzipped.
17:39:11FromDiscord<exelotl> maybe you could use https://github.com/guzba/zippy ?
17:40:27FromDiscord<Bimbo> i'll try it, thanks!
17:43:32FromDiscord<exelotl> I haven't used it myself but I've heard it's very good :)
17:44:41FromDiscord<Bimbo> it seems to have what i need, will try it and see
17:48:13FromDiscord<exelotl> In reply to @mratsim "if there is mutation": I don't really get this, if you're using `unsafeAddr` then you shouldn't be mutating anything, so grepping for "unsafe" won't help
17:48:34FromDiscord<mratsim> "should" != can
17:49:04FromDiscord<mratsim> we've had a recent issue with lent iterators where users could mutate the immutable sequence being iterated on.
17:50:58FromDiscord<exelotl> oh right, so unsafeAddr having a unique name makes it easy to find accidental misuses of it?
17:53:32FromDiscord<mratsim> yes
17:56:53FromDiscord<exelotl> I personally find `unsafeAddr` strange because `addr` is already unsafe - I don't get why an "I know what I'm doing" feature sometimes needs to be replaced with a "no, trust me I _really_ know what I'm doing" feature
17:57:44FromDiscord<haxscramper> `addr` is a perfectly reasonable feature to use
17:57:57FromDiscord<haxscramper> `unsafeAddr` is a violation of compiler-enforced guarantees
17:58:19FromDiscord<haxscramper> Like `{.cast(noSideEffect).}` it is ugly because you can lie to compiler
17:59:52liblq-devaddr is so reasonable and safe in fact, that you can do this https://play.nim-lang.org/#ix=2QHq
18:01:03FromDiscord<exelotl> _playground catches fire_
18:03:44FromDiscord<zetashift> Is there an easy way to convert a integer to a base36 string?
18:04:44FromDiscord<no name fits> Is the main difference between Table and TableRef where it's allocated?
18:05:18FromDiscord<zetashift> it's one of it, it's differences are the same as a `object` vs `ref object`
18:05:32FromDiscord<no name fits> Right, thanks
18:05:35FromDiscord<zetashift> but yea practically speaking just where it's allocated
18:05:45FromDiscord<no name fits> You guys are all so helpful
18:07:03FromDiscord<zetashift> In reply to @zetashift "Is there an easy": well not a string, but I want to encode an integer as a base36 integer
18:07:48FromDiscord<haxscramper> There is no built-in facility for that in stdlib AFAIC
18:11:24FromDiscord<zetashift> yea, nimble.directory also not giving much, might just make my own proc
18:14:10FromDiscord<Yardanico> base36 is quite easy
18:16:00FromDiscord<Yardanico> Not the fastest but was enough for me :)
18:16:11FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2QHz
18:16:17FromDiscord<Yardanico> need strutils and algorithm
18:16:24FromDiscord<Yardanico> Also math
18:16:50FromDiscord<zetashift> yet here I am trying to figure out base36 exactly hahahaha
18:16:56FromDiscord<zetashift> thanks a lot @Yardanico !
18:18:25FromDiscord<konsumlamm> should probably just implement a `toBaseN`
18:22:13FromDiscord<Yardanico> Ah sorry replace s.reverse() with s.reversed()
18:22:54FromDiscord<haxscramper> Why not just add to `result` and `reverse` in-place
18:23:14*hoijui quit (Ping timeout: 258 seconds)
18:25:20FromDiscord<Yardanico> Yes I know, this is quite old code
18:25:43FromDiscord<Yardanico> And I'm from the phone to fix all the inefficiencies hence I said that it's not the fastest :P
18:28:16FromDiscord<zetashift> sent a code paste, see https://paste.rs/AjA
18:28:25FromDiscord<zetashift> I cut out the suggestions of what it expected it was a long list
18:28:52FromDiscord<no name fits> I don't mean to interrupt, but how do I fix:โ†ต``Hint: D:\source\LearningExamples\nim-challenge\nim\word-count\test_word_count.exe [Exec]โ†ตcould not load: pcre64.dll``?
18:29:07FromDiscord<zetashift> did you get all the dll's from the Nim site?
18:29:19FromDiscord<Yardanico> ooh sorry again
18:29:24FromDiscord<no name fits> I just got Nim via Scoop
18:29:46FromDiscord<Yardanico> @zetashift const Digits = "0123456789abcdefghijklmnopqrstuvwxyz"
18:29:47FromDiscord<zetashift> https://nim-lang.org/download/dlls.zip unzip these where your `nim.exe` resides
18:30:03FromDiscord<no name fits> Alright, is there a way I can automate that for the future?
18:30:52FromDiscord<zetashift> Erhm you could write a powershell script, or use `choosenim` https://github.com/dom96/choosenim#choosenim that does everything for you
18:31:25FromDiscord<no name fits> thanks!
18:31:30FromDiscord<KnorrFG> ` Error: type mismatch: got <proc (a: ptr AreaHandler, area: ptr Area, p: ptr AreaDrawParams){.cdecl, noSideEffect, gcsafe, locks: 0.}> but expected 'proc (a2: ptr AreaHandler, a3: ptr Area, a4: ptr AreaDrawParams){.cdecl.}'` The difference is in the pragmas. Can I do something about that?
18:32:41FromDiscord<haxscramper> @zetashift https://play.nim-lang.org/#ix=2QHJ
18:32:48FromDiscord<no name fits> Just curious, but who maintains the Scoop and Chocolatey versions? I know my friends would look on those first to try out Nim. I don't mind helping if I can
18:32:50FromDiscord<haxscramper> @Yardanico already answered but still
18:33:50FromDiscord<zetashift> @haxscramper thanks very much still it's nice to see such awesomeness anyway
18:33:57FromDiscord<haxscramper> In reply to @haxscramper "<@!77574388035100672> https://play.nim-lang.org/#ix": Sad that `const digits = @('a' .. 'z')` does not work and I need `toSeq`
18:34:09FromDiscord<haxscramper> `@` is not overloaded for slice
18:34:25FromDiscord<no name fits> Oh hey that's the same error I had a few days ago ๐Ÿ˜›
18:34:29FromDiscord<no name fits> You even helped me with it
18:36:40FromDiscord<zetashift> In reply to @no name fits "Just curious, but who": I have no idea who maintains it, but they might Scoop/Choco people might be open for PR's anyway?
18:37:12FromDiscord<no name fits> I have no idea how to suggest PRs for either though, but I guess I could figure it out
18:38:46FromDiscord<Unaimend> Does a Table allow for a key to exist more then one time
18:38:50FromDiscord<Unaimend> (edit) "time" => "time?"
18:38:53FromDiscord<zetashift> You could make an issue than saying for windows Nim needs those dll's and if there is anyway to extract add it to the install
18:39:23FromDiscord<zetashift> In reply to @Unaimend "Does a Table allow": It does not, keys are based on hashed values and they cannot be included twice
18:40:00*PMunch quit (Quit: leaving)
18:40:20FromDiscord<haxscramper> In reply to @Unaimend "Does a Table allow": Technically yes, but this behavior is deprecated
18:40:30FromDiscord<haxscramper> https://forum.nim-lang.org/t/7135
18:40:34FromDiscord<Unaimend> In reply to @zetashift "It does not, keys": sent a code paste, see https://paste.rs/cZB
18:41:04FromDiscord<Unaimend> (edit) "https://play.nim-lang.org/#ix=2QHP" => "https://play.nim-lang.org/#ix=2QHO"
18:41:36FromDiscord<Unaimend> (edit) "https://play.nim-lang.org/#ix=2QHO" => "https://play.nim-lang.org/#ix=2QHQ"
18:41:49FromDiscord<haxscramper> I would advise storing `seq` as value, or maybe cooking up something with `array` if you want to store everything continuously in memory
18:42:20FromDiscord<Unaimend> In reply to @haxscramper "I would advise storing": No, a hash table is quite fine, but as you can see mine stored the same key twitch without using .add()
18:43:18FromDiscord<Unaimend> (edit) "twitch" => "twice"
18:44:03FromDiscord<Unaimend> I can show you the whole code, but this is the only place where I add sth. to the table
18:44:58FromDiscord<Araq> table's add is deprecated
18:45:25FromDiscord<Araq> instead use a `seq` for the value type and `t.mgetOrPut(k, @[]).add v`
18:45:51FromDiscord<Unaimend> So is []= also depecated?
18:45:57FromDiscord<haxscramper> no
18:46:04FromDiscord<Araq> no but that overwrites the old k, v pair
18:46:13FromDiscord<Unaimend> Thats exactly what I want
18:46:19FromDiscord<Araq> (just like in every other PL that I know of)
18:47:18FromDiscord<Unaimend> Yes, thats why I am so confused. I even do a check if the key exits and only add if it doesnt, but they key still appears two times in my output
18:47:51FromDiscord<Unaimend> In reply to @Araq "no but that overwrites": sent a code paste, see https://play.nim-lang.org/#ix=2QHS
18:47:53FromDiscord<Unaimend> Or is there anything wrong with this code
18:48:02FromDiscord<Araq> do not use `add`
18:48:16FromDiscord<Unaimend> the does not operate on the table
18:48:18*abm quit (Read error: Connection reset by peer)
18:48:20FromDiscord<Unaimend> (edit) "the ... does" added "add"
18:48:41FromDiscord<Unaimend> edgesIn and edgesOut are Seq[T]
18:49:01FromDiscord<Unaimend> and kmers is also Seq[T]
18:49:54FromDiscord<Unaimend> I am using []= for the table
18:50:02FromDiscord<Araq> I don't understand your problem then, sorry
18:50:19FromDiscord<Araq> probably some logic bug here, not an API usage bug
18:51:01FromDiscord<Unaimend> But how could a logic bug results in a table which has the same key twice when I am never using the add method for tables(I have to check that)
18:51:04FromDiscord<haxscramper> In reply to @Unaimend "I can show you": Show the full code
18:51:22FromDiscord<zetashift> sent a code paste, see https://play.nim-lang.org/#ix=2QHT
18:52:14FromDiscord<KnorrFG> sent a long message, see http://ix.io/2QHU
18:52:42FromDiscord<Unaimend> In reply to @haxscramper "Show the full code": https://play.nim-lang.org/#ix=2QHV
18:52:46FromDiscord<Unaimend> In reply to @zetashift "So if you ```for": yes
18:53:10FromDiscord<Araq> @KnorrFG and which pragmas would that be?
18:53:20FromDiscord<Unaimend> In reply to @zetashift "So if you ```for": Its highly likely that I am doing sth really stupid here, but who knosw
18:53:24FromDiscord<Unaimend> (edit) "knosw" => "knows"
18:53:30FromDiscord<KnorrFG> In reply to @Araq "<@!689821975463460892> and which pragmas": noSideEffect, gcsafe, and locks: 0 id say
18:53:49FromDiscord<KnorrFG> thats the only difference I can see
18:53:57FromDiscord<Unaimend> In reply to @haxscramper "Show the full code": AGGCCCTGAAGC test string
18:54:09FromDiscord<Araq> @KnorrFG worth a try
18:54:31FromDiscord<Araq> I would keep the `gcsafe` though
18:54:47FromDiscord<no name fits> sent a code paste, see https://play.nim-lang.org/#ix=2QHX
18:55:22FromDiscord<Unaimend> In reply to @haxscramper "Show the full code": https://play.nim-lang.org/#ix=2QHV Full example
18:55:26FromDiscord<Unaimend> In reply to @zetashift "So if you ```for": https://play.nim-lang.org/#ix=2QHV
18:55:35FromDiscord<KnorrFG> In reply to @Araq "<@!689821975463460892> worth a try": sent a code paste, see https://play.nim-lang.org/#ix=2QHY
18:55:59FromDiscord<KnorrFG> (edit) "https://play.nim-lang.org/#ix=2QHY" => "https://play.nim-lang.org/#ix=2QHZ"
18:55:59FromDiscord<Araq> @KnorrFG by editing the ui.nim?
18:56:14FromDiscord<Araq> you can also do
18:56:30FromDiscord<Unaimend> @haxscramper Maybe its some bug with references or sth like that?
18:56:58FromDiscord<no name fits> I get the same error on the playground <https://play.nim-lang.org/#ix=2QI0> (sorry for interrupting)
18:57:03FromDiscord<KnorrFG> the function that the compiler got is the draw-proc i defined. I only added the .cdecl. but the compiler says it has all these other pragmas too
18:57:05FromDiscord<haxscramper> In reply to @Unaimend "<@!608382355454951435> Maybe its some": Doubt it
18:57:06FromDiscord<Araq> proc draw(a: ptr AreaHandler, area: ptr Area, p: ptr AreaDrawParams) {.cdecl.} = โ†ต {.cast(noSideEffect).}:โ†ต if result.onDraw != nil:
18:57:35FromDiscord<Araq> (edit) "{.cdecl.}" => "{.cdecl, noSideEffect.}"
18:58:02FromDiscord<Solitude> In reply to @no name fits "From <https://nim-lang.org/docs/unicode.html#split.": that example is a lie, probably copypasted from strutils
18:58:06FromDiscord<konsumlamm> can the contents of a `StrView` change? if so, their hash probably changes which breaks the tabe
18:58:16FromDiscord<Unaimend> In reply to @konsumlamm "can the contents of": good idea
18:58:27FromDiscord<konsumlamm> table
18:58:37FromDiscord<no name fits> In reply to @Solitude "that example is a": Oh ok, so do I make a PR about it or how do I help?
18:59:15FromDiscord<Unaimend> In reply to @konsumlamm "can the contents of": But I am pretty sure there is no reallocation of the string to which the string view points
18:59:33FromDiscord<Solitude> In reply to @no name fits "Oh ok, so do": if you want to help, yeah, proper example would be alright
18:59:33FromDiscord<konsumlamm> doesn't need to be a reallocation, strings are mutable
18:59:44FromDiscord<Solitude> In reply to @no name fits "From <https://nim-lang.org/docs/unicode.html#split.": https://nim-lang.org/docs/strutils.html#split.i%2Cstring%2Cset%5Bchar%5D%2Cint literally same thing
18:59:48Oddmongeris there a faster way to copy a pointed object in an object, than doing this member by member ?
18:59:48FromDiscord<Unaimend> In reply to @konsumlamm "doesn't need to be": Yea, I dont change that string
18:59:58FromDiscord<no name fits> In reply to @Solitude "if you want to": I'm not sure what a proper example would be though. I'm still a beginner, sorry
19:00:09FromDiscord<KnorrFG> In reply to @Araq "proc draw(a: ptr AreaHandler,": I forgot to edit the error message after editing the code. currently it looks like this: ` Error: type mismatch: got <proc (a: ptr AreaHandler, area: ptr Area, p: ptr AreaDrawParams){.cdecl, locks: <unknown>.}> but expected 'proc (a2: ptr AreaHandler, a3: ptr Area, a4: ptr AreaDrawParams){.cdecl.}'` so there is only this locks: <unknown> which is too much. but that does not disappear if
19:00:22FromDiscord<Unaimend> In reply to @konsumlamm "doesn't need to be": At least not intentionally
19:00:50FromDiscord<Araq> @KnorrFG please report an issue on the ui repo with a minimal example
19:01:01FromDiscord<konsumlamm> In reply to @Solitude "https://nim-lang.org/docs/strutils.html#split.i%2Cs": it says `set[char]` in the functiond eclaration though?
19:01:19FromDiscord<Araq> I'm sure it's easy but via the chat here it's hard to help you
19:01:22*Jesin quit (Quit: Leaving)
19:01:24FromDiscord<Solitude> In reply to @konsumlamm "it says `set[char]` in": ?
19:01:53FromDiscord<KnorrFG> In reply to @Araq "I'm sure it's easy": ok
19:02:34FromDiscord<konsumlamm> oh, you just wanted to prove that the example was copied, nvm
19:02:58FromDiscord<zetashift> In reply to @no name fits "I'm not sure what": you can open up an issue https://github.com/nim-lang/Nim/issues and see if people can give tips, in Discord it's hard to explain stuff like this
19:03:32FromDiscord<no name fits> In reply to @zetashift "you can open up": Alright thanks. I'm just afraid to do something wrong because I'm still a beginner
19:03:38FromDiscord<Unaimend> In reply to @haxscramper "Doubt it": So should I commit an issue?
19:04:16FromDiscord<zetashift> In reply to @no name fits "Alright thanks. I'm just": Same! But can't learn if you don't get a lil' bit out of your comfort zone, and things won't suddenly break haha
19:04:55FromDiscord<konsumlamm> In reply to @Unaimend "So should I commit": i think you should try to find a more minimal example first and make sure it's not a bug in your program logic
19:05:14FromDiscord<Unaimend> In reply to @konsumlamm "i think you should": yeah, ofc
19:05:32FromDiscord<haxscramper> In reply to @Unaimend "So should I commit": https://play.nim-lang.org/#ix=2QI5 I'm not sure if it was the reason or not, but you had your indices reversed, and `..` does not work fore reversed integers correctly. I added `$` overload so views are shown correctly (along with some helper iterator overloads etc).
19:06:06FromDiscord<haxscramper> Not sure if it fixed the issue at hand really, and I don't know if this exception for indices is my fault, or there is some index miscalculation going on
19:06:48FromDiscord<haxscramper> Considering there was a `-1` index it is probable there is a logic error (because it would index outside the base string, which is really odd)
19:06:50FromDiscord<Unaimend> In reply to @haxscramper "Not sure if it": build does not work for 0
19:08:16FromDiscord<Unaimend> In reply to @haxscramper "https://play.nim-lang.org/#ix=2QI5 I'm not sure": if you call discard build("AGGCCC", 2) there no out of bounds error, but still repeated keys
19:08:35FromDiscord<haxscramper> https://play.nim-lang.org/#ix=2QI8 < basic example on `add` vs `[]=`
19:08:46FromDiscord<haxscramper> `add` duplicates, `[]=` does not
19:09:08FromDiscord<Unaimend> yeah, Araq already told me that
19:09:11FromDiscord<haxscramper> If you could minimize your example it is possible there is a bug
19:09:25FromDiscord<Unaimend> Yeah will work on that
19:10:28*Jesin joined #nim
19:10:43FromDiscord<haxscramper> In reply to @Unaimend "if you call discard": sent a code paste, see https://play.nim-lang.org/#ix=2QIc
19:10:55FromDiscord<haxscramper> yes, duplicate
19:11:08FromDiscord<Unaimend> In reply to @haxscramper "Final table shows ": yes
19:11:15FromDiscord<Noobi> Which editors or IDEs do you recommend for Nim?
19:11:33FromDiscord<zetashift> In reply to @Noobi "Which editors or IDEs": VSCode or Vim
19:11:47FromDiscord<zetashift> or IntelliJ if you fancy that their support got better too
19:12:08FromDiscord<no name fits> @zetashift Well I did this <https://github.com/nim-lang/Nim/issues/17174> and I don't know if it's correct and I'm so afraid to be a bother <:ferris_sweat:794274494612111371>
19:12:52*zedeus quit (Ping timeout: 260 seconds)
19:13:20*lkjasdf quit (Ping timeout: 260 seconds)
19:13:50FromDiscord<zetashift> It's okay! The Nim community doesn't bite, people can look at it now and if possible add some nice feedback to it ๐Ÿ˜„
19:13:51FromDiscord<konsumlamm> In reply to @haxscramper "Final table shows ": that's only a hash collision though, not a duplicate element, isn't it?
19:14:21FromDiscord<haxscramper> In reply to @konsumlamm "that's only a hash": `[]=` should override elements with the same hash
19:14:24FromDiscord<konsumlamm> In reply to @no name fits "<@!77574388035100672> Well I did": you didn't think about the title, did you xd
19:14:32FromDiscord<konsumlamm> In reply to @haxscramper "`[]=` should override elements": wat
19:14:33FromDiscord<no name fits> omg I forgot that was a thing
19:14:40FromDiscord<konsumlamm> that's not how hashtables usually work
19:14:48FromDiscord<Unaimend> In reply to @konsumlamm "that's not how hashtables": not?
19:14:54FromDiscord<haxscramper> why&
19:14:56FromDiscord<haxscramper> (edit) "why&" => "why?"
19:14:57FromDiscord<konsumlamm> umm
19:15:03FromDiscord<no name fits> I changed it, thanks
19:15:13FromDiscord<konsumlamm> why would that ever be desirable?
19:15:32FromDiscord<konsumlamm> what if two elements happen to have the same hash?
19:15:42FromDiscord<haxscramper> In reply to @haxscramper "https://play.nim-lang.org/#ix=2QI8 < basic example": @konsumlamm just to clarify - we are talking about behavior of `[]=` in this example
19:16:09FromDiscord<haxscramper> If I do `[20] = 200` and then `[20] = 120` I expect it to override the value secon time
19:16:20FromDiscord<Unaimend> Thats exactly how dictionarys in python and maps in c++ works
19:16:21FromDiscord<konsumlamm> the normal `[]=` for tables, right?
19:16:23FromDiscord<haxscramper> Provided `20` has the same hash, which is does
19:16:34FromDiscord<konsumlamm> In reply to @Unaimend "Thats exactly how dictionarys": no, it's not
19:16:37FromDiscord<mratsim> In reply to @konsumlamm "what if two elements": use a better hash
19:16:50FromDiscord<konsumlamm> unless i'm misunderstanding you somehow
19:16:58FromDiscord<haxscramper> In reply to @mratsim "use a better hash": We literally have identical objects
19:17:07FromDiscord<haxscramper> `"CC" == "CC"`
19:17:08FromDiscord<KnorrFG> In reply to @Araq "I'm sure it's easy": sent a code paste, see https://play.nim-lang.org/#ix=2QIj
19:17:14FromDiscord<konsumlamm> hear me out
19:17:46FromDiscord<konsumlamm> the `StrView` object consists of two `int`s and a pointer
19:18:00FromDiscord<konsumlamm> and those are all compared, since `==` isn't overridden
19:18:18FromDiscord<haxscramper> oh
19:18:22FromDiscord<haxscramper> sht
19:18:31FromDiscord<konsumlamm> so if the "string slice" is equal, but the subslice is from different parts of the strings, they don't compare equal
19:18:36FromDiscord<konsumlamm> but their hashes are equal
19:18:42FromDiscord<haxscramper> yes i got used to errors with discimitant objects and forgot to override `==`
19:18:52FromDiscord<haxscramper> ye ye
19:18:55FromDiscord<Unaimend> Yeah that seems to be the problem
19:18:58FromDiscord<haxscramper> I just forgot about collutions resolution
19:19:18FromDiscord<mratsim> but you should hash the bounds as well
19:19:22FromDiscord<Araq> so once again system.`==` for objects that guesses the semantics is wrong
19:19:36FromDiscord<konsumlamm> yep
19:19:38FromDiscord<Araq> I will keep it in mind
19:19:44FromDiscord<konsumlamm> how did you get the idea that tables should treat elements with the same hash equal?
19:19:52FromDiscord<Araq> and ping @timotheecour
19:20:22FromDiscord<mratsim> I'm missing something. How can you have start, stop and pointer being the same and the subslice being different?
19:20:52FromDiscord<konsumlamm> (that was actually my second guess after the element being mutated, i just assumed it wasn't a problem because the default `==` is consistent with the `hash` implementation)
19:21:11FromDiscord<Unaimend> ok, so I am out of the loop
19:21:14FromDiscord<konsumlamm> In reply to @mratsim "I'm missing something. How": you can't
19:21:35FromDiscord<konsumlamm> the problem is that the hashes can be equal, when the objects arent
19:21:44FromDiscord<konsumlamm> so they thought that there are duplicate keys
19:22:03FromDiscord<konsumlamm> when the `==` implementation was just not what they expected
19:22:08FromDiscord<haxscramper> https://play.nim-lang.org/#ix=2QIm
19:22:13FromDiscord<mratsim> the hashes can be equal sure, but the chance of collision should be very low.
19:22:21FromDiscord<mratsim> ah it's ==
19:22:51FromDiscord<haxscramper> In reply to @mratsim "the hashes can be": yes, but we got two objects that were visually equal (`$` operator) and it was confusing as hell
19:23:06FromDiscord<haxscramper> And I forgot about `==`
19:23:14FromDiscord<mratsim> so it's not system.== faults either
19:23:18FromDiscord<Unaimend> Yeah, "CC" == "CC" but the underlying data was different, i.e start and stop
19:23:21FromDiscord<Unaimend> In reply to @mratsim "so it's not system.==": no
19:23:35FromDiscord<mratsim> it's ref vs value semantics
19:23:53FromDiscord<Unaimend> I all behaved exactly as it should as always if one suspects a "compiler" error
19:23:59FromDiscord<Unaimend> ๐Ÿ˜‚
19:24:02FromDiscord<mratsim> you were doing == with value semantics and expecting hash with ref semantics
19:24:50FromDiscord<Unaimend> But I am still a little bit confused
19:24:52FromDiscord<zetashift> Mystery solved
19:25:02FromDiscord<konsumlamm> so does it work now?
19:25:15FromDiscord<haxscramper> In reply to @haxscramper "https://play.nim-lang.org/#ix=2QIm": By the way @Unaimend I had to throw in quite a few iterators and overloads for operators etc (`len`, `items`, `[]`, `$`, but when dealing with custom types it is just very useful to have around (instead of using `x.base[x.start .. x.finish]` which might be specifically misleading))
19:25:45FromDiscord<haxscramper> And also double-check whatever I've done with indices there - I don't know the algorithm so there might be a lot of mistakes
19:25:49FromDiscord<Unaimend> In reply to @haxscramper "By the way <@!287576619718279178>": yeah will have a look at it, this x.base[x.start .. x.finish] bugged me as well ๐Ÿ˜„
19:27:02FromDiscord<Unaimend> Thank you all for your help, but I have one question left. It seems that my understandig of hash tables must be wrong. So I we compare keys in the hash table by there hash, correct?
19:27:43FromDiscord<konsumlamm> not quite
19:28:21FromDiscord<konsumlamm> two objects with the same hash can still be unequal
19:28:29FromDiscord<konsumlamm> and a hash table considers them unequal
19:28:49FromDiscord<Unaimend> ahh ok, so the comparision is not based on the hash but on `==`
19:29:01FromDiscord<konsumlamm> well, it's based on both
19:29:38FromDiscord<konsumlamm> since equal objects must have equal hashes, usually you first compare the hashes and only if they're equal, you also compare the objects themselves
19:30:02FromDiscord<Unaimend> In reply to @haxscramper "By the way <@!287576619718279178>": Tomorrow I have to clean up this mess, which some would call code ๐Ÿ™‚
19:30:09FromDiscord<konsumlamm> and the hash is also used to determine where in the table to store the element
19:30:17FromDiscord<Unaimend> In reply to @konsumlamm "since equal objects must": Ahh ok
19:30:46FromDiscord<Unaimend> My data structures professor would kill me right now
19:30:47FromDiscord<konsumlamm> however, if there is a hash collision, i.e. two hashes are equal, but the objects aren't, you need to account for that somehow
19:31:12FromDiscord<Unaimend> I dont know why, but I just assumed we compare the hashes and thats it
19:31:54FromDiscord<konsumlamm> now you learned something :)
19:32:38FromDiscord<Unaimend> yeah, thanks for the explanation
19:33:00FromDiscord<Unaimend> Thats the problem if all the examples were only based on integers
19:33:02FromDiscord<mratsim> comparing hashes then objects is wasteful
19:33:08FromDiscord<mratsim> especially on big objects
19:33:33FromDiscord<mratsim> you should use a robust hash function so that chances of collision are probabilistically very low.
19:33:34FromDiscord<Unaimend> In reply to @mratsim "especially on big objects": yeah, thats why I thought one would not do that
19:33:53FromDiscord<mratsim> pretty sure most hash table don't do hash then equal
19:35:58*superbia joined #nim
19:36:32*hoijui joined #nim
19:36:34FromDiscord<Unaimend> But I think it makes sense when you have a collision
19:36:41FromDiscord<Unaimend> And I am pretty sure thats what nim does
19:37:04FromDiscord<Unaimend> But it's a good point for optimization
19:37:20FromDiscord<mratsim> as I said, use a better hash function
19:37:29FromDiscord<mratsim> or hash to 128 bits
19:37:42FromDiscord<Unaimend> pretty sure the nim implemenation will be quite fine
19:37:58FromDiscord<Unaimend> I actually dont care if there are a few collisions
19:38:04FromDiscord<mratsim> I mean for those worried about hash collision
19:38:09FromDiscord<Unaimend> Yeah
19:38:12*hoijui quit (Remote host closed the connection)
19:38:51FromDiscord<PizzaFox> how can i a compile a static binary with ssl support
19:39:05FromDiscord<PizzaFox> gettingโ†ต> could not load: libcrypto.so(.1.1|.1.0.2|.1.0.1|.1.0.0|.0.9.9|.0.9.8|.48|.47|.46|.45|.44|.43|.41|.39|.38|.10|)โ†ต> (compile with -d:nimDebugDlOpen for more information)โ†ตin my docker container
19:42:35FromDiscord<PizzaFox> found a related blog post thing https://zws.im/โ€๓ ฉ๓ ช๓ ซ๓ ฃ๓ ฃ๓ จ
19:42:54FromDiscord<PizzaFox> is `nim musl` even a command????
19:43:07FromDiscord<Rika> you can make it a command
19:43:26FromDiscord<Rika> given the config.nims that is mentioned and linked
19:43:28FromDiscord<PizzaFox> a
19:44:36*liblq-devel joined #nim
19:44:36*liblq-devel quit (Client Quit)
19:47:58giacothe more I try to learn nim, the more I feel that I have to rewire my brain to leverage the extensive type system that nim offers, but I tend to find clever uses of it only occasionally, watching youtube videos or shuffling examples online. Is there a tip&tricks section for nim?
19:53:40FromDiscord<PizzaFox> sent a code paste, see https://play.nim-lang.org/#ix=2QIs
19:54:11FromDiscord<PizzaFox> same error about libcrypto
19:54:33FromDiscord<Araq> static with openssl? recipe for a security desaster
19:54:47FromDiscord<PizzaFox> how
19:54:53FromDiscord<PizzaFox> > Static linking is terrible for security when software is deployed by users or other organizations.
19:54:58FromDiscord<PizzaFox> same blog post has this in comments
19:54:58FromDiscord<PizzaFox> sad!
19:55:13FromDiscord<PizzaFox> https://zws.im/๓ ฟ๓ ฉ๓ ก๓ ฒ๓ ญ๓ ฅ๓ ฑ
19:55:28FromDiscord<PizzaFox> to be fair this docker image is for a cli to shorten urls
19:55:53FromDiscord<Araq> ever considered that your OS defaults are not from hell?
19:56:00FromDiscord<PizzaFox> what os
19:56:04FromDiscord<PizzaFox> i am using docker's `scratch`
19:56:27FromDiscord<Araq> shrug
19:56:33FromDiscord<PizzaFox> https://docs.docker.com/develop/develop-images/baseimages/#create-a-simple-parent-image-using-scratch
19:56:46FromDiscord<Araq> I don't know docker
19:56:53FromDiscord<PizzaFox> you don't have to
19:57:07FromDiscord<PizzaFox> it's simply a linux environment where i have to statically link everything
19:57:13FromDiscord<PizzaFox> including ssl
19:57:33FromDiscord<Araq> I thought it's packaging the kernel with the libs and your app
19:57:58FromDiscord<PizzaFox> uh
19:58:03FromDiscord<PizzaFox> docker containers don't have kernels
19:58:43FromDiscord<PizzaFox> sent a code paste, see https://paste.rs/8gO
19:58:43FromDiscord<PizzaFox> this is either `scratch` or `busybox` i forget
20:01:18FromGitter<timotheecour> > *<FromDiscord>* <Araq> so once again system.`==` for objects that guesses the semantics is wrong โŽ โŽ @araq what was exact problem again? not clear from reading above discussion
20:04:12FromGitter<timotheecour> guess Iโ€™ll make a PR so we can discuss it there instead
20:04:31FromDiscord<Araq> the programmer needed a custom `==` but forgot to write it
20:04:37FromDiscord<Araq> and system.== filled the void
20:10:04*aeverr left #nim ("Konversation terminated!")
20:10:28FromGitter<timotheecour> seems like a layer 8 error
20:11:43FromDiscord<haxscramper> Not sure how I really feel about this, but I suppose implicitly guessing behavior is worse than making people write custom `==`. For large objects are is basically useless anyway (how often there is a meaningful comparison for two 10+ field structs?)
20:12:14FromDiscord<haxscramper> For small and hashable objects it might lead to issues like the one we had earlier
20:24:03*abm joined #nim
20:25:50federico3@Araq the buttons to create security advisories are not showing up for me for the Nim repo - I think it needs some permissions
20:29:00FromDiscord<Recruit_main707> whats Araq doing in discord?
20:29:15federico3good question :(
20:29:55*haxscramper quit (Remote host closed the connection)
20:30:29FromDiscord<no name fits> Is this a bad time to ask for feedback on working code?
20:30:44FromDiscord<Rika> how fucky/stupid is it to use async + threads?
20:33:16FromDiscord<no name fits> sent a code paste, see https://play.nim-lang.org/#ix=2QIL
20:33:38*lkjasdf joined #nim
20:38:29FromDiscord<shirleyquirk> it says words get split on whitespace, not punctuation, so your splitchar could have been 'Whitespace'
20:38:32FromDiscord<Rika> ngl i dont know what `stripped` representsd
20:38:40FromDiscord<Rika> might need a new name for that
20:40:03FromDiscord<no name fits> Alright, it was for quoted words, where I stripped the quotesโ†ตโ†ตAnd the reason I split on so much, was because it was easier than removing punctuation afterwards. But that's bad?
20:41:05FromDiscord<no name fits> sent a code paste, see https://paste.rs/JgR
20:41:39FromDiscord<shirleyquirk> oh i see, that makes sense.
20:41:58FromDiscord<no name fits> sent a code paste, see https://play.nim-lang.org/#ix=2QIQ
20:42:56FromDiscord<shirleyquirk> those bastards lied
20:43:17FromDiscord<no name fits> I know. That's why I always read the tests first, and then the assignment lol
20:44:29FromDiscord<XxDiCaprioxX> hey can someone answer me this quickly: if I want to look at every letter of a string one-by-one, do I use `for char in mitems(myString)`?
20:44:45*narimiran quit (Ping timeout: 240 seconds)
20:44:52FromDiscord<Rika> looks right to me
20:45:03FromDiscord<no name fits> @Rika I changed it to ``strippedForQuotes``
20:45:20FromDiscord<no name fits> Or should I just add a comment?
20:45:29FromDiscord<Rika> i think `wordNoQuotes` works better
20:45:34FromDiscord<no name fits> Ah right
20:45:39FromDiscord<no name fits> I agreee
20:45:49FromDiscord<XxDiCaprioxX> In reply to @Rika "looks right to me": if that referred to me: thanks for the help
20:45:57FromDiscord<Rika> yes it did, sorry didnt reply properly
20:46:16FromDiscord<XxDiCaprioxX> ok thanks
20:47:44FromDiscord<shirleyquirk> wouldn't it fail on single-quoted phrases?
20:48:36FromDiscord<no name fits> In reply to @shirleyquirk "wouldn't it fail on": From what I could see, all tests were passing
20:48:51FromDiscord<shirleyquirk> "charles, where george had had 'had', had had 'had had'. 'Had had' had had the better effect"
20:48:53FromDiscord<Rika> i think you're still splitting spaces within single quotes?
20:49:16FromDiscord<no name fits> oh right, yeah that would fail
20:50:30FromDiscord<no name fits> I'm not sure what the expected output would be for that. Are quoted words considered one word?
20:50:51FromDiscord<Rika> is it not defined in the question details?
20:50:57FromDiscord<Rika> if not prolly just ignore it...
20:50:58FromDiscord<no name fits> Not to that detail
20:51:19FromDiscord<Rika> because my thought says "is it really a word if it has a space"
20:51:31FromDiscord<no name fits> sent a code paste, see https://play.nim-lang.org/#ix=2QJ0
20:51:39FromDiscord<Rika> oh
20:51:40FromDiscord<shirleyquirk> it says all forms of punctuation ignored other than apostrophe
20:51:44FromDiscord<Rika> the last part there
20:51:49FromDiscord<Rika> oh
20:51:49FromDiscord<Rika> no misread
20:51:51FromDiscord<Rika> lol
20:51:56FromDiscord<shirleyquirk> so single quotes should be ignored
20:52:17FromDiscord<Rika> isnt apostrophe == single quote in this case?
20:52:22FromDiscord<shirleyquirk> no
20:52:29FromDiscord<Rika> are we dealing with unicode lol
20:52:34FromDiscord<shirleyquirk> heh
20:53:14FromDiscord<Rika> okay i dont see why we need `wordNoQuotes` now since theres nothing stated about words being wrapped in single quotes, only words containing apostropges
20:53:19FromDiscord<no name fits> Right, so what I really should be doing is check if it startsWith and then removing the starting quote, and then checking if it then also has an ending one and remove that
20:53:19FromDiscord<Rika> (edit) "apostropges" => "apostrophes"
20:53:41FromDiscord<shirleyquirk> for extra credit, yes.
20:53:52FromDiscord<no name fits> In reply to @Rika "okay i dont see": sent a code paste, see https://play.nim-lang.org/#ix=2QJ1
20:54:23FromDiscord<Rika> ah you're using split is why, idve manually gone through the string lol
20:54:26FromDiscord<Rika> okay
20:54:41FromDiscord<no name fits> oh there's a better way?
20:54:48FromDiscord<Rika> no no its just another way
20:54:56FromDiscord<Rika> not necessarily better, might be for certain cases
20:55:06FromDiscord<Rika> better is dependent on the requirements of the user
20:55:21FromDiscord<shirleyquirk> it's only one pass vs two
20:55:23FromDiscord<Rika> speed, readability, strictness, etc
20:55:36FromDiscord<Rika> i mean if you think about it two passes is double of one pass
20:55:43FromDiscord<Rika> thats a lot if youre doing this a lot
20:55:43FromDiscord<no name fits> well I'm always open to learn
20:56:50FromDiscord<no name fits> oh I think I see what you're saying. So step through it char by char and construct the word on the go
20:56:58FromDiscord<Rika> yes
20:57:09FromDiscord<no name fits> Yes, that would only be one iteration then
20:57:12FromDiscord<Rika> i would construct the fsm graph for this but im lazy so
20:57:13FromDiscord<Rika> xd
20:57:21FromDiscord<shirleyquirk> next failure sentence: "She had more Sail than our poor Brigantine, more Cannon, too, and certainly a stronger Fo'c'sle"
20:57:28FromDiscord<Solitude> In reply to @Rika "i would construct the": so you wouldnt?
20:57:34FromDiscord<Rika> good point
20:57:47FromDiscord<Rika> i would construct it if i wasnt lazy but i am so
20:57:51FromDiscord<Rika> wasnt? werent?
20:57:54FromDiscord<Rika> whatever
20:58:02*bozaloshtsh quit (Ping timeout: 260 seconds)
20:58:23FromDiscord<no name fits> I'll try to rewrite it
20:59:13*Fish-Face quit (Ping timeout: 260 seconds)
21:00:38FromDiscord<no name fits> what was the expected behaviour of 'had had' we agreed on?
21:01:03FromDiscord<Rika> basically words have to start with a-zA-Z but can contain a-zA-Z', there are two states (word and notword) and you start in notword, if you encounter startChars you switch to word and log all chars into a buffer
21:01:36FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=2QJ8
21:01:45FromDiscord<no name fits> @shirleyquirk what do you think?
21:02:09FromDiscord<no name fits> I'm just gonna make some tea before I rewrite
21:02:11FromDiscord<Rika> unless ' at the end is also ignored, then the fsm graph gets a bit messy lol
21:02:35*Fish-Face joined #nim
21:02:44FromDiscord<no name fits> Well it has to ignore in the case of ``large`` and ``'large'``
21:02:57FromDiscord<no name fits> So I think it has to remember if there was a starting ``'``
21:02:57FromDiscord<Rika> true, i forgot about thjat
21:03:12FromDiscord<Rika> so its now context sensitive? or am i mistaken lol
21:03:37FromDiscord<no name fits> I'm not sure. I'm not super good at lingustics and string stuff, sorry
21:03:45FromDiscord<no name fits> (edit) "lingustics" => "linguistics"
21:03:46FromDiscord<Rika> me neither
21:03:51FromDiscord<Rika> i only self learned this
21:03:53FromDiscord<Rika> lmao
21:04:18FromDiscord<shirleyquirk> what about ending apostrophe after plural nouns? apostrophe's are counted, so "Princes' Princes" should count as two words
21:04:41FromDiscord<Rika> true
21:06:09FromDiscord<no name fits> I guess this would be a good opportunity to learn to write my own tests as well
21:06:14*bozaloshtsh joined #nim
21:06:14*bozaloshtsh quit (Changing host)
21:06:14*bozaloshtsh joined #nim
21:06:16FromDiscord<shirleyquirk> In reply to @no name fits "<@!693817920626753576> what do you": i believe, according to rule 3, that 'had had' is single quotes and should be ignored
21:06:38FromDiscord<no name fits> alright, so that would be had = 2
21:07:03FromDiscord<Rika> so you must log if an opening quote exists
21:08:04FromDiscord<shirleyquirk> oooh, state machine time
21:08:13FromDiscord<ajusa> everything after a `const` variable is evaluated and assigned at compile time, correct? Or does it happen at runtime?
21:09:11FromDiscord<ajusa> like `const something = f(5)`. is the value from f(5) calculated at compile time?
21:09:16FromDiscord<mratsim> yes
21:10:42FromDiscord<shirleyquirk> 'twas a dark and stormy night when the pirates' booty was distributed
21:10:58FromDiscord<Rika> ok i bet im wrong, we're still in context free territory
21:11:30FromDiscord<Rika> In reply to @shirleyquirk "'twas a dark and": ooh that's impossible to do without a dictionary or something i bet...
21:11:40FromDiscord<shirleyquirk> english is evil
21:12:22FromDiscord<Rika> consts are made on compile time, which means all functions used for the result must be executed in compile time
21:12:27FromDiscord<Rika> just to clarify
21:12:42FromDiscord<no name fits> so what's my approach with that one, without a dictionary?
21:12:49FromDiscord<Rika> i dont think there is any
21:12:59FromDiscord<no name fits> oh :c
21:13:18FromDiscord<Rika> unless you can distinguish single quote from apostrophe aka unicode time (i think)
21:13:40FromDiscord<no name fits> I think most normal people just use ' though
21:15:35FromDiscord<Rika> just checked, apostrophe is within extended ascii
21:15:42FromDiscord<Rika> but unless the tests use that then RIP
21:15:50FromDiscord<no name fits> they just use '
21:15:58FromDiscord<Rika> anyway i think we're stepping out of the bounds of the question
21:16:03FromDiscord<shirleyquirk> sorry yes
21:16:13FromDiscord<no name fits> In reply to @shirleyquirk "sorry yes": No I appreciate the observation
21:16:25FromDiscord<no name fits> I wouldn't have considered it
21:17:52FromDiscord<Rika> can a channel be safely read by two threads at the same time?
21:23:15FromDiscord<mratsim> eh
21:23:28FromDiscord<mratsim> Nim channels use a lock
21:23:38FromDiscord<mratsim> one will be reading the other will be sleeping
21:24:09FromDiscord<Rika> okay
21:25:01FromDiscord<Rika> im still kinda iffy about this but is it okay to mix async and threads?
21:25:47FromDiscord<dom96> As long as you don't mind kitten murder
21:25:54FromDiscord<Rika> ya what?
21:25:58FromDiscord<Rika> is it that bad
21:26:09FromDiscord<dom96> nah, just a joke
21:26:12FromDiscord<dom96> it's perfectly fine
21:26:50FromDiscord<Rika> i mean i know its a joke but through the joke the implications say its bad xd
21:26:52FromDiscord<Rika> okay
21:26:57FromDiscord<dom96> yeah, sorry, bad joke lol
21:27:11FromDiscord<dom96> I'd say only do it if you absolutely must though
21:27:14FromDiscord<Rika> its an ok joke its just the meaning was reversed lol
21:27:15FromDiscord<dom96> dealing with threads sucks
21:27:27FromDiscord<mratsim> you can mix them but are you mixing them or are you the one being mixed?
21:27:32FromDiscord<Rika> yeah idk if i need the threads
21:27:37FromDiscord<mratsim> threads are friendly
21:28:04FromDiscord<Rika> i should probably do this async only first then
21:28:37FromDiscord<Rika> i dont know how to word this next questions
21:28:39FromDiscord<Rika> (edit) "questions" => "question"
21:29:26FromDiscord<Rika> how do i avoid gcsafe warnings/errors when using a global state for async? (is what i guess is the best wording for this question)
21:29:53FromDiscord<Rika> without using cast(gcsafe) or similar
21:30:05FromDiscord<Rika> basically i wanna know how to do that properly with async
21:30:06FromDiscord<dom96> `--threadAnalysis:off` ๐Ÿ˜„
21:30:12FromDiscord<dom96> okay, that might not be proper
21:30:27FromDiscord<dom96> mark the global state with {.threadvar.}
21:32:51FromDiscord<Rika> what is the reason async complains about gcsafe if async isnt parallel?
21:33:08FromDiscord<Rika> <-- not getting it lmao
21:33:34FromDiscord<mratsim> in case it became parallel
21:33:45FromDiscord<mratsim> so that it doesn't break working user code
21:33:51FromDiscord<Araq> code works better when you can compose it
21:34:01FromDiscord<mratsim> because they wrote the code with assumptions that don't hold
21:34:31FromDiscord<Rika> so in case they start to mix async and threads?
21:42:58FromDiscord<mratsim> or parallel async is supported
21:43:13FromDiscord<Rika> mind hurt, how does parallel async work...
21:55:18FromDiscord<mratsim> that's why I have so much stuff in Weave IO ๐Ÿ˜‰
21:57:55*Vladar quit (Quit: Leaving)
21:58:01FromDiscord<Rika> sounds exciting
21:59:45*lkjasdf quit (Ping timeout: 240 seconds)
22:03:52FromDiscord<mratsim> "We only need to do X" is very exciting until we need to implement and debug it
22:04:03FromDiscord<Avatarfighter> lmao
22:04:35FromDiscord<Avatarfighter> Everything is fun and exciting till its time to implement and debug
22:05:00FromDiscord<Araq> "we only need to do X" is the story of my life
22:05:19FromDiscord<mratsim> sounds exciting
22:05:53FromDiscord<mratsim> anyway, see you tomorrow
22:06:05FromDiscord<Rika> see you
22:06:59FromDiscord<Avatarfighter> o/ mratsim
22:10:49FromDiscord<Solitude> how do i wrap c types with anonymous structs?
22:11:27FromDiscord<Solitude> if base type is imported from header
22:13:38FromDiscord<Araq> ask c2nim
22:13:49FromDiscord<Araq> it gives the anon structs names
22:15:26FromDiscord<Solitude> yes, but compilation will fail at c compiler with `error: unknown type name`
22:19:10FromDiscord<Araq> depends on how you wrap it
22:19:21FromDiscord<Solitude> with `header` doesnt seems like there is a way
22:19:29FromDiscord<Solitude> (edit) "seems" => "seem"
22:19:42FromDiscord<Solitude> (edit) "seem" => "look"
22:19:45FromDiscord<Araq> why not? just don't use .header for the introduced names
22:19:55FromDiscord<Solitude> i dont
22:20:30FromDiscord<XxDiCaprioxX> hey guys another quick question: is there something to check if a `char` is a number or not?
22:20:57FromDiscord<Solitude> if i importc them its `unknown type`, if i dont its `uncompatible argument`
22:21:55FromDiscord<Solitude> huh, i guess i can workaround it if i never refer to the structure fields themself and only to inner fields.
22:29:55FromDiscord<Araq> works fine, https://play.nim-lang.org/#ix=2QJT
22:30:25*jess quit (Quit: Leaving)
22:40:54FromDiscord<Nerdie> how can I make my nim thing a dll so I can inject it into something like csgo
22:41:17FromDiscord<Solitude> --app:lib
22:41:38FromDiscord<Recruit_main707> for example xD
22:41:57FromDiscord<Rika> that example tho
22:42:14FromDiscord<Recruit_main707> its been done a few times, it has cost me a vac ban infact lol
22:42:30FromDiscord<Nerdie> did you use manual mapping to inject it?
22:42:52FromDiscord<Recruit_main707> i dont remember, i was not trying to hack online, i was just bhoping with bots xD
22:43:25FromDiscord<Nerdie> i'd really like to make a cheat w/ nim
22:43:28FromDiscord<Nerdie> since fuck c++
22:43:40FromDiscord<Nerdie> all my homies like the word import
22:43:45FromDiscord<Rika> c++ has imports
22:43:48FromDiscord<Nerdie> no
22:43:51FromDiscord<Rika> lol
22:43:56FromDiscord<Nerdie> i want
22:43:58FromDiscord<Nerdie> the word import
22:44:00FromDiscord<Nerdie> to import my shit
22:44:03FromDiscord<Nerdie> with a fucking package manager
22:44:27FromDiscord<Rika> hey i aint sayin c++ good i agree its awful
22:44:29FromDiscord<Rika> just sayin tho
22:44:32FromDiscord<Rika> they got "import"
22:44:38FromDiscord<Nerdie> i know you have like #define or whatever
22:44:45FromDiscord<Nerdie> i just prefer having import
22:44:53FromDiscord<Rika> okay
22:44:55FromDiscord<Nerdie> has anyone made a cheat w/ nim?
22:45:01FromDiscord<Rika> prolly
22:45:07FromDiscord<Rika> people have made viruses with nim
22:45:10FromDiscord<Nerdie> oooh
22:45:21FromDiscord<Nerdie> i still don't understand the structure of nim
22:45:32FromDiscord<Nerdie> wtf is the difference between proc and func
22:45:40FromDiscord<Recruit_main707> func means no side effects
22:45:58FromDiscord<Nerdie> whats proc mean then
22:46:08FromDiscord<Nerdie> In reply to @Recruit_main707 "func means no side": wym no side effects
22:46:16FromDiscord<Rika> proc == p.much a def in python
22:46:17FromDiscord<apollo> haskell == side effects
22:46:31FromDiscord<Rika> func just means you cant change shit like globals within it
22:46:51FromDiscord<Rika> only whatever is given in the parameters
22:46:51FromDiscord<Nerdie> ooooh
22:47:04FromDiscord<Nerdie> i learned what let, var and const do
22:47:11FromDiscord<Nerdie> even though i knew what a const and a var were
22:47:16FromDiscord<Nerdie> didn't have a clue about what let did
22:47:27FromDiscord<Rika> theyre not equivalent if you're thinking about let var const from js
22:47:32FromDiscord<Nerdie> nah
22:47:35FromDiscord<Nerdie> i don't do that bs
22:47:37FromDiscord<Nerdie> js is bad
22:48:22FromDiscord<Rika> var = a var, same as C basically igโ†ตlet = immutable, cant change any values hereโ†ตconst = compile time variable, mutability is kinda weird for this one i believe
22:48:42FromDiscord<Rika> but usually its immutable (its like changing an rval)
22:48:44FromDiscord<apollo> there's a var keyword in C?
22:48:53FromDiscord<Rika> no i mean same as c's normal variables
22:49:00FromDiscord<Rika> not that c has `var`
22:49:10FromDiscord<apollo> phew
22:49:12FromDiscord<Nerdie> hm
22:49:19FromDiscord<Nerdie> how can i see if the dll has been injected
22:49:26FromDiscord<Rika> no idea lol have fun with that
22:49:31FromDiscord<Nerdie> i couldn't find anything to paste off of lmao
22:49:49FromDiscord<Rika> you're on your own regards the injection or w/e since i aint a windows pro
22:50:02FromDiscord<Nerdie> i know how to inject shit
22:50:04FromDiscord<Nerdie> just not really
22:50:09FromDiscord<Nerdie> how to see if the dll is injected
22:50:32FromDiscord<Nerdie> hm
22:51:28FromDiscord<ElegantBeef> Could write to a file on load, no?
22:51:32FromDiscord<dom96> look up how to do it in C then {.importc.} that shit ๐Ÿ˜„
22:51:41FromDiscord<Nerdie> oh
22:51:42FromDiscord<Nerdie> shit
22:51:45FromDiscord<Nerdie> i keep forgetting
22:51:49FromDiscord<Nerdie> nim = basically just c
22:51:59FromDiscord<ElegantBeef> "basically just c"
22:52:02FromDiscord<Nerdie> well
22:52:03FromDiscord<Nerdie> yeah
22:52:12FromDiscord<Nerdie> its c without the c
22:52:16FromDiscord<apollo> ~~everything is basically C~~
22:52:19FromDiscord<Nerdie> well
22:52:21FromDiscord<Nerdie> even python is c
22:52:30FromDiscord<Nerdie> is there anyway to compile my shit into a dll through like vsc or visual studio
22:52:37FromDiscord<Recruit_main707> use winim and show a messageBox on dll attach
22:52:44FromDiscord<ElegantBeef> make a task and invoke it
22:52:47FromDiscord<apollo> i really should start calling my code "Shit" too ๐Ÿค”
22:52:53FromDiscord<Nerdie> yeah
22:52:54FromDiscord<Recruit_main707> thats the easiest way to check if you injected
22:52:56FromDiscord<Nerdie> only thing i've done is while true
22:52:57FromDiscord<Rika> In reply to @apollo "~~everything is basically C~~": well people would say llvm based languages arent basically C
22:53:04FromDiscord<apollo> .
22:53:12FromDiscord<Rika> ehem
22:53:15FromDiscord<ElegantBeef> You're right they're basically just C++ ๐Ÿ˜›
22:53:28FromDiscord<Nerdie> can i have c++ code inside of nim aswell?
22:53:45FromDiscord<Recruit_main707> @Nerdie when compiling, you can change the c compiler with `--cc:`
22:53:56FromDiscord<Recruit_main707> there are various supported ones by default
22:54:11FromDiscord<ElegantBeef> Dont you just do `cpp` for compiling using the C++ backend?
22:54:29FromDiscord<Recruit_main707> > can i have c++ code inside of nim aswell?โ†ตif you compile with the c++ backend, and use {.emit:"""code""".}
22:56:52FromDiscord<no name fits> I'm unsure why I'm getting the error: ``/usercode/in.nim(10, 45) Error: VM does not support 'cast' from tySet to tyInt32``โ†ตโ†ตI tried copying how to use bit fields from <https://nim-lang.org/docs/manual.html#set-type-bit-fields> and I ended up with https://play.nim-lang.org/#ix=2QJV which gives me that error
22:59:12FromDiscord<shirleyquirk> it's because your case calls toNum at compile time
23:00:02FromDiscord<no name fits> And I can't make toNum compile time somehow?
23:00:16FromDiscord<ElegantBeef> casting isnt fully supported in the VM
23:00:24FromDiscord<no name fits> Alright, thanks
23:00:57FromDiscord<ElegantBeef> Also wow shirley in the realtime chat, magic day ๐Ÿ˜„
23:01:14*jess joined #nim
23:01:26FromDiscord<Rika> i dont know who this shirley is ngl
23:01:35FromDiscord<ElegantBeef> They're someone fairly active on the forum
23:01:40FromDiscord<ElegantBeef> Havent seen them here before
23:02:12FromDiscord<ElegantBeef> They probably know me as the person giving shitty suggestions ๐Ÿ˜›
23:02:59FromDiscord<Rika> ic
23:04:37FromDiscord<shirleyquirk> In reply to @no name fits "And I can't make": since a set can be more than one thing at a time it can't be used in a case statement
23:06:16*tane_ quit (Quit: Leaving)
23:07:29FromDiscord<ElegantBeef> Sets can be used in of branches
23:08:59FromDiscord<Nerdie> sent a code paste, see https://play.nim-lang.org/#ix=2QKb
23:10:02FromDiscord<ElegantBeef> The issue with using sets like this is that they overlap, it's not "if all match", it's an "if any match"
23:10:50FromDiscord<ElegantBeef> https://nim-lang.org/docs/manual.html#foreign-function-interface-importc-pragma
23:14:39FromDiscord<Nerdie> cool
23:14:44FromDiscord<Nerdie> i can do this without needing c
23:14:48FromDiscord<Nerdie> just using the windows api
23:14:56FromDiscord<no name fits> sent a code paste, see https://paste.rs/BzV
23:15:27FromDiscord<ElegantBeef> Cant see the assignment
23:15:47FromDiscord<no name fits> sent a code paste, see https://play.nim-lang.org/#ix=2QKh
23:15:54FromDiscord<no name fits> That's bothersome that those aren't public
23:16:02FromDiscord<Recruit_main707> @Nerdie check winim, it wraps everything https://github.com/khchen/winim
23:16:16FromDiscord<Nerdie> ye
23:16:19FromDiscord<Nerdie> thats what i was gonna use
23:16:21FromDiscord<Nerdie> but
23:16:23FromDiscord<Nerdie> im having issues
23:16:26FromDiscord<Nerdie> installing it
23:16:37FromDiscord<ElegantBeef> I dont think that's a question since no is right after it
23:16:40FromDiscord<Nerdie> sent a code paste, see https://play.nim-lang.org/#ix=2QKi
23:16:59FromDiscord<Nerdie> https://nerdie.is-part-of-the.lgbt/โ€‹โ€Œโ€Œโ€‹โ€‹โ€‹โ€Œโ€‹โ€‹โ€Œโ€‹โ€Œโ€‹โ€Œโ€‹โ€‹โ€‹โ€Œโ€Œโ€Œโ€‹โ€‹โ€Œโ€Œโ€‹โ€Œโ€‹โ€‹โ€Œโ€‹โ€‹โ€‹โ€‹โ€Œโ€Œโ€‹โ€‹โ€‹โ€‹โ€Œโ€‹โ€Œโ€Œโ€‹โ€‹โ€‹โ€Œโ€Œโ€‹โ€Œโ€‹โ€Œโ€‹โ€‹โ€‹โ€‹โ€‹โ€Œโ€‹โ€Œโ€Œโ€‹โ€‹โ€Œโ€‹โ€Œโ€‹โ€Œโ€Œโ€Œโ€Œโ€Œ
23:17:00FromDiscord<ElegantBeef> I think that is purposely there as an edge case
23:17:06FromDiscord<no name fits> So what really signifies a question is ending with "?" regardless of what comes before?
23:17:20FromDiscord<ElegantBeef> it appears so
23:17:34FromDiscord<ElegantBeef> `str[^1] == '?'` seems to be the only requirement
23:17:48FromDiscord<Nerdie> In reply to @Nerdie "https://nerdie.is-part-of-the.lgbt/โ€‹โ€Œโ€Œโ€‹โ€‹๏ฟฝ": @Recruit_main707 do you know how to actually install winim lol
23:17:50FromDiscord<ElegantBeef> Or if the last non whitespace character is a `?`
23:18:00FromDiscord<Recruit_main707> nimble install winim
23:18:02FromDiscord<no name fits> sent a code paste, see https://play.nim-lang.org/#ix=2QKj
23:18:06FromDiscord<Nerdie> thats what i did
23:18:12FromDiscord<Nerdie> i sent a ss
23:18:18FromDiscord<Nerdie> of what it says when i try to install it
23:18:35FromDiscord<ElegantBeef> it's if the last non whitespace is `?`?
23:18:52FromDiscord<no name fits> yeah would have been nice if they just mentioned it in the rules
23:19:13FromDiscord<Recruit_main707> you wrote nimin xD
23:19:15FromDiscord<Recruit_main707> winim
23:19:23FromDiscord<Nerdie> BRUH
23:19:25FromDiscord<Nerdie> i give up
23:19:27FromDiscord<ElegantBeef> Well it's an easy check with `rfind` + `parseutils.skipWhitespace` ๐Ÿ˜›
23:19:29FromDiscord<Nerdie> lmao
23:19:34FromDiscord<Avatarfighter> does anyone know if there is an implementation of AES CCM in a repo somewhere? Nimcrypto doesn't have it afaik
23:19:49FromDiscord<Nerdie> thats funny lol
23:20:41FromDiscord<no name fits> In reply to @ElegantBeef "Well it's an easy": I had no idea skipWhitespace existed
23:20:52FromDiscord<ElegantBeef> Parseutils is a magical library
23:20:53FromDiscord<Rika> well its a very useful function
23:21:00FromDiscord<no name fits> I can see that
23:21:35FromDiscord<no name fits> Well this passes all tests. Does it look horrible? I feel like it's horribleโ†ตโ†ตhttps://play.nim-lang.org/#ix=2QKk
23:21:35FromDiscord<ElegantBeef> I used it in my `.obj` parser i threw together, makes the code nice and readable ๐Ÿ˜„
23:22:10FromDiscord<ElegantBeef> You dont need pure or size btw
23:22:24FromDiscord<Nerdie> https://nerdie.is-part-of-the.lgbt/โ€‹โ€Œโ€Œโ€Œโ€‹โ€‹โ€‹โ€Œโ€‹โ€Œโ€‹โ€‹โ€‹โ€Œโ€Œโ€‹โ€‹โ€Œโ€‹โ€‹โ€‹โ€Œโ€Œโ€Œโ€‹โ€Œโ€Œโ€‹โ€‹โ€Œโ€‹โ€‹โ€‹โ€Œโ€‹โ€‹โ€Œโ€Œโ€‹โ€Œโ€‹โ€Œโ€Œโ€‹โ€‹โ€Œโ€Œโ€‹โ€‹โ€Œโ€‹โ€Œโ€Œโ€‹โ€‹โ€‹โ€‹โ€Œโ€Œโ€‹โ€Œโ€‹โ€‹โ€Œโ€‹โ€Œโ€‹โ€Œโ€Œโ€Œโ€Œโ€Œ
23:22:27FromDiscord<Nerdie> how do i do this
23:22:28FromDiscord<Nerdie> but in nim
23:22:50FromDiscord<Nerdie> i don't have any code completion for vsc
23:22:53FromDiscord<Nerdie> so i can't reakyk
23:22:55FromDiscord<Nerdie> (edit) "reakyk" => "really"
23:23:00FromDiscord<Nerdie> figure it out
23:23:09FromDiscord<no name fits> there is a Nim extension
23:23:12FromDiscord<Nerdie> yes
23:23:13FromDiscord<Nerdie> i kno
23:23:15FromDiscord<Nerdie> (edit) "kno" => "knoqw"
23:23:16FromDiscord<Nerdie> (edit) "knoqw" => "know"
23:23:20FromDiscord<no name fits> (though it fails on me quite a lot)
23:23:20FromDiscord<Nerdie> no code completion
23:23:25FromDiscord<Nerdie> well
23:23:31FromDiscord<Nerdie> not like python code completion
23:24:26FromDiscord<no name fits> In reply to @ElegantBeef "You dont need pure": Any other feedback?
23:26:52FromDiscord<Recruit_main707> @Nerdie something like this: remember you need to compile to 32bit for csgo, https://play.nim-lang.org/#ix=2QKmโ†ตgtg now
23:27:41FromDiscord<Nerdie> In reply to @Recruit_main707 "<@!595740754538659841> something like this:": thank you so much
23:28:29FromDiscord<no name fits> Anyway thanks
23:29:48FromDiscord<ElegantBeef> @no name fits i'm rewriting it to be cleaner ๐Ÿ˜„
23:29:50FromDiscord<shirleyquirk> In reply to @no name fits "Any other feedback?": you could just do it with if statements, but i don't know if that's clearer
23:30:28FromDiscord<no name fits> I was trying to avoid chaining if statements as well as (hopefully) leverage the constant-ish time lookup of tables
23:30:45FromDiscord<no name fits> Which is why I originally wanted a switch
23:32:27FromDiscord<ElegantBeef> I mean i prefer this but to each their own https://play.nim-lang.org/#ix=2QKp
23:33:06*krux02_ quit (Remote host closed the connection)
23:33:06*krux02 quit (Remote host closed the connection)
23:33:15FromDiscord<no name fits> ngl that looks way cleaner
23:34:18FromDiscord<ElegantBeef> Default states save lives... i mean lines of code ๐Ÿ˜„
23:35:17FromDiscord<shirleyquirk> it was clearly begging for an else: "Whatever"
23:36:22FromDiscord<no name fits> I guess I was overcomplicating it with bit fields
23:36:48FromDiscord<ElegantBeef> Well sets are lovely for when they're needed, but yea this isnt a really settable challenge
23:37:19FromDiscord<ElegantBeef> Youd be doing a lot of `{a, b} in response` instead of this
23:37:31FromDiscord<no name fits> Right
23:37:39FromDiscord<no name fits> Thanks
23:38:22FromDiscord<Nerdie> alright
23:38:31FromDiscord<Nerdie> i fixed @Recruit_main707's code and now i compile my own dll
23:38:32FromDiscord<Nerdie> yay
23:39:22FromDiscord<shirleyquirk> In reply to @ElegantBeef "Youd be doing a": how do you use a set in a case? i can't get it to work
23:39:41FromDiscord<ElegantBeef> It's the same as `of a, b, c`
23:40:26FromDiscord<shirleyquirk> ohhhhhh
23:40:51FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2QKr full example for context
23:41:06FromDiscord<ElegantBeef> It's nice for chars since you can do `{'a'..'e'}` or w/e you need
23:41:55FromDiscord<shirleyquirk> thx yes clicked
23:42:20FromDiscord<ElegantBeef> I assume you were running into `Error: selector must be of an ordinal type, float or string` ๐Ÿ˜„
23:42:37FromDiscord<shirleyquirk> indeedy, that's where we started.
23:43:14FromDiscord<Nerdie> sent a long message, see http://ix.io/2QKu
23:43:22FromDiscord<ElegantBeef> Yea i explictly stated `of branch` earlier in hopes to avoid this confusion
23:44:26FromDiscord<shirleyquirk> yes, i clocked that you said that but i was still trying to convince the compiler to cast those sets to ints somehow
23:45:38FromDiscord<ElegantBeef> I do believe that you still need to tell the compiler to build a 32bit binary
23:45:51FromDiscord<ElegantBeef> It's an issue that needs to be resolved, i just read about it today
23:46:07FromDiscord<ElegantBeef> Struggling to find it ๐Ÿ˜„