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