00:35:01 | FromDiscord | <lamersc> What’s happened with this month in nim? |
00:35:14 | FromDiscord | <lamersc> (edit) "What’s" => "What" |
00:35:42 | FromDiscord | <Elegantbeef> It still exists |
00:44:54 | * | wallabra joined #nim |
00:51:11 | FromDiscord | <shoot_in_foot()> In reply to @@adrianperreault-58ab7b11d73408c "Have you heard about": 🤓 |
00:59:27 | FromDiscord | <Bung> alloc0 type A (only one ptr field) while assign that field to type B addr is fine ? |
01:06:56 | FromDiscord | <sealmove> In reply to @lamersc "What happened with this": I made an sdk for spin :D (webassembly backend framework) |
01:08:25 | FromDiscord | <sealmove> ;o how can i add it in the next such article? https://nim-lang.org/blog/2022/06/01/this-month-with-nim.html |
01:11:14 | FromDiscord | <Elegantbeef> https://github.com/beef331/website/issues/new?assignees=beef331&labels=&template=this-month-with-nim.md&title= |
01:15:03 | * | wallabra quit (Ping timeout: 252 seconds) |
01:34:45 | * | wallabra joined #nim |
01:37:05 | * | rockcavera joined #nim |
01:37:05 | * | rockcavera quit (Changing host) |
01:37:05 | * | rockcavera joined #nim |
01:41:04 | * | wallabra_ joined #nim |
01:42:46 | * | wallabra quit (Ping timeout: 260 seconds) |
01:42:52 | * | wallabra_ is now known as wallabra |
01:50:47 | FromDiscord | <sealmove> oh thanks |
01:55:02 | FromDiscord | <sealmove> so they are submitted in your fork |
01:58:29 | FromDiscord | <sealmove> when is the next month? :D |
02:00:10 | FromDiscord | <Elegantbeef> I'm not astronomer but september is the next month |
02:08:04 | FromDiscord | <Rika> lmao |
02:08:38 | * | derpydoo joined #nim |
02:15:55 | FromDiscord | <ravinder387> In reply to @Elegantbeef "I'm not astronomer but": 👍 |
02:20:59 | FromDiscord | <Shiba> In reply to @Elegantbeef "I'm not astronomer but": september🎵 |
02:27:28 | * | wallabra quit (Ping timeout: 268 seconds) |
02:29:55 | * | arkurious quit (Quit: Leaving) |
03:02:15 | * | wallabra joined #nim |
03:10:07 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "I'm not astronomer but": I'm not an oculist but you wrote two spaces |
03:10:13 | FromDiscord | <!Patitotective> my bad, thats canadian english |
03:39:36 | FromDiscord | <chmod> is nim reliable under heavy load like golang is? I would prefer using nim even at the cost of a lack of libraries I need, but I don't have a method of gauging nim's reliability at scale with lots of concurrency alongside heavy CPU usage, since go "solves" that question entirely with goroutines |
03:57:29 | * | kenran joined #nim |
03:58:12 | * | kenran quit (Client Quit) |
04:01:08 | * | jmdaemon joined #nim |
04:02:28 | * | jmdaemon quit (Remote host closed the connection) |
04:16:27 | * | jmdaemon joined #nim |
05:05:09 | FromDiscord | <tandy> is it posible to have a linebreak in a nimble file's `exec` string? |
05:05:29 | FromDiscord | <Elegantbeef> It should run directly in your shell so if it's allowed in your shell sure |
05:05:54 | FromDiscord | <tandy> ah i just needed """ |
05:08:26 | * | rockcavera quit (Ping timeout: 268 seconds) |
05:46:35 | * | rockcavera joined #nim |
05:46:36 | * | rockcavera quit (Changing host) |
05:46:36 | * | rockcavera joined #nim |
05:57:32 | NimEventer | New Nimble package! brightcove - Brightcove player parser, see https://github.com/thisago/brightcove |
06:00:46 | FromDiscord | <tandy> sent a code paste, see https://play.nim-lang.org/#ix=48ZR |
06:01:23 | FromDiscord | <tandy> so these two error messages are referencing the same cstring parameter which shouldnt be changing, so how the heck is this happening? |
06:02:10 | FromDiscord | <Elegantbeef> Incorrect code? |
06:02:29 | FromDiscord | <tandy> yes probably |
06:02:42 | FromDiscord | <tandy> i was hoping for some epic async bug |
06:02:50 | FromDiscord | <j-james> In reply to @Patitotective "my bad, thats canadian": damn lmao |
06:03:07 | * | rockcavera quit (Remote host closed the connection) |
06:04:33 | FromDiscord | <tandy> ok so the print issue was a lack of brackets aroudn ` logError "There was a problem getting " & $username & "'s listens!"` |
06:06:25 | FromDiscord | <tandy> huh every now and then it doesnt print correctly tho |
06:15:00 | FromDiscord | <tandy> hmm i think this is a cstring bug |
06:15:54 | FromDiscord | <tandy> wait no it was cos a func shouldve been a proc |
06:38:34 | * | PMunch joined #nim |
06:45:36 | NimEventer | New Nimble package! pricecsv - Easily calculate the total of all products in csv, see https://github.com/thisago/pricecsv |
06:45:36 | NimEventer | New Nimble package! studiobacklottv - Studio Backlot TV video extractor, see https://github.com/thisago/studiobacklottv |
06:50:27 | PMunch | What an oddly specific package :P |
07:03:47 | NimEventer | New question by LingC: .exe has stopped working when use thread module, see https://stackoverflow.com/questions/73525170/exe-has-stopped-working-when-use-thread-module |
07:04:04 | FromDiscord | <Nalmyth> Is there some way to understand which filename a `type` was created inside? |
07:04:26 | FromDiscord | <Nalmyth> Like `typeof(T)` `sizeof(T)` `moduleof(T)`? |
07:04:34 | FromDiscord | <Nalmyth> (edit) "Like `typeof(T)` `sizeof(T)` ... `moduleof(T)`?" added " -->" |
07:05:54 | FromDiscord | <Elegantbeef> There's nothing in the stdlib that does that but you can make macro that gets the owner of a symbol |
07:06:36 | FromDiscord | <Nalmyth> In reply to @Elegantbeef "There's nothing in the": Hmm, how would I go about doing that? |
07:08:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4901 |
07:08:51 | FromDiscord | <Elegantbeef> Though that doesnt work on generics |
07:09:49 | FromDiscord | <Nalmyth> sent a code paste, see https://play.nim-lang.org/#ix=4902 |
07:10:36 | PMunch | (Not sure if you're actually sharing playground links or if that is just the bridge. But the filename of the playground input is `in.nim` so `in` would be the module name. |
07:10:37 | PMunch | ) |
07:11:30 | FromDiscord | <Elegantbeef> Just the bridge |
07:11:48 | FromDiscord | <Nalmyth> I submitted a feature request for this also:↵↵https://github.com/nim-lang/Nim/issues/20282 |
07:12:16 | FromDiscord | <Elegantbeef> Should probably be `newLit($owner)` probably |
07:13:56 | FromDiscord | <Nalmyth> Seems that gives me the same result as `instantiationInfo(-2)` 🤔 |
07:14:15 | FromDiscord | <Nalmyth> Although perhaps that's the correct result for creation of the symbol |
07:14:19 | FromDiscord | <Elegantbeef> Are you after the path? |
07:14:29 | FromDiscord | <Elegantbeef> It returns the module name |
07:15:22 | FromDiscord | <Nalmyth> sent a long message, see http://ix.io/4903 |
07:15:50 | FromDiscord | <Elegantbeef> You're doing `moduleOf` on a variable |
07:16:09 | FromDiscord | <Nalmyth> Actually on a type 🤔 |
07:16:23 | FromDiscord | <Nalmyth> sent a code paste, see https://play.nim-lang.org/#ix=4905 |
07:16:41 | FromDiscord | <Nalmyth> (edit) "https://play.nim-lang.org/#ix=4905" => "https://paste.rs/PX2" |
07:18:20 | FromDiscord | <Elegantbeef> It should return the module the type is from if you import them |
07:19:01 | FromDiscord | <Elegantbeef> Yea just tested it returns it properly |
07:19:08 | FromDiscord | <Nalmyth> Oh I will try to import |
07:19:19 | FromDiscord | <Elegantbeef> Were you including?\> |
07:19:40 | FromDiscord | <Elegantbeef> Never include |
07:22:10 | FromDiscord | <Nalmyth> No I was not including or importing in that file |
07:22:17 | FromDiscord | <Nalmyth> (edit) "not" => "neither" |
07:22:20 | FromDiscord | <Nalmyth> (edit) "or" => "nor" |
07:22:34 | FromDiscord | <Nalmyth> And seems it's hard to import the type files as now I have a recursive dependency 😢 |
07:38:31 | FromDiscord | <sealmove> morning! |
07:38:32 | * | PMunch quit (Quit: Leaving) |
07:38:51 | FromDiscord | <aruZeta> Morning |
07:39:09 | * | PMunch joined #nim |
07:39:28 | * | PMunch quit (Client Quit) |
07:40:20 | * | PMunch joined #nim |
07:44:16 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
07:44:19 | FromDiscord | <sealmove> @Forest I forgot to ask you: Do you have a public repo for the jvm stuff you're doing? |
07:49:13 | * | jmdaemon joined #nim |
07:49:53 | FromDiscord | <aruZeta> In reply to @รєคɭ๓๏שє "<@909883978717204561> I forgot to": https://github.com/Mythical-Forest-Collective/CodeGenLib |
07:52:49 | FromDiscord | <sealmove> "mythical forest collective" :DDD |
07:52:55 | * | jmdaemon quit (Client Quit) |
07:55:12 | * | jmdaemon joined #nim |
07:57:08 | PMunch | Hmm, is the developer of taskopen in here? |
07:57:31 | FromDiscord | <Elegantbeef> Oh pmunch did you see my futhark issue, clang is doing a dumb 😄 |
07:57:50 | PMunch | Yeah I saw that one, but I was too tired to reply to it :P |
07:59:36 | PMunch | That varargs thing was just in order to make macros executable. Basically a catch-all for "I don't know what the types of this is supposed to be, but I'll let you add arguments and pass them on to C for you" |
08:02:29 | FromDiscord | <Elegantbeef> Sure but isnt clang the issue? |
08:03:26 | PMunch | It seems to be a bug yeah |
08:03:51 | PMunch | I'm not even sure why it comes into the macro code.. |
08:05:48 | FromDiscord | <Elegantbeef> It just gets marked for is variadic and ruins the generated Nim |
08:06:39 | FromDiscord | <Elegantbeef> Would have just worked around it but yea i dont get what to do here, present idea is to emit a C file with the removed `own` |
08:07:24 | PMunch | What is `own` supposed to do anyways? |
08:07:40 | FromDiscord | <Elegantbeef> It's just a semantic for the code to document who owns the data |
08:07:49 | FromDiscord | <Elegantbeef> So it does nothing |
08:08:29 | PMunch | You could also include a step to fiddle with the JSON file :P |
08:15:56 | FromDiscord | <sealmove> In reply to @aruZeta "https://github.com/Mythical-Forest-Collective/CodeG": I thought it was nim -> jvm bytecode, but this seems to be textual compilation? is this gonna work? |
08:20:05 | FromDiscord | <aru> ¯\\\_(ツ)\_/¯ |
08:20:46 | FromDiscord | <aru> ig it's writing the actual .java file |
08:23:06 | FromDiscord | <sealmove> btw has nim -> jvm been attempted at all? |
08:24:44 | FromDiscord | <aru> hmm, idk |
08:25:08 | PMunch | @sealmove, not as a translation I don't think |
08:25:22 | PMunch | But it's been achieved through a native bridge |
08:26:39 | FromDiscord | <ravinder387> In reply to @รєคɭ๓๏שє "btw has nim ->": what's your opinion on nim programming |
08:28:23 | FromDiscord | <sealmove> In reply to @PMunch "But it's been achieved": oh more details please! |
08:29:02 | FromDiscord | <sealmove> In reply to @ravinder387 "what's your opinion on": ? random question xD my opinion... I f#$king love it |
08:29:47 | FromDiscord | <sealmove> it looks like the only sane language to me |
08:31:25 | PMunch | @sealmove, stuff like this: https://github.com/GordonBGood/NimHelloJNI |
08:32:54 | FromDiscord | <sealmove> ah ok but this is android-specific, it's not nim for the jvm right? |
08:33:24 | FromDiscord | <sealmove> i mean you can write android apps in c++ |
08:34:30 | FromDiscord | <sealmove> (edit) "ah" => "~~ah" | "right?" => "right?~~" |
08:34:39 | FromDiscord | <sealmove> I see, thanks PMunch |
08:37:08 | FromDiscord | <sealmove> Guys if you were making types for http (headers, body etc) would you use `Option` for the fields (or some of them)? I can't decide. |
08:40:07 | * | derpydoo quit (Quit: derpydoo) |
08:41:28 | PMunch | Well, I wouldn't make new ones, I'd just use those in the stdlib :P |
08:41:58 | FromDiscord | <sealmove> it doesn't have xD |
08:42:44 | FromDiscord | <sealmove> request details are embedded in the `HttpClient` type, and then you call `request` on it, that's the stdlib api |
08:44:36 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=490s |
08:44:49 | PMunch | Ah.. Right.. |
08:49:50 | FromDiscord | <sealmove> is there a document that keeps track of which types are initialized automatically? |
08:50:03 | FromDiscord | <Elegantbeef> All are intialised to 0 |
08:50:06 | NimEventer | New question by Alex Gustafson: c struct instantiation in c2nim wrapper, see https://stackoverflow.com/questions/73526255/c-struct-instantiation-in-c2nim-wrapper |
08:51:09 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
08:51:25 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=490y |
08:51:37 | FromDiscord | <sealmove> it's a tableref |
08:51:39 | FromDiscord | <Elegantbeef> is `HttpHeaders` a value type or reference type |
08:51:56 | FromDiscord | <sealmove> ref |
08:51:57 | FromDiscord | <Elegantbeef> If it's a reference type you need to allocate the reference as 0 init'd pointer is nil |
08:52:06 | FromDiscord | <sealmove> ohhh |
08:52:15 | FromDiscord | <sealmove> thanks! very insightful |
09:04:00 | FromDiscord | <sealmove> hmm i see `system` does define operators for pointer arithmetic, is there any module that has it? |
09:04:32 | FromDiscord | <Elegantbeef> No generally you use `ptr UncheckedArray`, there is an external package though |
09:05:29 | FromDiscord | <sealmove> how do you move the ptr say x bytes? |
09:06:19 | FromDiscord | <Elegantbeef> `cast[ptr UncheckedArray[byte]](myPtr)[x]` |
09:06:36 | FromDiscord | <Elegantbeef> You can just use the external ptr\_math though |
09:06:37 | FromDiscord | <sealmove> oh ok thanks |
09:07:22 | FromDiscord | <sealmove> if i find myself using this cast a lot then i'll consider it ty |
09:14:00 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=490J |
09:29:19 | FromDiscord | <SouperZ> any good names for a nim bootloader? |
09:32:01 | FromDiscord | <Prestige> nim_bootloader |
09:32:17 | FromDiscord | <Prestige> not great but gets the job done, lol |
09:32:45 | FromDiscord | <Rika> Noot then put a penguin as an icon |
09:32:58 | FromDiscord | <Prestige> Not bad |
09:33:03 | FromDiscord | <Rika> I’m a genius |
09:33:07 | FromDiscord | <SouperZ> In reply to @Rika "Noot then put a": this was what i was thinking |
09:33:16 | FromDiscord | <SouperZ> im gonna use "noot" |
09:33:17 | FromDiscord | <Rika> Great minds think alike |
09:33:28 | FromDiscord | <Prestige> Have him wearing the nim crown |
09:33:37 | FromDiscord | <SouperZ> hah yes |
09:50:52 | * | arkurious joined #nim |
09:52:43 | * | Vladar joined #nim |
10:08:38 | FromDiscord | <aru> not much difference between public object fields (top) and private object fields with getters/setters (bottom) |
10:08:38 | FromDiscord | <aru> image.png https://media.discordapp.net/attachments/371759389889003532/1013752027450449930/image.png |
10:09:19 | FromDiscord | <aru> guess I will use the private approach |
10:11:18 | FromDiscord | <sealmove> oh my, I have to do mmm in nim... haven't wrote these malloc calls for years T_T |
10:12:16 | FromDiscord | <sealmove> btw @aruZeta don't forget to post your qrcode generator here!↵https://github.com/beef331/website/issues/new?assignees=beef331&labels=&template=this-month-with-nim.md&title= |
10:12:42 | FromDiscord | <aru> when I finish all I have to do lol |
10:12:48 | FromDiscord | <aru> nice docs and better code in the way |
10:13:14 | FromDiscord | <aru> and more print options, only text/terminal atm |
10:14:43 | FromDiscord | <aru> though it's actually quite easy (i think) to make a custom format print procedure, since I could just make a proc which receive 2 procs, one to print a dark square, and another to print a light square |
10:15:23 | FromDiscord | <aru> svg should be easy to implement, for other formats i guess i should take a look into pixie or smth |
10:15:35 | FromDiscord | <sealmove> it doesn't have to be perfect, that's not the point of "This Month With Nim" :p |
10:15:49 | FromDiscord | <aru> hmm |
10:17:18 | FromDiscord | <aru> i will wait for next month tho, how much days left for this one? 2? |
10:21:52 | FromDiscord | <aru> sent a code paste, see https://play.nim-lang.org/#ix=4914 |
10:23:38 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=4916 |
10:23:55 | FromDiscord | <sealmove> In reply to @aru "i will wait for": Not sure how strict deadlines are ;p |
10:24:58 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=4917 |
10:25:11 | FromDiscord | <sealmove> 2nd proc looks redundant |
10:25:22 | FromDiscord | <aru> yep, that's what I was thinking |
10:27:55 | FromDiscord | <sealmove> In reply to @รєคɭ๓๏שє "what's wrong with this": ah I am missing a cast |
10:29:27 | FromDiscord | <aru> some nice macro to generate getters / setters ? |
10:36:46 | FromDiscord | <sealmove> but they are already there for you |
10:36:59 | FromDiscord | <sealmove> (edit) "but" => "~~but" | "you" => "you~~" |
10:37:25 | FromDiscord | <sealmove> what syntax do you have in mind? |
10:38:05 | FromDiscord | <sealmove> I mean how macro-heavy |
10:39:10 | FromDiscord | <aru> just wanted a macro to write for me some `get objField1` procs |
10:39:21 | FromDiscord | <aru> nothing too special |
10:40:02 | FromDiscord | <aru> but anyway I think it's better to write them by hand, it's not like they are 200 fields, and I have some custom setters |
10:41:19 | FromDiscord | <enthus1ast> write the proc you want, then use dumpAstGen to see the ast, copy paste this to a macro and change it to your needs |
10:41:40 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=491c |
10:41:50 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=491d |
10:41:55 | FromDiscord | <aru> yh ik how to make macros |
10:41:58 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=491e |
10:42:02 | FromDiscord | <enthus1ast> aru\: kkk |
10:42:26 | FromDiscord | <aru> i asked just to see if anyone of a simple already written one |
10:42:30 | FromDiscord | <sealmove> In reply to @รєคɭ๓๏שє "I mean you could": or think of a nicer syntax, but this is an example |
10:42:55 | FromDiscord | <sealmove> hmm I've written similar thing but not exactly this |
10:44:00 | FromDiscord | <aru> yh, but I do think that it would be too much↵(@sealmove) |
10:44:52 | FromDiscord | <aru> yh, but I think it would be too much, as I said for just 3-4 fields I think I don't need it |
10:45:12 | FromDiscord | <aru> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1013760530630053948): i asked just to see if anyone knew of a simple already written one |
10:49:27 | FromDiscord | <sealmove> yeah it's definitely an overkill |
10:49:28 | FromDiscord | <aru> sry if it sounded rude |
10:50:20 | FromDiscord | <sealmove> it sounds like something very common that should've been implemented but I guess it's just not in the spirit of nim |
10:50:46 | FromDiscord | <aru> yh |
10:50:50 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=491g |
10:51:52 | FromDiscord | <Rika> Be careful with that conversion |
10:52:12 | FromDiscord | <Tanguy> sent a code paste, see https://play.nim-lang.org/#ix=491h |
10:52:24 | FromDiscord | <Rika> ? |
10:52:27 | FromDiscord | <Rika> What are you asking |
10:52:31 | FromDiscord | <Rika> If it’s valid? It’s not |
10:52:46 | FromDiscord | <Tanguy> (edit) "https://play.nim-lang.org/#ix=491h" => "https://play.nim-lang.org/#ix=491i" |
10:52:55 | FromDiscord | <sealmove> In reply to @Rika "Be careful with that": how to do string -> cstring? |
10:52:58 | FromDiscord | <Rika> Well now it is after editing, but what’s |
10:53:09 | FromDiscord | <Tanguy> Yeah I got brained by the macro thing, it's good now↵But I mean, why not use thing instead of getter / setters? |
10:53:13 | FromDiscord | <Rika> In reply to @รєคɭ๓๏שє "how to do string": Ideally you’d allocate a new c string and copy the contents |
10:53:29 | FromDiscord | <Tanguy> (edit) "thing" => "this" |
10:53:30 | FromDiscord | <Rika> If you just directly convert like that then if the string dies then you have an invalid pointer |
10:53:49 | FromDiscord | <Rika> In reply to @Tanguy "Yeah I got brained": I assume he wants to make the generation of those procs automatic |
10:54:34 | FromDiscord | <sealmove> no no I want the _correct_ way :p ok I allocate how? searching for a proc in stdlib... |
10:54:49 | FromDiscord | <Rika> Prolly a proc named new c string |
10:55:05 | FromDiscord | <Rika> Without the spaces, I just don’t want to mess up my phone’s dictionary even more |
10:55:12 | FromDiscord | <sealmove> there is no such :( |
10:55:26 | FromDiscord | <sealmove> In reply to @Rika "Without the spaces, I": hahaha fair enough |
10:55:29 | FromDiscord | <Tanguy> I mean `x[get, set]: string` == `x: string` |
10:55:29 | FromDiscord | <Rika> Really? I’m pretty sure there is |
10:55:59 | FromDiscord | <sealmove> In reply to @Tanguy "I mean `x[get, set]:": ah right |
10:58:05 | FromDiscord | <sealmove> In reply to @Rika "Really? I’m pretty sure": there isn't :s |
10:58:13 | FromDiscord | <aru> lmao↵(@Rika) |
10:58:28 | FromDiscord | <Rika> In reply to @รєคɭ๓๏שє "there isn't :s": If there is when I look imma whoop yo ass |
10:58:50 | FromDiscord | <sealmove> hahaha responsibility accepted :> |
10:59:16 | FromDiscord | <sealmove> there is `newWideCString` but not plain `newCString` |
11:02:26 | FromDiscord | <Rika> You right |
11:03:04 | FromDiscord | <Bung> just .cstring |
11:03:35 | FromDiscord | <sealmove> sent a code paste, see https://paste.rs/i3S |
11:03:54 | FromDiscord | <sealmove> ok so everything is handled magically, nice! |
11:04:17 | FromDiscord | <aru> sent a code paste, see https://play.nim-lang.org/#ix=491m |
11:04:58 | FromDiscord | <aru> oh well that would be the same as `.cstring` right? |
11:05:29 | FromDiscord | <Rika> Yes but if you use it on the right variable then the lifetime would be different |
11:05:53 | FromDiscord | <Bung> right, that's with static[string] param version |
11:06:30 | FromDiscord | <aru> is writing `static[type]` and `static type` any different? |
11:07:12 | FromDiscord | <Bung> never seen in right form, it's like c/c++ code |
11:08:26 | FromDiscord | <aru> i have written `static type` quite a few times \>\_\< |
11:08:45 | FromDiscord | <Rika> Both are the same iirc |
11:37:30 | FromDiscord | <voidwalker> I need some code. Trying to asynchronously get n URLs which need to be parsed, and then for each such URL save the (another) parsed URL to disk. All async, so the gui in which this happens doesn't block. Any idea how the code would look like ? |
11:37:54 | FromDiscord | <voidwalker> Something like this in nim pseudocode: |
11:38:02 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=491s |
11:39:29 | FromDiscord | <Forest [She/Her]> In reply to @รєคɭ๓๏שє "<@909883978717204561> I forgot to": Yup |
11:39:46 | FromDiscord | <Forest [She/Her]> In reply to @รєคɭ๓๏שє ""mythical forest collective" :DDD": #system-bullshit |
11:39:46 | FromDiscord | <voidwalker> Not even sure if this shouldn't be a threaded job, as well as async |
11:39:58 | FromDiscord | <dom96> In reply to @voidwalker "Not even sure if": async is all you need |
11:40:03 | FromDiscord | <dom96> what GUI are you using? |
11:40:09 | FromDiscord | <voidwalker> fidgetty at the moment |
11:40:15 | FromDiscord | <voidwalker> (edit) "fidgetty" => "fidget(ty)" |
11:40:50 | FromDiscord | <dom96> what event loop does fidgetty use? i.e. what is it using to create the window and get mouse/key events? |
11:41:20 | FromDiscord | <Forest [She/Her]> In reply to @รєคɭ๓๏שє "I thought it was": Yeah, it should work, i want to generate source files since it's easier to breakdown the structure, of course it'll need trial and error but this'll allow people to just read through the outputted code (and i may make something to generate bytecode but doubt it) |
11:42:43 | FromDiscord | <voidwalker> it has import asyncfutures |
11:42:47 | FromDiscord | <voidwalker> (edit) "has" => "has`" | "asyncfutures" => "asyncfutures`" |
11:44:03 | FromDiscord | <voidwalker> Author told me this :`just follow the examples in examples/choosenimapp.nim or src/animatedProgress.nim. Basically just put a properties: myTask: Future[void] and then self.myTask = doSomething(self) . It basically sets up your proc to run on the event loop in Fidget that I added in. Whenever you update just remember to call refresh() to tell Fidget that something changed and to redraw.↵` |
11:45:37 | FromDiscord | <dom96> Hm, guess the author added support for running asyncdispatch already then |
11:46:53 | FromDiscord | <voidwalker> Yep. But I still have no idea what I am doing. Two levels of nested async waiting stuff is too much for me |
11:47:44 | FromDiscord | <enthus1ast> in general, most gui event loops have a timer/timeout feature, just call asyncdispatch.poll() with a relatively small timeout number in these |
11:48:05 | FromDiscord | <dom96> pretty sure fidgetty already does that for you |
11:48:08 | FromDiscord | <dom96> based on what the author said |
11:48:59 | FromDiscord | <enthus1ast> that i do not know, but so far i could use every gui we have with async |
11:49:01 | FromDiscord | <dom96> Just `asyncCheck test()` somewhere |
11:49:04 | FromDiscord | <dom96> sent a code paste, see https://play.nim-lang.org/#ix=491t |
11:49:21 | FromDiscord | <dom96> (edit) "https://play.nim-lang.org/#ix=491t" => "https://play.nim-lang.org/#ix=491u" |
11:49:24 | FromDiscord | <dom96> and see whether the echo shows up every second |
11:52:13 | FromDiscord | <voidwalker> Well I did what the author said, had a seq of [Future[void]] added to the main program's "properties", and assigned them the async proc, and it got automatically ran |
12:06:15 | FromDiscord | <voidwalker> Yeah I do get Hell0 every second running the code above |
12:10:00 | FromDiscord | <sealmove> when I have a `let` pointer to an object, why can't i change the value of a field? |
12:10:45 | FromDiscord | <sealmove> is there `const type` vs `type const` distinction in nim? |
12:12:02 | FromDiscord | <planetis> In reply to @รєคɭ๓๏שє "is there `const type`": no there isn't but experimental strict funcs https://nim-lang.github.io/Nim/manual_experimental.html#strict-funcs are similar |
12:12:16 | FromDiscord | <voidwalker> so basically I need something like this, but no idea how to write it, I already spent numerous hours at it, and I declare myself hopeless. I need to work/read with a lot more async code to get the hang of it, if ever |
12:12:26 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=491A |
12:12:46 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=491A" => "https://play.nim-lang.org/#ix=491B" |
12:14:03 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=491B" => "https://play.nim-lang.org/#ix=491C" |
12:14:36 | FromDiscord | <sealmove> but what semantics does `var x: ptr MyObj` has now? It means you can change both where the pointer points to and the value of the underlying object? |
12:14:45 | FromDiscord | <sealmove> and `let` let's do neither? |
12:15:57 | FromDiscord | <planetis> no strict funcs doesn't work with ptr only ref. But yes you're correct. |
12:16:38 | FromDiscord | <planetis> (edit) removed "But yes you're correct." |
12:17:24 | FromDiscord | <planetis> nope actually let with a ref type still allows mutability in what it points to. |
12:17:39 | FromDiscord | <planetis> (edit) "nope actually let with a ref type still allows mutability in what it points to. ... " added "but strict funcs prevents that." |
12:18:18 | FromDiscord | <sealmove> neat, thanks |
12:27:53 | * | Vladar quit (Ping timeout: 252 seconds) |
12:40:44 | * | Vladar joined #nim |
12:49:49 | FromDiscord | <flywind> sent a code paste, see https://play.nim-lang.org/#ix=491T |
12:50:15 | FromDiscord | <flywind> (edit) "https://play.nim-lang.org/#ix=491T" => "https://play.nim-lang.org/#ix=491U" |
12:50:45 | FromDiscord | <flywind> never mind, figured. |
13:05:24 | FromDiscord | <dom96> In reply to @voidwalker "so basically I need": where are you getting stuck? |
13:19:37 | FromDiscord | <voidwalker> at the design phase. not sure how to structure it |
13:24:04 | FromDiscord | <sealmove> does stdlib have a `Result` type? Err/Ok(argument)? |
13:24:28 | FromDiscord | <flywind> no |
13:24:56 | FromDiscord | <sealmove> what do you suggest? an extra boolean? |
13:25:52 | FromDiscord | <flywind> nim-results if you would like a 3rd library |
13:26:52 | FromDiscord | <enthus1ast> poor mans "Result" could be options |
13:26:52 | FromDiscord | <flywind> https://github.com/arnetheduck/nim-result |
13:27:08 | FromDiscord | <sealmove> i know, Result is only useful if you need an accompanying value (for example error message) |
13:34:39 | FromDiscord | <dom96> In reply to @voidwalker "at the design phase.": start by doing some async http requests in a separate script to get the handle for it |
13:40:36 | FromDiscord | <sealmove> guys I want to implement an index operator which will return an option. For example instead of `x[str]` I want to write `x[str]?` or `x?[str]` or something similar. what's a correct syntax? |
13:43:14 | FromDiscord | <planetis> the correct syntax is neither, lol. It just doesn't work well, there is experimental dotOperators if you want to try. Is raising exceptions an option, pun intended? Catching exceptions leads to much cleaner code imo. |
13:44:11 | FromDiscord | <sealmove> well I need to extract values from a table and then pass the results to another proc |
13:44:46 | FromDiscord | <sealmove> really? you can't define custom index-like operators in nim? I am pretty sure i've seen them |
13:44:54 | FromDiscord | <sealmove> (edit) "really? you can't define custom index-like operators in nim? I am pretty sure i've seen them ... " added "in stdlib somewhere" |
13:47:28 | FromDiscord | <planetis> Its `[]` and `[]=` but the `?` thing might break it |
13:47:46 | FromDiscord | <sealmove> only `[]` and `[]=`... hmm ok |
13:54:22 | * | PMunch quit (Quit: Leaving) |
14:05:00 | FromDiscord | <d4rckh> how do i print an LPVOID? |
14:05:15 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=492p |
14:05:28 | FromDiscord | <d4rckh> (edit) "https://play.nim-lang.org/#ix=492p" => "https://play.nim-lang.org/#ix=492q" |
14:06:03 | FromDiscord | <d4rckh> ok casted it to a dword and it compiled fine |
14:06:07 | FromDiscord | <domosokrat> I think `{}` and `{}=` are also possible. parsejson uses them. |
14:06:33 | FromDiscord | <domosokrat> And don't forget, all can take multiple arguments |
14:06:54 | FromDiscord | <d4rckh> is it normal for it to be a negative number? https://media.discordapp.net/attachments/371759389889003532/1013811986456387584/unknown.png |
14:07:18 | FromDiscord | <d4rckh> oh its unsigned |
14:07:28 | FromDiscord | <d4rckh> how can i get a hex representation of it? |
14:08:59 | FromDiscord | <sealmove> `.hex()` |
14:09:51 | FromDiscord | <d4rckh> and thats from which lib? |
14:10:02 | FromDiscord | <sealmove> sorry it's `toHex()` actually, from `std/strutils` |
14:10:11 | FromDiscord | <d4rckh> got it |
14:16:13 | FromDiscord | <ravinder387> guys suppose i hv random numbers and I want to count number which is < 100. is there any count function exist in nim |
14:18:57 | FromDiscord | <SaAnd> if you have the numbers in a seq or array, you can use https://nim-lang.org/docs/sequtils.html#countIt.t%2Cuntyped%2Cuntypedlike this `mySeq.countIt(it < 100)` |
14:21:44 | FromDiscord | <ravinder387> if i wanna numbers between 300 to 500 |
14:22:12 | FromDiscord | <SaAnd> `mySeq.countIt(it in 300 .. 500)` |
14:22:22 | FromDiscord | <SaAnd> that is inclusive, 500 does count |
14:22:24 | FromDiscord | <ravinder387> thanks |
14:22:36 | FromDiscord | <SaAnd> you're welcome \:) |
14:22:48 | FromDiscord | <ravinder387> r u bot or real human |
14:23:26 | FromDiscord | <SaAnd> im a human |
14:23:26 | FromDiscord | <aru> we are an AI |
14:23:35 | FromDiscord | <dom96> We built this using Nim |
14:23:37 | FromDiscord | <dom96> State of the art AI |
14:23:40 | FromDiscord | <dom96> it even thinks its human |
14:23:43 | FromDiscord | <dom96> Don't listen to it |
14:23:46 | FromDiscord | <ravinder387> cool! |
14:23:54 | FromDiscord | <aru> lmao |
14:24:01 | FromDiscord | <SaAnd> hehe |
14:24:49 | FromDiscord | <aru> nah, we are just on matrix and there is a bridge to send our messages to discord, and the other way |
14:29:35 | FromDiscord | <SaAnd> with a bot monitoring the bridge |
14:30:02 | FromDiscord | <aru> smth like that |
14:42:22 | FromDiscord | <sealmove> if you have a `typedesc` and you know it's a pointer, is it possible to get the type as not pointer? |
14:44:31 | FromDiscord | <sealmove> ah in `typetraits` there is `pointerBase`, sweet |
15:06:37 | FromDiscord | <d4rckh> how can i convert a string `"\xFF\x01\x13........` to an array of bytes? |
15:07:29 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4931 |
15:07:32 | FromDiscord | <d4rckh> amazing... |
15:07:35 | FromDiscord | <d4rckh> (edit) |
15:07:44 | FromDiscord | <enthus1ast> but its a seq |
15:08:12 | FromDiscord | <d4rckh> lemme check if it works with seq's |
15:08:33 | FromDiscord | <d4rckh> nope, it doesnt |
15:08:45 | FromDiscord | <enthus1ast> what does not work |
15:08:50 | FromDiscord | <d4rckh> i want to use it with WriteProcessMemory |
15:09:02 | FromDiscord | <d4rckh> as the source |
15:09:02 | FromDiscord | <voidwalker> I think this is what you need @d4rckh https://github.com/status-im/nim-stew/blob/master/stew/byteutils.nim#L43 |
15:09:05 | FromDiscord | <enthus1ast> then you must do a |
15:09:10 | FromDiscord | <enthus1ast> addr foo[0] |
15:09:18 | FromDiscord | <enthus1ast> and foo.len |
15:10:06 | FromDiscord | <voidwalker> if you want to convert the hex values in the string to bytes |
15:10:26 | FromDiscord | <voidwalker> and not just each char of the string |
15:10:41 | FromDiscord | <d4rckh> how would an input string look like? |
15:14:13 | FromDiscord | <voidwalker> I think just the hex chars themselves, optionally starting with 0x |
15:14:40 | FromDiscord | <voidwalker> so you'd have to replace the "\x" with "" before converting |
15:32:19 | FromDiscord | <voidwalker> In reply to @dom96 "start by doing some": That's what I've been doing, and re-reading the same articles, but I didn't get any handles :[ |
15:33:21 | * | sagax joined #nim |
15:35:44 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4937 |
15:36:15 | FromDiscord | <voidwalker> if `myGetIMDBCoverURL` returns a Future[string], then shouldn't the code above not block when calling it ? |
15:36:29 | * | CyberTailor joined #nim |
15:36:34 | FromDiscord | <voidwalker> I get a "does it block" every ~1second or so |
15:36:47 | * | CyberTailor left #nim (#nim) |
15:49:09 | FromDiscord | <dom96> what does `myGetIMDBCoverURL` look like? |
15:50:06 | FromDiscord | <aru> Is there a way in `nim doc` to create separate sections appart from "procedures, types, etc" and put there specific procedures? |
15:50:32 | FromDiscord | <aru> like, I want to put the first three here in their own "Getters & Setters" section |
15:50:40 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=493c |
15:50:54 | FromDiscord | <aru> image.png https://media.discordapp.net/attachments/371759389889003532/1013838157034311690/image.png |
15:50:59 | FromDiscord | <voidwalker> I just noticed it has httpClient used in it, not the async one |
15:51:25 | FromDiscord | <voidwalker> but nontheless, shouldn't it not block if it's marked with async ? |
15:52:54 | FromDiscord | <halc> In reply to @voidwalker "but nontheless, shouldn't it": it should block, the code within the proc itself executes immediately, otherwise you couldn't get a `Future[string]` |
15:55:06 | FromDiscord | <voidwalker> I thought that was the point of the Future[whatever], that it is returned immediately and can be checked for completion later |
15:55:54 | FromDiscord | <halc> In reply to @voidwalker "I thought that was": you return an empty Future, which will later be completed |
15:56:01 | FromDiscord | <halc> I know async programming can be a bit mind-boggling at first lol |
15:56:37 | FromDiscord | <IDF> a `Future[T]` is a value that will complete in the `future`, it doesnt complete by itself |
15:57:22 | FromDiscord | <voidwalker> yes, but it's a value that is returned immediately, no ? |
15:57:39 | FromDiscord | <voidwalker> it doesn't wait one cycle for the proc that returns it to complete ;-? |
15:58:11 | FromDiscord | <voidwalker> the future object i mean, in its unfinished state |
15:59:11 | FromDiscord | <IDF> its just a value, if the function is blocking youd still need for the function to finish for the future to be returned |
16:01:18 | FromDiscord | <voidwalker> well aren't all async functions non blocking ? |
16:01:31 | FromDiscord | <voidwalker> since they return Future[T] immediately by definition ? |
16:02:47 | FromDiscord | <halc> In reply to @voidwalker "well aren't all async": when you call the function, even if you don't `await` it, the code within the function will be executed immediately, the point is that the async function should only run the necessary code to set up whatever IO request you need, that's why it's "non-blocking", because we don't wait for the response |
16:03:06 | FromDiscord | <halc> hence why it returns an empty future |
16:04:04 | FromDiscord | <halc> (edit) "set up" => "send" |
16:04:37 | FromDiscord | <voidwalker> ohhh |
16:05:15 | FromDiscord | <IDF> the point is your function is still gonna execute some initialisation for your resulting future to be returned |
16:05:17 | FromDiscord | <voidwalker> they should have just made a damn animation with the program flow.. I cannot believe i am back to the basics after so many hours of reading : D |
16:05:25 | FromDiscord | <IDF> it doesnt just plop a future |
16:06:01 | FromDiscord | <voidwalker> I thought it just plops a future :\ |
16:06:11 | FromDiscord | <halc> In reply to @voidwalker "they should have just": it's already, I still get confused from time to time when dealing with async stuff lol |
16:06:15 | FromDiscord | <halc> (edit) "already," => "alright," |
16:06:48 | FromDiscord | <IDF> the nonblocking part comes when you need to retrieve a result from the future |
16:07:09 | FromDiscord | <IDF> which involves closures and whatnot |
16:08:48 | FromDiscord | <IDF> In reply to @voidwalker "take this code for": so here you would want all your functions that are called to be async |
16:09:42 | FromDiscord | <voidwalker> https://peterme.net/asynchronous-programming-in-nim.html |
16:10:01 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix= |
16:10:33 | FromDiscord | <voidwalker> so in my case the waiting could be because of not using asynchttp ? |
16:11:26 | FromDiscord | <voidwalker> omg that was it ! |
16:11:52 | FromDiscord | <voidwalker> Now it echoes all the "does it block" in a flash |
16:12:31 | FromDiscord | <voidwalker> ok, small progress, moving on : ) |
16:12:52 | FromDiscord | <IDF> sent a code paste, see https://play.nim-lang.org/#ix=493n |
16:14:46 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=493o |
16:14:58 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=493p |
16:15:08 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=493p" => "https://play.nim-lang.org/#ix=493q" |
16:15:59 | FromDiscord | <voidwalker> it's instant as in, the Future object is returned, without waiting for its comletion, and the next code gets executed |
16:16:16 | FromDiscord | <IDF> yes thats what i said |
16:17:01 | FromDiscord | <voidwalker> But then why did my async proc using httpClient instead of asyncHttpClient blocked? |
16:17:12 | FromDiscord | <voidwalker> (edit) "blocked?" => "block?" |
16:18:22 | FromDiscord | <IDF> its obvious, httpClient code is blocking, so the calls inside your async function defintion will block the thread |
16:18:51 | FromDiscord | <voidwalker> oh I think I get it now |
16:20:19 | FromDiscord | <IDF> basically what the `async` pragma does is to run a macro on the function to turn the body of your proc into closure iterators and other initialisers |
16:20:33 | FromDiscord | <voidwalker> so all the calls to that proc got executed concurrently, but an instruction that is "blocking", like that httpCall that takes ~1s to complete, makes it look like it's not |
16:20:41 | FromDiscord | <IDF> if your code is blocking, like httpclient, its going to block those iterators |
16:20:47 | FromDiscord | <IDF> (edit) "if your code is blocking, like ... httpclient," added "the procs in" |
16:22:12 | FromDiscord | <voidwalker> ok now I am curious to know the order in which things get processed |
16:22:26 | FromDiscord | <voidwalker> does step by step debug work for async ? |
16:22:52 | FromDiscord | <IDF> probably |
16:23:01 | FromDiscord | <IDF> it should work |
16:23:04 | FromDiscord | <IDF> its on a single thread anyway |
16:23:07 | FromDiscord | <voidwalker> Didn't figure out how to use the debugger in VSCodium, I was relying solely on echoes to debug |
16:23:30 | FromDiscord | <IDF> i dont think i ever used a debugger with nim |
16:29:38 | FromDiscord | <voidwalker> Ok I think I finally understood.. so the actual code in async procs actually gets executed "in order", and the program moves on executing where it was "left" when it encounters another async type of call |
16:30:07 | FromDiscord | <voidwalker> like asyncSleep, asyncHttp, or await of an async proc in another async proc |
16:31:22 | FromDiscord | <Rika> async functions only "leave" when you use `await` |
16:31:31 | FromDiscord | <Rika> all other functions are sync and run like in sync |
16:31:50 | FromDiscord | <IDF> ^ |
16:32:10 | FromDiscord | <Rika> give me an example you might not understand and ill try to explain it |
16:32:24 | FromDiscord | <halc> sent a code paste, see https://play.nim-lang.org/#ix=493x |
16:32:41 | FromDiscord | <halc> (edit) "https://play.nim-lang.org/#ix=493x" => "https://play.nim-lang.org/#ix=493y" |
16:33:01 | FromDiscord | <voidwalker> yeah thats what I just did halc, put echoes everywhere in that example from https://peterme.net/asynchronous-programming-in-nim.html |
16:33:30 | FromDiscord | <voidwalker> this is what confused me: |
16:33:34 | FromDiscord | <voidwalker> sent a code paste, see https://paste.rs/fmr |
16:33:59 | FromDiscord | <IDF> it is instant in the sense that its not waiting for the response |
16:34:08 | FromDiscord | <halc> sent a code paste, see https://play.nim-lang.org/#ix=493A |
16:34:29 | FromDiscord | <voidwalker> I read it as "async functions immediately return a Future[Type] |
16:34:36 | FromDiscord | <IDF> thats not possible |
16:34:40 | FromDiscord | <IDF> well |
16:34:44 | FromDiscord | <IDF> they do |
16:34:48 | FromDiscord | <IDF> but then every function returns a value instantly |
16:34:51 | FromDiscord | <voidwalker> Well, that was where the confusion came from |
16:34:51 | FromDiscord | <IDF> (edit) "instantly" => ""instantly"" |
16:34:53 | FromDiscord | <halc> In reply to @voidwalker "I read it as": yeah I can see how it could be read that way |
16:34:56 | FromDiscord | <Rika> they only "immediately return" if the first statement is an await |
16:35:01 | FromDiscord | <Rika> otherwise, no guarantees |
16:35:18 | FromDiscord | <voidwalker> The first one was when I thought await actually means "let a thing run in background" |
16:35:19 | FromDiscord | <voidwalker> lol |
16:35:31 | FromDiscord | <Rika> well, technically, yes |
16:35:42 | FromDiscord | <Rika> "wait for this future and yield my control" |
16:35:55 | FromDiscord | <Rika> "give it back when the future's done" |
16:35:57 | FromDiscord | <IDF> "give me an unreadable error if i messed up" |
16:36:27 | FromDiscord | <Rika> In reply to @Rika ""give it back when": "and when another proc yields its control" |
16:36:51 | FromDiscord | <Rika> ngl, the lua book would probably help you understand |
16:37:02 | FromDiscord | <voidwalker> Can't immagine how hard is that CPS stuff from the nimskull gang to understand for a noob, if this caused so much brainfuckery |
16:37:12 | FromDiscord | <Rika> i thought their explanation of async was good, even though i didnt really need it by the time i read it |
16:37:19 | FromDiscord | <IDF> cps itself as a concept is simpler actually |
16:37:32 | FromDiscord | <IDF> and similar |
16:37:37 | FromDiscord | <Rika> await is almost like trampoline |
16:37:41 | FromDiscord | <Rika> just the context is elised |
16:37:53 | FromDiscord | <Rika> etc etc theres a lot in common |
16:38:42 | FromDiscord | <halc> In reply to @voidwalker "The first one was": everything happens in one thread, so yeah, we don't really run much on the "background" so to speak, there is no parallelism, we just jump around the code to do other stuff when we'd otherwise have to wait |
16:39:28 | FromDiscord | <halc> it's like, you order a pizza, you don't just stand there in from of the door and wait, you do other stuff in the meantime |
16:39:34 | FromDiscord | <halc> (edit) "from" => "front" |
16:39:37 | FromDiscord | <Rika> In reply to @halc "everything happens in one": atalowleveltechnicallythereisparallelisminsomesense |
16:40:18 | FromDiscord | <dom96> ouch |
16:40:22 | FromDiscord | <halc> In reply to @Rika "atalowleveltechnicallythereisparallelisminsomesense": weeeeeeelll, yeah technically, just like technically there the cpu clock is alwys running lol |
16:40:23 | FromDiscord | <aru> rika lost his spaces |
16:40:29 | FromDiscord | <halc> (edit) "alwys" => "always" |
16:40:32 | FromDiscord | <dom96> it would be nice if the async macro could detect blocking IO and give you an error when you try to use it |
16:40:37 | FromDiscord | <halc> (edit) removed "there" |
16:40:44 | FromDiscord | <dom96> but yeah, it doesn't magically make blocking operations non-blocking |
16:40:46 | FromDiscord | <IDF> then it would error out constantly |
16:41:08 | FromDiscord | <dom96> if you do `sleep(1000)` then you block your thread and async won't be able to run anything in the background (this is why there is a `sleepAsync` |
16:41:15 | FromDiscord | <Rika> either that or you'd have to mark all instances of "blocking io" |
16:41:24 | FromDiscord | <dom96> In reply to @IDF "then it would error": no it wouldn't |
16:42:02 | FromDiscord | <IDF> alright |
16:42:29 | FromDiscord | <dom96> lol, glad I can convince you that easily |
16:42:36 | FromDiscord | <Rika> lmao |
16:44:08 | FromDiscord | <dom96> There are many ways to implement this. If doing it with Nim's effect system then you would just cast the blocking effects away on the system calls that may block |
16:44:21 | FromDiscord | <dom96> (when called via their async counterparts) |
16:44:32 | FromDiscord | <voidwalker> ok so if i have an array of Future[string], and assign each one the result of a proc that returns a Future[string], it seems they never "finish" |
16:44:34 | FromDiscord | <dom96> (and those async counterparts would of course ensure everything is non-blocking) |
16:45:05 | FromDiscord | <Rika> if youre going to mark the syscalls then how would file io work, since its only blocking in stdlib nim? would you fake it by also casting there? |
16:45:21 | FromDiscord | <IDF> also stuff like `os` |
16:45:39 | FromDiscord | <dom96> Depends. Right now file IO does block lol |
16:45:39 | FromDiscord | <IDF> it would require everything to have an async counterpart for it to work properly |
16:45:42 | FromDiscord | <dom96> even under async |
16:45:55 | FromDiscord | <IDF> yes i, i felt that, and was badly surprised when i found out asyncfile also blocks |
16:46:02 | FromDiscord | <Rika> In reply to @IDF "it would require everything": sure would be nice if there were |
16:46:03 | FromDiscord | <dom96> If you want to do it properly then you'd likely just spawn a new thread |
16:46:09 | FromDiscord | <dom96> afaik that's how node does it too |
16:46:16 | FromDiscord | <Rika> how pleasant |
16:46:20 | FromDiscord | <IDF> this |
16:47:09 | FromDiscord | <IDF> would be pleasant if it was on BEAM or something |
16:47:57 | FromDiscord | <dom96> I wonder if Node has any synchronous IO |
16:48:07 | FromDiscord | <dom96> It feels like JS managed to create a ecosystem that is async-by-default |
16:48:25 | FromDiscord | <dom96> But I don't have enough node knowledge to know for certain |
16:49:33 | FromDiscord | <leorize> node uses libuv so it does have fully async io |
16:50:02 | FromDiscord | <IDF> In reply to @dom96 "It feels like JS": pretty much |
16:50:19 | FromDiscord | <IDF> and its prone to race condition |
16:50:21 | FromDiscord | <IDF> (edit) "condition" => "conditions" |
16:50:30 | FromDiscord | <IDF> and the browser being rude to you |
16:53:55 | FromDiscord | <dom96> looks like it does in fact have sync IO functions https://nodejs.org/api/fs.html#fsreadfilesyncpath-options |
16:53:57 | FromDiscord | <voidwalker> Alright, so this code works so far, I get all my strings: |
16:54:33 | FromDiscord | <dom96> wonder how many folks accidentally use those without realising it will screw up their event loop |
16:54:42 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=493P |
16:55:11 | FromDiscord | <dom96> @voidwalker you're running the event loop yourself there, from what the author of fidgetty has said this should be done for you |
16:55:14 | FromDiscord | <voidwalker> only I don't want to waitFor all futures to finish, I want to poll each one and start a new async job for each finished one |
16:55:41 | FromDiscord | <voidwalker> @dom96 yeah, I want to figure it out on my own first, adding the extra "gui event loop" complicates things conceptually for me |
16:55:48 | FromDiscord | <dom96> fair enough |
16:56:04 | FromDiscord | <dom96> though note that calling `waitFor` in an async proc is blocking |
16:56:35 | FromDiscord | <voidwalker> yeah I know, that's what I wanted to ask, what is the proper wat to poll if each future is finished here ? |
16:56:49 | FromDiscord | <voidwalker> if I just check it, it looks like they never finish |
16:56:57 | FromDiscord | <voidwalker> if I don't have "waitFor" |
16:57:53 | FromDiscord | <dom96> `await` |
16:59:17 | FromDiscord | <dom96> It might be easier for you to verify this works without fidgetty first |
16:59:34 | FromDiscord | <dom96> just call `startPosters` at the top level of your code with `waitFor startPosters()` |
17:00:07 | FromDiscord | <voidwalker> I am running it inside the fidgetty code indeed.. hmm |
17:10:53 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=493U |
17:11:20 | FromDiscord | <voidwalker> ` while not all(poster_urls_fut).finished:` - is this not the proper way to run a loop until all futures in posters_urls_fut are completed ? |
17:13:24 | FromDiscord | <Bung> you can use awaitAll await a sequence of futures |
17:18:33 | FromDiscord | <dom96> In reply to @voidwalker "` while not": no... just do `await all(poster_urls_fut)` |
17:18:50 | FromDiscord | <dom96> after that statement all your futures will be finished |
17:20:19 | FromDiscord | <voidwalker> well I don't want to wait for all. one of them might never finish, or take too long to finish. |
17:20:37 | FromDiscord | <voidwalker> I want to start the next async job as soon as any of them are finished |
17:21:08 | FromDiscord | <dom96> oh sorry, I misread |
17:21:59 | FromDiscord | <dom96> but I don't get what you're trying to do |
17:22:11 | FromDiscord | <dom96> why await them one by one if one of them might take forever to finish? |
17:22:19 | FromDiscord | <dom96> that shouldn't be possible in the first place |
17:24:22 | FromDiscord | <Bung> you can just wraps with withTimeout, await all makes code more clear, otherwise is too nested imo |
17:25:35 | FromDiscord | <Bung> and you while loop cause a block |
17:27:05 | FromDiscord | <Shiba> is it safe to use inc? |
17:27:14 | FromDiscord | <Shiba> is it safe to use incremental compiling , and does it work properly? |
17:27:26 | FromDiscord | <Shiba> (edit) "," => "?" |
17:31:40 | * | jmdaemon joined #nim |
17:35:12 | FromDiscord | <voidwalker> not trying to have the clearest code, but to understand how to deal with this damn things : D |
17:37:08 | FromDiscord | <voidwalker> @dom96 So far I have the url string I need, in a sequence of Future[string], all done in async. I want that as soon as one of those futures in the sequence completes, another async job to be started. That's why I can't await all() |
17:37:53 | FromDiscord | <voidwalker> none should take "forever" to finish, but maybe internet gets broken, and it will need a timeout.. I will think of that later, not important now |
17:39:51 | FromDiscord | <dom96> Okay, I get it |
17:40:02 | FromDiscord | <voidwalker> and await all() would mean, do not get past this line, until they are all completed |
17:40:19 | FromDiscord | <voidwalker> and if one of them takes a few secs to happen, that will block the program |
17:40:37 | FromDiscord | <dom96> sent a long message, see http://ix.io/493Y |
17:40:39 | FromDiscord | <voidwalker> yeah that's what I did |
17:40:53 | FromDiscord | <dom96> (edit) "long message," => "code paste," | "http://ix.io/493Y" => "https://play.nim-lang.org/#ix=493Z" |
17:41:02 | FromDiscord | <voidwalker> but if I don't have any waitFor/await, they seem to never complete |
17:41:50 | FromDiscord | <dom96> (edit) "https://play.nim-lang.org/#ix=493Z" => "https://play.nim-lang.org/#ix=4940" |
17:41:54 | FromDiscord | <voidwalker> that's why I awaited them one by one |
17:42:05 | FromDiscord | <dom96> finished^ |
17:42:08 | FromDiscord | <dom96> (edit) "https://play.nim-lang.org/#ix=4940" => "https://play.nim-lang.org/#ix=4941" |
17:42:09 | FromDiscord | <voidwalker> but maybe asyncCheck is the right thing to use here? |
17:43:40 | FromDiscord | <dom96> nope, shouldn't matter |
17:45:46 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4947 |
17:46:05 | FromDiscord | <voidwalker> the while loop runs forever, and no future is finished |
17:46:26 | FromDiscord | <voidwalker> but if I put the sleepAsync inside the while loop , like: |
17:46:33 | FromDiscord | <voidwalker> then they complete |
17:46:34 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4948 |
17:47:08 | FromDiscord | <dom96> yeah |
17:47:11 | FromDiscord | <dom96> you need it |
17:47:22 | FromDiscord | <Bubblie> how do you do const pointers in nim? |
17:47:24 | FromDiscord | <dom96> that's how you let the event loop run |
17:47:31 | FromDiscord | <voidwalker> so yeah that was my question, what is the proper event loop trigger do I need her |
17:47:35 | FromDiscord | <voidwalker> (edit) "her" => "here" |
17:47:43 | FromDiscord | <voidwalker> (edit) "do" => "that" |
17:48:22 | FromDiscord | <voidwalker> and how do I get the loop to stop once all the futures in that sequence are completed |
17:48:23 | FromDiscord | <dom96> actually what you want here is: |
17:48:26 | FromDiscord | <voidwalker> since my code didn't work |
17:48:30 | FromDiscord | <dom96> await any(poster_urls_fut) |
17:48:33 | FromDiscord | <dom96> instead of the sleepAsync |
17:49:02 | FromDiscord | <dom96> but apparently Nim stdlib doesn't have that lol |
17:49:18 | FromDiscord | <dom96> you can create it easily though |
17:49:35 | FromDiscord | <voidwalker> sleepAsync(1) should do for now ? |
17:51:18 | FromDiscord | <dom96> sure, but not as efficient as it could be |
17:54:30 | FromDiscord | <enthus1ast> quickly dumping data on c target, then loading in a const on the js target is quite annoying |
17:54:42 | FromDiscord | <enthus1ast> since it just does not work \:) |
17:55:40 | FromDiscord | <deech> Is the `pegs` in stdlib not capable of capturing more than 20 patterns in one run? https://github.com/nim-lang/Nim/blob/2b56b38235c7cdb60a952ee4ec684a053eeee47c/lib/pure/pegs.nim#L34 |
18:00:40 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=494d |
18:01:26 | FromDiscord | <voidwalker> ok so this concept will not work.. I have to trigger the download just once after a future in my sequence is finished. This is a ddos tool now : ) |
18:01:32 | FromDiscord | <dom96> don't use discard |
18:01:34 | FromDiscord | <dom96> on a future |
18:01:47 | FromDiscord | <dom96> this is where you'd use asyncCheck |
18:01:59 | FromDiscord | <aru> use `asyncCheck` |
18:01:59 | FromDiscord | <dom96> (discarding means that if the future fails you won't know about it) |
18:02:28 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=494e |
18:05:03 | FromDiscord | <domosokrat> Hm, I've been wondering, why not put the myGetIMDBCoverURL+downloadFile in an async proc and add the calls to this function to a seq? |
18:05:30 | FromDiscord | <voidwalker> yeah ok, got it. Point still remains though, this will call the downloadFile forever |
18:06:49 | FromDiscord | <voidwalker> @domosokrat because ... I am still trying to figure out how async works. Hard to design something when you don't know how the pieces go together |
18:07:58 | * | ggsx joined #nim |
18:08:17 | ggsx | is it possible to switch warning per folder/file? |
18:08:37 | FromDiscord | <voidwalker> so basically an async proc that has await myGetIMDBCoverURL(id), and await downloadFile(resultOf(myGetIMDBCoverURL(id)) ? |
18:08:42 | ggsx | usecase is a library that generates alot of warnings and I don't want to touch it |
18:08:56 | FromDiscord | <Forest [She/Her]> I wonder if it's possible for me to force Nim to give custom... warnings? pop-ups? in VSC |
18:10:04 | FromDiscord | <voidwalker> That is actually a very neat idea .. why didn't I think of that : ) Still stuck in the for/while loops frame of mind : |
18:10:32 | FromDiscord | <domosokrat> yes, that's what I meant |
18:11:23 | * | ggsx quit (Client Quit) |
18:11:40 | FromDiscord | <voidwalker> so I don't have to manually check if the first batch of async jobs are finished, it will take care of itself automatically |
18:12:10 | FromDiscord | <voidwalker> just have to check if the very end result of each such proc is finished, so I can display the downloaded picture |
18:13:44 | FromDiscord | <domosokrat> I think that's often the right approach, when you want to handle multiple resources the same way asyncronously\: Write a proc that handles one instance and call that for all resources |
18:16:50 | FromDiscord | <voidwalker> Yeah that is the obvious conclusion once you understand how the code jumps aroudn in async |
18:16:56 | FromDiscord | <voidwalker> https://play.nim-lang.org/#ix=494j |
18:17:12 | FromDiscord | <voidwalker> any idea why this code doesn't run on play nim ? |
18:19:31 | * | ggsx joined #nim |
18:20:47 | FromDiscord | <auxym> Any way I can get a compile-time proc to write a file to the cache dir when called? |
18:23:29 | FromDiscord | <domosokrat> no idea why it fails in the playground |
18:27:36 | FromDiscord | <domosokrat> @auxym\: hmm. use `staticExec("cat >"& nimCacheDir() & filename, text_to_write)` |
18:38:26 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=494r |
18:39:09 | FromDiscord | <Forest [She/Her]> How do i tell the compiler that a certain variable, which has a common root with others, is actually this type |
18:40:01 | FromDiscord | <Forest [She/Her]> So `BaseType = ref object of RootObj` is the common root, and i have a sequence containing multiple objects inheriting from BaseType but each having their own type |
18:40:59 | FromDiscord | <vestel> In reply to @Forest "How do i tell": you mean like base type of derived? |
18:41:11 | FromDiscord | <Forest [She/Her]> Yeah |
18:42:04 | FromDiscord | <vestel> you wanna do some polymorphism or what? |
18:42:54 | FromDiscord | <Forest [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=494t |
18:42:56 | FromDiscord | <Forest [She/Her]> In reply to @vestel "you wanna do some": No idea what you mean by that |
18:43:38 | FromDiscord | <Forest [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=494u |
18:43:40 | FromDiscord | <Forest [She/Her]> And then do stuff according to that |
18:43:44 | FromDiscord | <Elegantbeef> `BaseType MyTypeOne` |
18:44:03 | FromDiscord | <Elegantbeef> `if myVal of MyTypeOne` |
18:44:05 | FromDiscord | <vestel> In reply to @Forest "And then do stuff": try methods |
18:44:18 | FromDiscord | <Forest [She/Her]> In reply to @Elegantbeef "`if myVal of MyTypeOne`": Ah thanks! |
18:46:23 | FromDiscord | <Forest [She/Her]> In reply to @Elegantbeef "`if myVal of MyTypeOne`": It says the field is undefined |
18:48:16 | FromDiscord | <Elegantbeef> You need to convert back to that type |
18:48:36 | FromDiscord | <Forest [She/Her]> Just did `let clsc = JavaClass cls` and hopefully now it should work |
18:48:37 | FromDiscord | <Forest [She/Her]> Ah okay |
18:50:32 | FromDiscord | <Forest [She/Her]> Eyyy my code works |
18:50:38 | * | ggsx quit (Quit: Ping timeout (120 seconds)) |
18:51:06 | * | Burt_Harbinson__ joined #nim |
18:51:44 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=494z |
18:51:52 | FromDiscord | <enthus1ast> is this supposed to work? |
18:52:07 | FromDiscord | <Elegantbeef> Probably |
18:52:11 | FromDiscord | <enthus1ast> yeah, its not \:) |
18:52:33 | Burt_Harbinson__ | Hello everyone. Is it possible to exit an iterator early? |
18:52:44 | FromDiscord | <Elegantbeef> `break` |
18:52:52 | Burt_Harbinson__ | hm |
18:53:39 | Burt_Harbinson__ | I get: invalid control flow: break |
18:53:54 | Burt_Harbinson__ | note this is outside the main while loop of the iterator |
18:54:00 | FromDiscord | <Elegantbeef> You're in a for loop right? |
18:54:05 | FromDiscord | <enthus1ast> 10% doing the stuff i actually wanted to to do, 90% trying to serialize data; fck think i'm done for the day |
18:54:16 | FromDiscord | <Elegantbeef> You cannot break an iterator outside of an iterator |
18:54:26 | FromDiscord | <vestel> use blocks |
18:55:07 | Burt_Harbinson__ | Right, I will read up on blocks... thank you |
18:55:31 | FromDiscord | <Phil> In reply to @enthus1ast "10% doing the stuff": ~~I'm waiting 60% of the time for PR feedback, I'm not sure which is worse~~ |
18:55:52 | Burt_Harbinson__ | it is possible to add an extra if statement and put the main while loop inside the else clause but i wanted to avoid extra indentation... then again, indent is 2 spaces so gives a fudge |
18:56:11 | FromDiscord | <vestel> if expression |
18:56:11 | FromDiscord | <Phil> I need to see code |
18:56:28 | FromDiscord | <Phil> If I am to evaluate anything |
18:57:54 | FromDiscord | <enthus1ast> i kinda actually lost interest in the stuff i wanted to do, since it should be just a quick hack↵(@Phil) |
18:58:25 | FromDiscord | <Phil> In reply to @enthus1ast "i kinda actually lost": Similar with me and webgui, the recent "Yeah, haha, your app isn't bundling zone.js so screw yourself" issue made me just so tired |
18:58:47 | FromDiscord | <Phil> I'm looking forward to moigagoo finally giving some sort of life-sign regarding the PRs on norm so I can continue on those |
19:01:00 | * | PMunch joined #nim |
19:01:23 | FromDiscord | <enthus1ast> wondering what zone.js is |
19:02:09 | FromDiscord | <Phil> Apparently angular wrapped all browser request APIs for their change detection mechanims which is how they decide when to trigger re-renders |
19:02:33 | FromDiscord | <enthus1ast> thank you |
19:02:36 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=494F |
19:02:49 | FromDiscord | <Phil> Ah yes, documentation |
19:02:56 | FromDiscord | <Phil> It documents behaviour and provides information |
19:03:10 | FromDiscord | <Phil> of javascript even |
19:03:33 | FromDiscord | <enthus1ast> "florbisch.js" implements "florbishs" for js inspired by Badonkle |
19:03:50 | FromDiscord | <Phil> Stop enthus1ast, stop! |
19:03:56 | FromDiscord | <Phil> You are drowning me in information |
19:03:57 | FromDiscord | <vestel> still beaten by is-odd.js |
19:04:00 | FromDiscord | <Phil> I can not comprehend all of this |
19:04:58 | FromDiscord | <enthus1ast> hacks and magic↵(@Phil) |
19:06:46 | FromDiscord | <Phil> In reply to @enthus1ast "hacks and magic (<@180601887916163073>)": Ever since I made my own wrap over norm's APIs I've learned to appreciate wrapping an existing API just to be able to use it in a slightly simpler manner and add some side-effect systems |
19:06:58 | FromDiscord | <enthus1ast> this is actually a good name, i know what the package does just by reading its name↵(@vestel) |
19:07:53 | FromDiscord | <vestel> In reply to @enthus1ast "this is actually a": i mean why the heck there is that packet on npm |
19:08:17 | FromDiscord | <enthus1ast> to later change it to malware of course↵(@vestel) |
19:09:29 | FromDiscord | <vestel> acceptable |
19:14:14 | FromDiscord | <Phil> Burt_Harbinson , my comment about needing to see code was directed at you btw, asking you to provide some "draft" of code for what you'd want to do that we can give feedback on so we don't have to guess at what language construct you're trying to build |
19:39:14 | FromDiscord | <Bubblie> So uh |
19:39:21 | FromDiscord | <Bubblie> Is there any const pointers in nim? |
19:39:25 | FromDiscord | <Bubblie> Like how would one perform this |
19:40:37 | FromDiscord | <vestel> const pointer or pointer to const object? |
19:41:21 | FromDiscord | <Forest [She/Her]> In Nim is it an acceptable practice to split up a single file of code into smaller files that contain methods only relevant to the type they were made for? |
19:41:37 | FromDiscord | <vestel> yes |
19:41:49 | FromDiscord | <Forest [She/Her]> Sweet |
19:44:29 | FromDiscord | <Phil> In reply to @Forest "In Nim is it": Not just acceptable, I do that extensively and I would even go as far as declaring that as best practice to have small module whose contents you can comprehend rather than single massive modules |
19:44:31 | PMunch | I'd say that's even good practice |
19:45:14 | FromDiscord | <vestel> i think it depends on size of type and procs |
19:45:18 | FromDiscord | <Phil> Nim even has 2 ways of doing it (import and include) depending on what you need technically, though import is the correct choice 99% of the time |
19:45:26 | FromDiscord | <Forest [She/Her]> Thank god then, my file was getting really messy and it's like, 250 lines (not even big to others ig buuuuut) |
19:46:14 | FromDiscord | <Phil> In reply to @Forest "Thank god then, my": Just for reference, above 200 lines I start keeping in the back of my head to look for a clear line in the concept that is contained in this module to split it apart |
19:46:35 | FromDiscord | <Forest [She/Her]> Fair! |
19:46:50 | FromDiscord | <Phil> Most of my modules are in the w0-200 lines range |
19:46:54 | FromDiscord | <Phil> (edit) "w0-200" => "20-200" |
19:49:09 | FromDiscord | <Forest [She/Her]> I'm trying to keep this maintainable for me even if i don't look at it for a month ngl |
19:49:21 | FromDiscord | <Forest [She/Her]> Since code generation is just being a pain to write in a flexible way :p |
19:49:30 | FromDiscord | <vestel> In reply to @Forest "I'm trying to keep": very ambitious goal |
19:50:27 | FromDiscord | <Forest [She/Her]> Absolutely lmao |
19:54:01 | FromDiscord | <Phil> In reply to @Forest "I'm trying to keep": May I introduce you to the concept of documentation 😛 ? |
19:54:32 | FromDiscord | <Phil> Yeah I know, typically you do not need docs for yourself, but it can help enshrining and solidifying some ways that you organized your code a bit more |
19:54:39 | FromDiscord | <Phil> E.g. I have a strict separation in my backend |
19:55:59 | FromDiscord | <Forest [She/Her]> In reply to @Isofruit "May I introduce you": I'm writing comments if that counts? :P |
19:56:48 | FromDiscord | <Phil> I split my tables and the concepts they represent into domain folders. That will contain up to 8 bespoken modules for always the same tasks:↵Repository, Service, Controllers, Deserialization, Serialization, Utils, Model, Routes, Signals↵So far that covered all my usecases ever |
19:57:19 | FromDiscord | <domosokrat> `inc a # increment a`↵(@Forest) |
19:57:26 | FromDiscord | <Forest [She/Her]> Oh that's neat, but none of them is applicable to mine accept utils lmao |
19:57:33 | FromDiscord | <Forest [She/Her]> Except |
19:57:42 | FromDiscord | <Forest [She/Her]> In reply to @domosokrat "`inc a #": Mood |
19:58:19 | FromDiscord | <Phil> I wasn't trying to get you to apply the very same logic split, but more expand on the concept and that in general you can think on which repetitive pieces of logic you have that may allow you to apply a consistent naming scheme |
19:58:31 | FromDiscord | <aru> ha! my biggest modlue has 450 lines!↵(@Forest) |
20:00:09 | FromDiscord | <Phil> It helps if you're already pretty familiar with the problem domain you're in and know the "standard ways" people in there typically split their logic↵Mine is mostly applicable to web-applications, yours is almost guaranteed to be different due to dealing with different problems |
20:01:49 | FromDiscord | <Forest [She/Her]> In reply to @Isofruit "I wasn't trying to": Ah fair! |
20:02:01 | FromDiscord | <Forest [She/Her]> In reply to @Isofruit "It helps if you're": Yup! |
20:02:34 | FromDiscord | <Forest [She/Her]> In reply to @aru "ha! my biggest modlue": I remember when i was trying to write a Minecraft bridge to Mindustry (a completely different game), and then just giving up because it became unmaintainable lmao |
20:02:56 | FromDiscord | <Forest [She/Her]> Honestly i just need to work on macros that generate Java code now, most of my work (for generating Java code) is done |
20:08:12 | FromDiscord | <sealmove> But do you want to convert the whole Nim spec? Or only a subset? |
20:08:13 | * | PMunch quit (Quit: leaving) |
20:08:40 | FromDiscord | <Forest [She/Her]> In reply to @รєคɭ๓๏שє "But do you want": Just a subset |
20:08:44 | FromDiscord | <Forest [She/Her]> Not even a subset really |
20:09:00 | FromDiscord | <Forest [She/Her]> Just a more idiomatic way to write Java within Nim |
20:09:18 | FromDiscord | <Forest [She/Her]> With Nim, not within |
20:09:30 | FromDiscord | <Forest [She/Her]> I've also encountered a very weird bug |
20:10:24 | FromDiscord | <Forest [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4955 |
20:10:42 | FromDiscord | <aru> ah I encountered that too previously |
20:11:05 | FromDiscord | <aru> `../[a, b]` works tho |
20:11:22 | FromDiscord | <aru> so idk why `./[a, b]` doesn't |
20:11:35 | FromDiscord | <Forest [She/Her]> Huh, odd |
20:12:03 | FromDiscord | <sealmove> In reply to @Forest "With* Nim, not within": What's your motivation though |
20:12:52 | * | Vladar quit (Quit: Leaving) |
20:13:20 | FromDiscord | <Forest [She/Her]> In reply to @รєคɭ๓๏שє "What's your motivation though": Oh, my motivation is to allow you to output Java code that can be compiled with `javac`, in a way that feels natural/familiar with Nim |
20:14:21 | FromDiscord | <Forest [She/Her]> I still don't really have the best idea on how to do this though, but i had an idea with macros to do something like: (writing the example code now) |
20:15:49 | FromDiscord | <aru> `expression expected but found "."` or smth like that was the error irc |
20:18:57 | FromDiscord | <Forest [She/Her]> Hm, I can't write an example that conveys how i want it to feel... |
20:19:19 | FromDiscord | <Forest [She/Her]> In reply to @รєคɭ๓๏שє "What's your motivation though": I just really want it to feel more like Nim, even if you're writing code that generates Java files |
20:19:47 | FromDiscord | <Forest [She/Her]> In reply to @aru "`expression expected but found": Says for me `cannot open file: ./[keywords, types]` |
20:20:18 | FromDiscord | <aru> hmmm |
20:21:37 | FromDiscord | <Forest [She/Her]> But individually importing them is fine, sooo |
20:22:06 | FromDiscord | <aru> yh, doing `./Module` works |
20:25:57 | FromDiscord | <Forest [She/Her]> Yup |
20:26:12 | FromDiscord | <Forest [She/Her]> Hey aruZeta |
20:26:26 | FromDiscord | <Forest [She/Her]> Could you give me a minimal example of how you'd like to write Java code in Nim? |
20:26:41 | FromDiscord | <Forest [She/Her]> Like, with macros/functions/pragmas |
20:26:52 | FromDiscord | <Forest [She/Her]> Instead of just normal direct code (because sadly i can't do that yet) |
20:27:45 | FromDiscord | <dom96> In reply to @Forest "Oh, my motivation is": what's your motivation for outputting Java code? |
20:28:51 | FromDiscord | <Forest [She/Her]> In reply to @dom96 "what's your motivation for": It's so Nim can run on the JVM, i specifically want to make a Minecraft mod in Nim for fun lmao |
20:29:03 | FromDiscord | <Forest [She/Her]> I really like Minecraft, but i hate Java (but i do know it) |
20:29:44 | FromDiscord | <Forest [She/Her]> I love Nim, but it can't be compiled to work on the JVM, sure i can use JS but I don't want to rely on something like KubeJS or GraalJS (GraalJS is big in general) |
20:30:10 | FromDiscord | <Forest [She/Her]> With direct code generation in Nim, i can make it output Java code with minimal Nim |
20:30:36 | FromDiscord | <Forest [She/Her]> If there's something else you guys are meaning and I'm not quite getting, sorry 😅 I'm autistic and struggle with that stuff at times aha |
20:31:01 | FromDiscord | <dom96> Don't worry, I get it :) |
20:32:56 | FromDiscord | <aru> damn, dom is talking with the air (again?) |
20:33:14 | * | rockcavera joined #nim |
20:33:14 | * | rockcavera quit (Changing host) |
20:33:15 | * | rockcavera joined #nim |
20:33:34 | FromDiscord | <Superstart033> You want to Nim to compile to Java and that Java code to compile to the jvm? |
20:34:06 | FromDiscord | <Forest [She/Her]> Yup |
20:34:32 | FromDiscord | <Forest [She/Her]> It's source code since it allows users to emit their own custom java code (as a string) easily |
20:34:48 | FromDiscord | <dom96> In reply to @aru "damn, dom is talking": What do you mean? Is the Matrix bridge failing maybe? |
20:34:50 | FromDiscord | <Forest [She/Her]> If there's something that the code gen library can't do (yet) |
20:35:14 | FromDiscord | <dom96> IRC logs are pretty accurate in case you want to check: https://irclogs.nim-lang.org/29-08-2022.html#20:31:01 |
20:35:16 | FromDiscord | <aru> hdah seems to be the case↵(@dom96) |
20:35:38 | FromDiscord | <Superstart033> In reply to @Forest "Yup": That sounds incredible convoluted XD |
20:36:24 | FromDiscord | <aru> this was the last I saw lol |
20:36:24 | FromDiscord | <aru> image.png https://media.discordapp.net/attachments/371759389889003532/1013910010813751410/image.png |
20:36:39 | FromDiscord | <Superstart033> LMAO |
20:36:53 | FromDiscord | <dom96> you missed a lot then |
20:36:56 | FromDiscord | <dom96> lol |
20:37:22 | FromDiscord | <aruZeta> Yh lol, reading in here |
20:37:24 | FromDiscord | <Superstart033> Maybe you could connect Nim to Minecraft itself lol |
20:37:29 | FromDiscord | <Superstart033> With an api or something |
20:37:49 | FromDiscord | <dom96> yeah, you might be able to use the JNI |
20:38:09 | FromDiscord | <dom96> but do whatever makes you excited and eager to learn :) |
20:41:00 | FromDiscord | <Forest [She/Her]> In reply to @Superstart033 "That sounds incredible convoluted": Sorry aha |
20:41:26 | FromDiscord | <Forest [She/Her]> In reply to @Superstart033 "With an api or": I could buut that's not clean? So- |
20:41:53 | FromDiscord | <Forest [She/Her]> In reply to @dom96 "yeah, you might be": That's also an idea but it'd slow down the game a lot (also no Nim-Java Mixins xD) |
20:44:42 | FromDiscord | <Forest [She/Her]> Hm i need to figure out the ideal way to implement code generation... |
20:45:14 | FromDiscord | <Forest [She/Her]> Is it possible to do something with pragmas? |
20:45:28 | FromDiscord | <Forest [She/Her]> Hm... |
20:45:48 | FromDiscord | <Forest [She/Her]> Wait maybe templates + a custom object would work hmmmm |
20:46:21 | FromDiscord | <leetnewb> tosse 4859 |
20:46:40 | FromDiscord | <Elegantbeef> Leetnewb just leaked their password |
20:46:46 | FromDiscord | <leetnewb> sorry :p |
20:46:46 | FromDiscord | <Elegantbeef> I'm so sorry for this instance of sadness |
20:47:14 | FromDiscord | <leetnewb> migraine destroying my brain apparently |
20:47:20 | FromDiscord | <aru> sent a code paste, see https://play.nim-lang.org/#ix=495c |
20:47:48 | FromDiscord | <Forest [She/Her]> Oh that would work very well! |
20:47:58 | FromDiscord | <Forest [She/Her]> Thanks aruZeta! |
20:48:07 | FromDiscord | <aru> you will have to deal with lots of AST |
20:48:12 | FromDiscord | <Forest [She/Her]> Oh absolutely |
20:48:16 | FromDiscord | <Forest [She/Her]> It'll suck but |
20:48:18 | FromDiscord | <aru> so when you are at that you may find better approaches |
20:48:21 | FromDiscord | <Forest [She/Her]> Will help me learn- |
20:48:39 | FromDiscord | <dom96> In reply to @leetnewb "migraine destroying my brain": if that was a password you're using then be sure to reset it, you might have deleted it here but this channel is logged |
20:49:08 | FromDiscord | <aru> sent a code paste, see https://play.nim-lang.org/#ix=495e |
20:49:40 | FromDiscord | <aruZeta> Edits from the matrix do rly look bad here lol |
20:50:08 | FromDiscord | <leetnewb> In reply to @dom96 "if that was a": Thanks, nothing used for public interfaces. |
20:50:10 | FromDiscord | <Elegantbeef> "from the matrix" |
20:50:20 | FromDiscord | <leetnewb> or any important private for that matter :p |
20:50:48 | FromDiscord | <!Patitotective> lets leak our passwords too to make leetnewb feel better |
20:50:58 | FromDiscord | <Elegantbeef> hunter2 |
20:51:13 | FromDiscord | <dom96> ** |
20:51:14 | FromDiscord | <aru> mine is the same as yours, could you remind me? |
20:51:21 | FromDiscord | <dom96> oh what a cool feature |
20:51:24 | FromDiscord | <dom96> it hides my password |
20:51:25 | FromDiscord | <Elegantbeef> Nice try dom |
20:51:44 | FromDiscord | <dom96> also lol Discord changing that to a single asterisk |
20:51:49 | FromDiscord | <Elegantbeef> \\\\\\\\\ |
20:51:50 | FromDiscord | <dom96> yep, my password is 1 char |
20:51:53 | FromDiscord | <dom96> I like to live dangerously |
20:51:57 | FromDiscord | <aru> it's making it bold |
20:52:07 | FromDiscord | <aru> \\\\\ |
20:52:15 | FromDiscord | <Elegantbeef> It's those unescaped characters |
20:52:18 | FromDiscord | <Elegantbeef> Down with markdown |
20:52:23 | FromDiscord | <!Patitotective> 0xdeadbeef, best password |
20:52:24 | FromDiscord | <aru> you need to use a \\ to scape it |
20:52:45 | FromDiscord | <aru> lmao↵(@!Patitotective) |
20:53:15 | FromDiscord | <Elegantbeef> I feel threatened |
20:53:44 | FromDiscord | <leetnewb> I think you've been immortalized |
20:54:43 | FromDiscord | <aru> beef feels beefed |
20:54:50 | FromDiscord | <!Patitotective> 0xfeedbeef |
20:55:03 | FromDiscord | <!Patitotective> what do you like to eat beef |
20:55:05 | FromDiscord | <aru> hahahha |
20:55:13 | FromDiscord | <aru> beef of course |
20:56:44 | FromDiscord | <aru> wait beefed does actually exist in the dictionary? |
21:00:05 | FromDiscord | <Forest [She/Her]> In reply to @aruZeta "Edits from the matrix": Yeah lmao |
21:00:18 | * | rockcavera quit (Remote host closed the connection) |
21:00:35 | FromDiscord | <Forest [She/Her]> In reply to @dom96 "it hides my password": \\\\\\\\\ |
21:00:39 | FromDiscord | <Forest [She/Her]> Oh neat it works |
21:01:53 | FromDiscord | <Forest [She/Her]> Can macros take keyword arguments? :P |
21:02:17 | FromDiscord | <aru> as untyped? |
21:02:18 | FromDiscord | <aru> no |
21:02:31 | FromDiscord | <Forest [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=495h |
21:02:47 | FromDiscord | <d4rckh> Does importing specific functions instead of entire libs help reduce the binary size? |
21:02:50 | FromDiscord | <Forest [She/Her]> In reply to @aru "as untyped?": First two values would be strings |
21:03:07 | FromDiscord | <Elegantbeef> No dead code elimination removes any unusedcode↵(@d4rckh) |
21:03:27 | FromDiscord | <d4rckh> That's done by the compiler? |
21:03:31 | FromDiscord | <Forest [She/Her]> Commas are probably good for clarification :p |
21:03:35 | FromDiscord | <Forest [She/Her]> In reply to @d4rckh "That's done by the": Yup! |
21:03:46 | FromDiscord | <d4rckh> And how can I improve the file size of my program? |
21:04:05 | FromDiscord | <d4rckh> Right now it's 500kb, my goal would be ~250kb |
21:04:05 | FromDiscord | <Forest [She/Her]> There is the `--opt:size` parameter? |
21:04:20 | FromDiscord | <d4rckh> any disadvantages of using that? |
21:04:41 | FromDiscord | <Forest [She/Her]> Compiling with `-d:release --opt:size` (or `-d:danger` instead of release but iirc that's more dangerous) |
21:04:51 | FromDiscord | <Forest [She/Her]> In reply to @d4rckh "any disadvantages of using": Probably speed impacts but it shouldn't be that bad |
21:04:57 | FromDiscord | <Forest [She/Her]> I genuinely have no idea |
21:05:29 | FromDiscord | <d4rckh> It doesn't too much computing, just http requests |
21:05:40 | FromDiscord | <d4rckh> (edit) "too" => "do" |
21:06:23 | FromDiscord | <Elegantbeef> Yes |
21:06:25 | FromDiscord | <aru> sent a code paste, see https://play.nim-lang.org/#ix=495j |
21:06:30 | FromDiscord | <Elegantbeef> Any code that's unused is not included in the final binary |
21:06:48 | FromDiscord | <Elegantbeef> What flags are you using? |
21:07:15 | FromDiscord | <enthus1ast> stripping? |
21:07:20 | FromDiscord | <Elegantbeef> Generally `-d:useMalloc --gc:orc, -d:release -d:lto` will get you quite far |
21:07:28 | FromDiscord | <enthus1ast> --passl\:-s |
21:07:39 | FromDiscord | <enthus1ast> or ↵strip youapp.exe |
21:08:26 | FromDiscord | <Forest [She/Her]> In reply to @aru "I mean for example": Ah, okay then |
21:09:12 | FromDiscord | <aru> sent a code paste, see https://play.nim-lang.org/#ix=495k |
21:09:32 | FromDiscord | <Forest [She/Her]> That looks cursed- |
21:09:46 | FromDiscord | <Forest [She/Her]> But if it works, it works ig? :P |
21:09:48 | NimEventer | New thread by Deech: Captures in `peg` sub-parsers, see https://forum.nim-lang.org/t/9417 |
21:10:09 | FromDiscord | <aru> hahaha yh↵(@Forest) |
21:10:15 | FromDiscord | <voidwalker> @d4rckh https://hookrace.net/blog/nim-binary-size/ from 2015, and rather simple example, not sure how much is still valid, but a nice read |
21:10:50 | FromDiscord | <enthus1ast> avoid async, and use puppy for http requests \:) |
21:10:55 | FromDiscord | <Rainbow Asteroids> sent a code paste, see https://play.nim-lang.org/#ix=495l |
21:11:12 | FromDiscord | <Forest [She/Her]> Stropping? |
21:11:27 | FromDiscord | <aru> ah yh, backticks work too instead of `""` in my example @Forest |
21:11:46 | * | Burt_Harbinson__ quit (Quit: Leaving) |
21:12:05 | FromDiscord | <Forest [She/Her]> Ah okay |
21:12:07 | FromDiscord | <aru> but they add more complexity to the macro AST |
21:12:13 | FromDiscord | <Forest [She/Her]> https://github.com/Mythical-Forest-Collective/CodeGenLib is going very well |
21:12:48 | FromDiscord | <Forest [She/Her]> Last thing to implement is functions...theeen a way to automatically wrap classes and functions |
21:13:14 | FromDiscord | <Forest [She/Her]> I have method declaration implemented, but no way to actually define them |
21:14:50 | FromDiscord | <Forest [She/Her]> (edit) "define" => "generate" | "generatethem ... " added "(in the code)" |
22:29:49 | FromDiscord | <Forest [She/Her]> How do i insert a new key value pair into an OrderedTable? |
22:30:15 | FromDiscord | <Forest [She/Her]> Order is very important but I can't figure out how to add a value into an OrderedTable once it has been initialised :p |
22:31:23 | * | rockcavera joined #nim |
22:31:23 | * | rockcavera quit (Changing host) |
22:31:23 | * | rockcavera joined #nim |
22:33:04 | FromDiscord | <sealmove> ah it's the `[]=` operator |
22:33:17 | FromDiscord | <sealmove> you do `myTable[key] = value` |
22:35:11 | FromDiscord | <Forest [She/Her]> Nvm my code was faulty that was why it didn't work- |
22:35:24 | FromDiscord | <Forest [She/Her]> In reply to @รєคɭ๓๏שє "you do `myTable[key] =": Yeah figured that out, thanks xD |
22:36:38 | FromDiscord | <Forest [She/Her]> Now, i shall rest, goodnight all! |
22:37:08 | FromDiscord | <Forest [She/Her]> Hopefully tomorrow I'll finally work on the java code generator (with a more Nim-like syntax) |
22:37:13 | FromDiscord | <Forest [She/Her]> Idiomatic |
22:37:57 | FromDiscord | <!Patitotective> 🌃 |
23:03:58 | * | deadmarshal quit (Ping timeout: 244 seconds) |
23:09:04 | FromDiscord | <!Patitotective> are you there beef? |
23:12:28 | FromDiscord | <Elegantbeef> No |
23:13:40 | FromDiscord | <retkid> welp |
23:14:48 | FromDiscord | <!Patitotective> sooo beef↵(ignoring your parsing design for now)↵im doubtful about implementing the exceptions instead of my `ParseResult` because, then i would need to do a lot of catching so i was thinking in a `error` template that raises an error when the validation wasnt successful, tho how would i pass the error message? |
23:15:03 | FromDiscord | <retkid> anyone familiar with zippy, here |
23:15:10 | FromDiscord | <Elegantbeef> `msg: string` |
23:15:28 | FromDiscord | <!Patitotective> 🤓 |
23:16:42 | * | sagax quit (Quit: Konversation terminated!) |
23:17:03 | FromDiscord | <retkid> so |
23:17:07 | FromDiscord | <retkid> im working with zlib and |
23:17:35 | FromDiscord | <retkid> it kinda refuses to handle any zlib streams? |
23:19:43 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/1013951111247429641/wow.zlib |
23:20:13 | FromDiscord | <retkid> this is from a png file and I don't think there is any IEND or IDAT in there |
23:49:03 | * | deadmarshal joined #nim |