00:49:39 | FromDiscord | <Elegantbeef> I believe the issue is your `M >>= (A -@Freyr) |
00:49:51 | FromDiscord | <Elegantbeef> It's a generic with 0 inferable context |
00:50:44 | FromDiscord | <Freyr> hmm I see |
00:52:27 | * | neceve quit (Ping timeout: 248 seconds) |
00:53:37 | * | neceve joined #nim |
00:57:02 | FromDiscord | <!&luke> How can I convert a json array to a Nim sequence |
00:57:09 | FromDiscord | <!&luke> Preferably using std/json |
00:57:25 | FromDiscord | <Elegantbeef> Oh wait a minute freya i might be wrong |
00:59:18 | FromDiscord | <!&luke> Oh getElems should do the job |
01:00:35 | FromDiscord | <Freyr> In reply to @Elegantbeef "Oh wait a minute": essentially Monad needs to be generic over a parameter other than the one for which it's initialised right |
01:00:46 | FromDiscord | <Freyr> Let me check how Haskell implements |
01:00:50 | FromDiscord | <Freyr> (edit) "Let me check how Haskell implements ... " added "it" |
01:01:01 | FromDiscord | <Elegantbeef> Yea dont use big words with me 😛 |
01:01:08 | FromDiscord | <Elegantbeef> I just attempt to make things work |
01:01:52 | FromDiscord | <Freyr> sent a code paste, see https://play.nim-lang.org/#ix=4fyF |
01:02:14 | FromDiscord | <Elegantbeef> Yea but haskell has a working concept alternative |
01:02:18 | FromDiscord | <Elegantbeef> Concepts in Nim are very very iffy |
01:03:20 | FromDiscord | <Freyr> There's very little information about them on the internet |
01:05:04 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fyG |
01:05:24 | FromDiscord | <Elegantbeef> One issue you have right now is you're doing things like `pure(A)` which means you want `proc pure(_: typedesc[A])` |
01:08:35 | FromDiscord | <Elegantbeef> Another issue is you have nothing binding the generic parameter |
01:08:52 | FromDiscord | <Elegantbeef> Like A can be anything there is no explicit relation between the M and the A |
01:16:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fyH |
01:16:38 | FromDiscord | <Elegantbeef> You can have any proc placed there and it compiles as there is no constraint |
01:25:28 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4fyK |
01:25:45 | FromDiscord | <voidwalker> I don't understand, `Reads up to size bytes from socket into the result.` |
01:26:05 | FromDiscord | <voidwalker> means it will read less, even 0, if there is nothing to read ? |
01:26:19 | FromDiscord | <Elegantbeef> Correct |
01:26:36 | FromDiscord | <voidwalker> well, I need it to read exactly 4 bytes |
01:26:54 | FromDiscord | <Elegantbeef> So then if you dont read 4 bytes error |
01:27:16 | FromDiscord | <Elegantbeef> If there arent 4 bytes in the socket you do what you want |
01:27:54 | FromDiscord | <voidwalker> I was under the impression that it blocked until there were 4 bytes |
01:28:10 | FromDiscord | <Elegantbeef> Depends on your socket settings |
01:28:30 | FromDiscord | <voidwalker> code worked like that so far, now it doesn't for some reason, I get a 0 sized string |
01:30:04 | FromDiscord | <Elegantbeef> Do you have a buffered socket? |
01:30:30 | FromDiscord | <voidwalker> I've no idea ? default everything |
01:31:00 | FromDiscord | <voidwalker> just trying to get a hang of the bittorrent protocol before I switch to async |
01:31:05 | FromDiscord | <Elegantbeef> well the nyou should have it buffered |
01:31:12 | FromDiscord | <Elegantbeef> so then it will wait until it recieves 4 bytes |
01:32:00 | FromDiscord | <voidwalker> yeah default seems to be true for buffered |
01:40:29 | NimEventer | New Nimble package! snekim - A simple implementation of the classic snake game, see https://codeberg.org/annaaurora/snekim |
01:50:43 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4fyM |
01:50:47 | FromDiscord | <voidwalker> still, getting 0 length for some reason |
01:50:52 | FromDiscord | <huantian> In reply to @NimEventer "New Nimble package! snekim": cute pfp |
02:03:58 | * | derpydoo joined #nim |
02:24:19 | FromDiscord | <albassort> hey what is the current trendy c interop library |
02:24:40 | FromDiscord | <Rika> Futhark? |
02:25:06 | FromDiscord | <Elegantbeef> I still use c2nim cause i like concise bindings |
02:26:08 | FromDiscord | <albassort> i haven't found one i quite like |
02:36:40 | FromDiscord | <albassort> hmmm having problems with futhark |
02:41:00 | FromDiscord | <Rika> Like |
02:44:15 | FromDiscord | <albassort> holy shit futhark lang is something i was looking for! |
02:44:20 | FromDiscord | <albassort> Halide too... |
02:44:20 | FromDiscord | <albassort> hmmm |
02:48:39 | FromDiscord | <Rika> Not the language though lmao |
02:52:50 | FromDiscord | <albassort> sorry I got distracted while googling |
02:55:29 | * | arkurious quit (Quit: Leaving) |
03:23:40 | * | arkanoid quit (Ping timeout: 260 seconds) |
03:30:15 | NimEventer | New thread by bcharest: Editor for nim files with #? stdtmpl | standard, see https://forum.nim-lang.org/t/9594 |
03:36:30 | FromDiscord | <exelotl> c2nim is my preference too |
03:49:00 | FromDiscord | <albassort> can i define procedures using macros |
03:49:48 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4fz0 |
03:50:04 | FromDiscord | <Elegantbeef> Can you write code that does it? Macros can |
03:50:34 | FromDiscord | <albassort> so i can write a macro which defines global functions |
03:50:37 | FromDiscord | <albassort> noted |
04:08:53 | * | derpydoo quit (Quit: derpydoo) |
04:21:36 | FromDiscord | <Freyr> So I was redefining my `Maybe` in terms of type classes and it turns out Nim doesn't really like type classes where one of the parameters is generic and the other isn't |
04:22:18 | FromDiscord | <Freyr> sent a code paste, see https://paste.rs/Pvq |
04:22:47 | FromDiscord | <Elegantbeef> Nim typeclasses are generic constraints not unions |
04:23:48 | FromDiscord | <Freyr> It errors on the `Maybe(Nothing)` saying it's of type `Maybe[Any]` rather than `Maybe[Error Type]` (because it can't instantiate B) |
04:23:54 | FromDiscord | <Freyr> (edit) "B)" => "`B`)" |
04:24:36 | FromDiscord | <Freyr> (edit) "`Maybe[Any]`" => "`Maybe[any]`" |
04:24:42 | FromDiscord | <Freyr> Definitely looks from the docs like you can do unions |
04:24:47 | FromDiscord | <Freyr> https://nim-lang.org/docs/manual.html#generics-type-classes |
04:24:53 | FromDiscord | <Elegantbeef> They're compile time constraints |
04:25:00 | FromDiscord | <Elegantbeef> Not tagged unions |
04:26:44 | FromDiscord | <Freyr> Still though, `Nothing` is a valid instance of type `Maybe[B]` |
04:27:04 | FromDiscord | <Freyr> And it should be able to see that at compile time |
04:27:51 | FromDiscord | <Elegantbeef> `Maybe[B]` and `Maybe(Nothing)` are not the same type |
04:27:53 | FromDiscord | <Elegantbeef> So one that one work |
04:28:02 | FromDiscord | <Elegantbeef> Two `Maybe` needs a generic parameter |
04:30:11 | FromDiscord | <alice.> does nim have support for enums whos members have the same name yet |
04:30:18 | FromDiscord | <alice.> prefixing them is kinda ugly |
04:30:28 | FromDiscord | <Elegantbeef> It has overloadable enums and pure enums |
04:31:18 | FromDiscord | <alice.> difference being? |
04:34:06 | FromDiscord | <Freyr> In reply to @Elegantbeef "`Maybe[B]` and `Maybe(Nothing)` are": It says `Maybe(Nothing)` is of type `Maybe[any]` shouldn't `any` be the same as `B` |
04:34:20 | FromDiscord | <Elegantbeef> No cause you didnt do `Maybe[B](Nothing)` |
04:35:50 | FromDiscord | <Elegantbeef> But like i said you cannot use that typeclass |
04:38:36 | FromDiscord | <Freyr> That's a shame |
04:39:56 | FromDiscord | <Freyr> sent a code paste, see https://play.nim-lang.org/#ix=4fzb |
04:40:14 | FromDiscord | <Freyr> That one I at least know works |
04:40:42 | FromDiscord | <Elegantbeef> Yes Nim doesnt have unions it has object variants |
04:40:54 | FromDiscord | <Elegantbeef> You can use https://github.com/alaviss/union if you want a Union syntax |
04:41:43 | FromDiscord | <ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4fzc |
04:41:53 | FromDiscord | <ringabout> (edit) "https://play.nim-lang.org/#ix=4fzc" => "https://play.nim-lang.org/#ix=4fzd" |
04:42:20 | FromDiscord | <Elegantbeef> `ptr char -> cstring -> string`? |
04:42:39 | FromDiscord | <ringabout> Yeah |
04:43:02 | FromDiscord | <ringabout> Nim can be more strict about it in v2 https://github.com/nim-lang/Nim/pull/20761 |
04:46:08 | FromDiscord | <Elegantbeef> I'd personally like `string -> cstring` to be a warning, but alas 😄 |
04:47:51 | FromDiscord | <Elegantbeef> I mean an error |
04:48:56 | FromDiscord | <ringabout> Yeah, I have the same dream |
04:54:20 | FromDiscord | <ringabout> 0.20.0 changelog said ``- The switch `-d:useWinAnsi` is not supported anymore.``. I guess it is the high time to remove it completely from stdlib. |
04:55:07 | FromDiscord | <ringabout> (edit) "to remove" => " that" | " thatit ... completely" added "being removed" |
04:55:42 | FromDiscord | <ringabout> (edit) removed "the" | removed "" | "being" => "was" |
05:58:45 | * | tiorock joined #nim |
05:58:45 | * | tiorock quit (Changing host) |
05:58:45 | * | tiorock joined #nim |
05:58:45 | * | rockcavera is now known as Guest8335 |
05:58:45 | * | tiorock is now known as rockcavera |
06:01:31 | * | Guest8335 quit (Ping timeout: 252 seconds) |
06:03:16 | * | tiorock joined #nim |
06:03:16 | * | tiorock quit (Changing host) |
06:03:16 | * | tiorock joined #nim |
06:03:16 | * | rockcavera is now known as Guest4073 |
06:03:16 | * | tiorock is now known as rockcavera |
06:04:16 | * | tiorock joined #nim |
06:04:16 | * | tiorock quit (Changing host) |
06:04:16 | * | tiorock joined #nim |
06:04:16 | * | rockcavera quit (Killed (copper.libera.chat (Nickname regained by services))) |
06:04:16 | * | tiorock is now known as rockcavera |
06:07:01 | * | Guest4073 quit (Ping timeout: 252 seconds) |
06:22:59 | NimEventer | New thread by JeysonFlores: Race condition in async server using websockets.... maybe?, see https://forum.nim-lang.org/t/9595 |
06:27:14 | * | rockcavera quit (Remote host closed the connection) |
06:40:44 | NimEventer | New Nimble package! sas - SAS compiler, see https://github.com/xcodz-dot/sas |
06:47:10 | * | ltriant quit (Ping timeout: 252 seconds) |
07:04:38 | * | dnh joined #nim |
07:05:19 | * | kenran joined #nim |
07:30:07 | * | PMunch joined #nim |
07:53:23 | * | jjido joined #nim |
08:28:16 | * | dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
08:28:40 | * | dnh joined #nim |
08:59:23 | NimEventer | New thread by miran: A cost model for Nim v2, see https://forum.nim-lang.org/t/9596 |
09:06:07 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
09:18:28 | * | kenran` joined #nim |
09:20:12 | * | kenran quit (Ping timeout: 252 seconds) |
09:39:31 | NimEventer | New thread by sls1005: How to know if `--mm:arc` is applicable?, see https://forum.nim-lang.org/t/9597 |
09:55:25 | * | ltriant joined #nim |
09:59:36 | NimEventer | New thread by Hobbyman: How can I get the fields and field-types of an sqlite-database?, see https://forum.nim-lang.org/t/9598 |
10:08:55 | * | jjido joined #nim |
10:10:05 | * | jjido quit (Client Quit) |
10:26:23 | * | jjido joined #nim |
10:32:20 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
10:43:44 | * | jmd_ quit (Ping timeout: 260 seconds) |
10:49:41 | FromDiscord | <ChocolettePalette> Hmm, do you guys know whether I should close a UDP socket? It seems like I don't really have to cuz it's connectionless, but it might have grabbed some system resources though |
10:54:13 | qwr | socket is file descriptor, if you don't close it you'll have just a file descriptor leak, and the limit can be quite low |
10:56:08 | qwr | though i'm not 100% sure that nim won't discard it via destructors anyway |
10:58:09 | * | vicecea quit (Read error: Connection reset by peer) |
11:03:57 | * | jjido joined #nim |
11:04:36 | * | jjido quit (Client Quit) |
11:29:07 | * | vicecea joined #nim |
11:35:09 | * | jjido joined #nim |
11:35:18 | * | jjido quit (Client Quit) |
12:07:13 | * | arkurious joined #nim |
12:22:23 | FromDiscord | <ShalokShalom> Why is there `nk` preceding the different enums ↵↵https://nim-lang.org/docs/manual.html#types-object-variants |
12:22:25 | FromDiscord | <ShalokShalom> Is see this very often in Nim. Is this to avoid namespace collisions? |
12:24:02 | FromDiscord | <Rika> Kinda, because it’s “preferred” to prefix enums than to disambiguate them when needed with the module name, I think |
12:30:05 | FromDiscord | <ShalokShalom> I see. |
12:31:11 | PMunch | Just realised that `ctx.respond` in Prologue doesn't return from the route.. |
12:49:30 | * | jjido joined #nim |
12:55:50 | FromDiscord | <ChocolettePalette> For some reason I can't send & receive stuff via UDP sockets \:(Like, can I use readLine with UDP sockets? I guess no, but recvFrom doesn't work too! |
12:59:37 | FromDiscord | <ChocolettePalette> Do I have to bind them first? I am so clueless |
13:01:42 | FromDiscord | <ChocolettePalette> Ah, seems like I do, nvm then! |
13:17:16 | * | om3ga quit (Quit: Bye) |
13:18:37 | * | oz joined #nim |
13:19:08 | * | oz is now known as Guest1473 |
13:22:35 | * | dnh quit (Quit: Textual IRC Client: www.textualapp.com) |
13:26:57 | FromDiscord | <pietroppeter> here we go for another ride (we are on orange side)! note how baseline traffic was raised significantly by latest the "nim in 100 seconds video": https://media.discordapp.net/attachments/371759389889003532/1040618634738929664/image.png |
13:28:01 | FromDiscord | <pietroppeter> keep the waves coming! (for example by submitting guest blogpost!) |
13:29:55 | FromDiscord | <jmgomez> Im planning to reach out 80.lv once the UE plugin has some instructions. There is a lot of people interested in the unreal community |
13:30:22 | FromDiscord | <Phil> ... should I be able to publish snorlogue I could feasibly write a simple one about setting up a simple prologue web application with admin area, ORM and REST API endpoints↵🤔 |
13:31:39 | FromDiscord | <ShalokShalom> In reply to @jmgomez "Im planning to reach": I imagine. They are still waiting for Verse |
13:31:53 | FromDiscord | <ShalokShalom> I would suggest to get it ready before that takes off |
13:32:37 | FromDiscord | <ShalokShalom> And do good comparisons, when that happens 😄 |
13:32:47 | FromDiscord | <jmgomez> Yeah, Im doing my best but it's totally outside of my control. Hopefully once the instructions are there, more people can jump and help if they are interested |
13:32:55 | FromDiscord | <ShalokShalom> You are only going on against the main dev of Haskell |
13:33:01 | FromDiscord | <ShalokShalom> Nothing to worry about 😄 |
13:33:12 | FromDiscord | <jmgomez> haha well, not me, Araq is |
13:33:24 | FromDiscord | <jmgomez> I trust him 😛 |
13:33:30 | FromDiscord | <ShalokShalom> You plan Cyo support as well? 😅 |
13:34:11 | FromDiscord | <jmgomez> I plan support for the best one.. so far is Nim |
13:34:26 | FromDiscord | <hugogranstrom> In reply to @pietroppeter "here we go for": Do we know what's driving traffic this time? |
13:34:56 | FromDiscord | <pietroppeter> new blogpost on cost model on front page of HN (you can see it from the dashboard) |
13:35:26 | FromDiscord | <ShalokShalom> In reply to @jmgomez "I plan support for": Very diplomatic answer 😄 |
13:35:28 | FromDiscord | <pietroppeter> https://plausible.io/nim-lang.org?page=%2Fblog%2F2022%2F11%2F11%2Fa-cost-model-for-nim.html (added a filter and look at sources, compare with removed filter) |
13:36:27 | PMunch | Hmm, reading the cost model article. Is --mm:orc with `GC_disableOrc` the same as arc? |
13:36:33 | PMunch | Or are there more subtle differences? |
13:37:28 | FromDiscord | <EliasG2> here, 'worldrenderer' does not seem to be able to import 'world', how should i do imports when putting my code in different directories? https://media.discordapp.net/attachments/371759389889003532/1040621283676782622/image.png |
13:37:47 | FromDiscord | <Rika> `import ../world` |
13:37:54 | FromDiscord | <Generic> does this work by now? |
13:38:02 | FromDiscord | <Rika> idk i think so |
13:38:05 | FromDiscord | <Generic> for a long time you had to use `".."/world` |
13:38:07 | FromDiscord | <Rika> if not add "" around .. |
13:38:22 | FromDiscord | <EliasG2> In reply to @Rika "`import ../world`": ah thanks |
13:38:28 | FromDiscord | <Generic> ah right now I remember |
13:38:34 | FromDiscord | <Generic> the issue is only with multiple imports |
13:38:37 | FromDiscord | <Generic> so ../world does work |
13:38:44 | FromDiscord | <Generic> but ../[world, entity] does not |
13:38:55 | FromDiscord | <Generic> you have to use ".."/[world, entity] then |
13:39:24 | FromDiscord | <hugogranstrom> In reply to @pietroppeter "new blogpost on cost": Ahh, good to see blog post being so effective 🙂 |
13:39:53 | FromDiscord | <ShalokShalom> Yeah, kinda wondering. 🤔 |
13:40:11 | FromDiscord | <ShalokShalom> I guess everything can be effective, when it fits on HN |
13:44:55 | FromDiscord | <pietroppeter> you can see smaller bumps when any blogpost is published, due to existing nim community checking out new content. when some of this content reaches HN front page, it tends to explode (the first spike is the blogpost on nimconf which also reached youtube). I do expect this particular blogpost to do well, since it is very technical and can start various discussions (e.g. on hashmaps) |
13:45:27 | FromDiscord | <pietroppeter> (edit) "youtube)." => "HN)." |
13:51:07 | FromDiscord | <ShalokShalom> Thats a good starter |
13:51:13 | FromDiscord | <ShalokShalom> We could do actual guidelines |
13:51:30 | FromDiscord | <ShalokShalom> "How does your blog post do good on HN" 😅 |
13:51:51 | FromDiscord | <ShalokShalom> Step1: Make it very technical, so people can fight over it 😅 |
13:52:08 | FromDiscord | <ShalokShalom> I guess it would help, if some of us would join the discussion |
13:53:11 | * | kenran` quit (Remote host closed the connection) |
13:58:55 | PMunch | "As such, exceptions are allocated on the heap. However, it is possible to preallocate them.", anyone know what this means? |
13:59:35 | FromDiscord | <ChocolettePalette> Smth on the Jawa language |
14:01:20 | FromDiscord | <ChocolettePalette> If you allocate (ask OS to provide you with) let's say 1Gb, you can further immefiately allocate (ask VM to provide you with space for) stuff instantly or smth like that |
14:04:19 | PMunch | Not sure how that's related to Exceptions being preallocated.. |
14:04:49 | PMunch | Well I guess you would save an allocator call in the case where you need to throw an exception |
14:08:03 | FromDiscord | <albassort> I'm so lucky to live in a world with nim |
14:14:10 | * | jjido quit (Quit: Textual IRC Client: www.textualapp.com) |
14:21:11 | FromDiscord | <ChocolettePalette> You were born too late to invent nim and too early to see it the universal language doe |
14:25:03 | * | rockcavera joined #nim |
14:42:08 | FromDiscord | <dom96> In reply to @pietroppeter "here we go for": honestly a bit disappointing that HN gives higher spikes than a YT video from someone with millions of subscribers. |
14:42:22 | NimEventer | New post on r/nim by CirseiMasta: Javascript compilation: any type system ?, see https://reddit.com/r/nim/comments/yscfkz/javascript_compilation_any_type_system/ |
14:44:17 | FromDiscord | <pietroppeter> In reply to @dom96 "honestly a bit disappointing": the effects I think are compound: having had that video first, a lot more people are interested in nim and they also look at HN. But also, I never heard about that youtube channel even if it had million of subscriber, I think HN still has a much wider audience |
14:49:16 | FromDiscord | <mantielero (mantielero)> Hello, I am struggling with an error that occurs with some bindings I am working on and x11/xlib |
14:50:03 | FromDiscord | <albassort> In reply to @ChocolettePalette "You were born too": i wouldn't be able to invent nim |
14:50:38 | FromDiscord | <mantielero (mantielero)> The error takes place when I call the following function\: https://github.com/mantielero/occt.nim/blob/0ddd864feb77c891586962ed242d496ee06bc25d/examples/viewer04.nim#L107 |
14:50:49 | FromDiscord | <mantielero (mantielero)> I get the error\:↵\`\`\` |
14:52:30 | FromDiscord | <pietroppeter> sent a long message, see http://ix.io/4fBi |
14:53:21 | FromDiscord | <mantielero (mantielero)> I define `event`here\: https://github.com/mantielero/occt.nim/blob/0ddd864feb77c891586962ed242d496ee06bc25d/examples/viewer04.nim#L101 |
14:53:23 | * | derpydoo joined #nim |
14:54:03 | FromDiscord | <pietroppeter> btw @dom96 do you have access to nim's google analytics? can you give me access so that I migrate the history to plausible? see https://github.com/nim-lang/website/issues/342 |
14:56:00 | FromDiscord | <mantielero (mantielero)> And `processMessage` is defined here\: https://github.com/mantielero/occt.nim/blob/0ddd864feb77c891586962ed242d496ee06bc25d/examples/viewer04.nim#L91-L92 |
15:07:43 | * | PMunch quit (Quit: Leaving) |
15:46:56 | FromDiscord | <alice.> sent a code paste, see https://play.nim-lang.org/#ix=4fBF |
15:47:00 | FromDiscord | <alice.> im still somewhat new |
15:49:34 | FromDiscord | <Generic> I'd decide on either using only variants or inheritance |
15:49:45 | FromDiscord | <alice.> what would be the trade offs? |
15:49:50 | FromDiscord | <alice.> and what do u mean by variants? |
15:49:59 | FromDiscord | <Generic> case objects |
15:50:12 | FromDiscord | <alice.> how would u structure this? |
15:50:18 | FromDiscord | <alice.> if you could provide a sample |
15:50:22 | * | yarrie joined #nim |
15:50:25 | yarrie | hi everybody :-) |
15:51:02 | FromDiscord | <alice.> hey |
15:51:37 | FromDiscord | <Generic> https://github.com/RSDuck/hocuspocube/blob/master/hocuspocube/dsp/asm/dspasm.nim#L170-L208 |
15:51:59 | FromDiscord | <alice.> @Generic may i ask how children: seq[Node] works? |
15:52:19 | FromDiscord | <Generic> it's basically a clone of Nim's AST used e.g. in the macros |
15:52:39 | FromDiscord | <Generic> and the compiler in general |
15:52:39 | FromDiscord | <Generic> https://nim-lang.org/docs/macros.html |
15:54:29 | FromDiscord | <alice.> @Generic right but how would i create a instance of this to represent eg a `var ident = value` |
15:55:08 | yarrie | hi alice :) |
15:55:28 | FromDiscord | <alice.> :cirnu: |
15:55:58 | yarrie | very irc friendly :innocent: |
15:56:06 | FromDiscord | <Generic> https://github.com/RSDuck/hocuspocube/blob/master/hocuspocube/dsp/asm/dspasm.nim#L353-L370 |
15:56:20 | FromDiscord | <Generic> it's all very much inspired by Nim's macro system |
15:58:04 | * | AliceLikesFumos joined #nim |
15:58:53 | AliceLikesFumos | hi @yarrie |
15:58:58 | FromDiscord | <alice.> lol |
15:59:00 | yarrie | AliceLikesFumos: hiii |
15:59:11 | AliceLikesFumos | alice stole my name |
15:59:22 | yarrie | first come lol |
15:59:31 | AliceLikesFumos | FromDiscord |
15:59:35 | AliceLikesFumos | nice bot |
15:59:49 | FromDiscord | <Generic> the reason using a case object for everything is better than inheritance is because if you want to branch on the type of node, you can can only check one at a time |
16:00:05 | FromDiscord | <Generic> with `if node of Literal:` |
16:00:31 | FromDiscord | <Generic> while with case objects you can process them in case statements |
16:00:33 | FromDiscord | <alice.> gotchu |
16:00:42 | FromDiscord | <alice.> In reply to @alice. "<@249581140363575297> right but how": this is my Q though |
16:00:59 | FromDiscord | <Generic> look at the link I've sent |
16:01:16 | FromDiscord | <Generic> newIdent |
16:01:49 | FromDiscord | <Generic> there are still some other things to decide |
16:02:28 | FromDiscord | <Generic> I use a uniform representation where all the sub nodes are always in the same seq |
16:02:58 | FromDiscord | <Generic> but what you did in your example, where you have specific fields for different node types work of course too |
16:03:20 | FromDiscord | <Generic> another thing to say about your code is that it probably doesn't work |
16:03:29 | FromDiscord | <Generic> because you have recursive non ref types |
16:03:47 | FromDiscord | <dom96> @alice. here is an AST from my very old language implementation: https://github.com/dom96/nael/blob/master/src/parser.nim#L26 |
16:04:21 | FromDiscord | <dom96> (You can ignore the `T` and `P` type prefixes, but it shows how to do object variants for ASTs well) |
16:04:53 | FromDiscord | <dom96> In reply to @pietroppeter "btw <@132595483838251008> do you": you'll have to catch me when I'm not at work 🙂 |
16:06:54 | FromDiscord | <pietroppeter> In reply to @dom96 "you'll have to catch": I'll try to ping outside office hours if I see you around, but do not wait for me in case you happen to remember about this on your own... 😉 |
16:08:25 | FromDiscord | <dom96> can you send me an email from your gmail? I think I'll need it so I can add you |
16:08:38 | FromDiscord | <dom96> (My email is on https://picheta.me) |
16:11:30 | FromDiscord | <alice.> also does nim normally use 2 or 4 spaces? |
16:11:59 | * | arkanoid joined #nim |
16:12:18 | FromDiscord | <Generic> official style is 2 |
16:12:22 | FromDiscord | <Generic> though I personally use 4 |
16:13:13 | arkanoid | whoa, I've just found a large memory leak in my 100% Nim + ORC project after last refactoring. Pretty scary. How would you find them? |
16:13:18 | * | yarrie quit (Ping timeout: 268 seconds) |
16:13:29 | FromDiscord | <pietroppeter> In reply to @dom96 "can you send me": yep, done! (I happened to have also your gmail mail so I used both) |
16:14:27 | FromDiscord | <auxym> In reply to @arkanoid "whoa, I've just found": valgrind? Btw if you have a leak with ORC and without using unsafe stuff (pointers, gc_ref, etc), then you should probably report that as an issue |
16:15:20 | arkanoid | auxym, I'm not blaming Nim as it could by my logic doing so, but I have to rule it out first. Let me valgrind this |
16:15:46 | FromDiscord | <auxym> nevertheless, ORC by itself should not leak memory |
16:16:26 | arkanoid | I fear I have some asyncCheck stuff never stopping and spawning without control |
16:17:05 | arkanoid | I wonder why they give it the name "asyncCheck". I understand what id doesn, but why "async check" |
16:17:38 | FromDiscord | <dom96> what do you think it should be called instead? |
16:17:51 | arkanoid | *damn, here it comes the author* |
16:17:55 | arkanoid | :) |
16:17:58 | FromDiscord | <dom96> haha |
16:18:21 | arkanoid | well, startRoutine? |
16:18:53 | arkanoid | it adds a new root in the event loop, doesn't it? |
16:19:24 | arkanoid | what does it "check?" |
16:19:59 | FromDiscord | <dom96> have you ever taken a look at its implementation? |
16:20:03 | FromDiscord | <dom96> That should explain it's name |
16:20:30 | FromDiscord | <dom96> https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/asyncfutures.nim#L425 |
16:20:30 | * | AliceLikesFumos is now known as megabytesofrem |
16:21:53 | FromDiscord | <dom96> (edit) "it's" => "its" |
16:21:59 | arkanoid | ok, it may describe what it does internally, but from an async api point of view its the "trampoline" for a new async routing that you may use from a sync context |
16:22:09 | arkanoid | *routine |
16:22:36 | FromDiscord | <dom96> You can call an async proc without `asyncCheck` just fine though |
16:22:41 | FromDiscord | <dom96> it will still run in the background |
16:22:52 | FromDiscord | <dom96> and I actually wanted that to be possible long-term |
16:23:03 | FromDiscord | <dom96> maybe we'll still get there someday 🙂 |
16:24:53 | arkanoid | yeah but an async proc returns a Future, and generally there is split-horizon view when dealing with a mix of sync and async code. My mind goes like "this is sync and with this asyncCheck boom, I'm now into async world" |
16:28:49 | * | yarrie joined #nim |
16:41:43 | * | rockcavera quit (Remote host closed the connection) |
16:42:20 | megabytesofrem | is there a way to get vscode extension to run nimpretty on save? |
16:45:15 | * | rockcavera joined #nim |
16:48:57 | FromDiscord | <ezquerra> I have not used it but perhaps this would work? https://marketplace.visualstudio.com/items?itemName=emeraldwalk.RunOnSave |
16:56:16 | arkanoid | megabytesofrem: check editor.formatOnSave |
16:56:52 | arkanoid | it's an editor prop, not part of nim extension, but I thing nim extension looks at it to call nimpretty, but double check please |
16:57:46 | arkanoid | maybe I'm wrong, I'm not finding any reference https://github.com/saem/vscode-nim/search?q=formatOnSave |
17:00:33 | FromDiscord | <alice.> sent a code paste, see https://play.nim-lang.org/#ix=4fC6 |
17:00:36 | FromDiscord | <alice.> In reply to @arkanoid "megabytesofrem: check editor.formatOnSave": will do, thanks |
17:03:07 | FromDiscord | <alice.> oh it needed to be seq |
17:03:09 | FromDiscord | <vindaar> because `[ASTNode]` is not a type. It's an array with a typedesc inside. You need to specify what it is exactly (e.g. `array[N, ASTNode]` where `N` is some constant or use a `seq[ASTNode]` instead)↵(@alice.) |
17:03:58 | FromDiscord | <alice.> gotcha |
17:04:03 | FromDiscord | <alice.> yah i meant to use seq |
17:16:04 | * | ehmry quit (Ping timeout: 248 seconds) |
17:16:58 | * | ehmry joined #nim |
17:31:05 | arkanoid | damn, I've been trying cligen and it's a mess of a library. It's unsafe, it doesn't solve edge cases that it produces itself. No no |
17:31:47 | FromDiscord | <guttural666> any way to clear only the number of lines that I have written to the terminal to avoid weirdness like this? (sending the cursor beyond my initial line) or will I have to count my lines myself? https://media.discordapp.net/attachments/371759389889003532/1040680249693839370/image.png |
17:32:08 | arkanoid | do you know an alterative cli parsing library that can do the cmdline + ENV + cfg file like most Go programs do? |
17:33:00 | * | ehmry quit (Ping timeout: 260 seconds) |
17:37:36 | FromDiscord | <guttural666> In reply to @arkanoid "do you know an": I'm a Nim pleb, sorry |
17:37:52 | arkanoid | testing https://nimble.directory/pkg/cliche |
17:38:08 | arkanoid | I feel the author found same issues with cligen I'm complaining about |
17:43:52 | * | derpydoo quit (Ping timeout: 252 seconds) |
17:49:41 | * | pro joined #nim |
17:50:32 | FromDiscord | <guttural666> to answer my own question above: don't believe there is a real solution, writing it myself, I came up with this: https://media.discordapp.net/attachments/371759389889003532/1040684970219413515/image.png |
17:54:25 | FromDiscord | <JohnMcAfee> All guttural and no pig squeal, eh? Lack of range sounds like a skill issue to me... |
17:54:50 | FromDiscord | <guttural666> na, squeals are there as well, but they're guttural in nature haha |
17:55:03 | FromDiscord | <JohnMcAfee> LOL! |
17:55:56 | FromDiscord | <guttural666> more Dying Fetus "squeals", less cringe early 2000s deathcore squeals haha |
18:00:41 | FromDiscord | <vindaar> huh, that's the first time I've seen someone be so negative about cligen. to me it's one of the most useful libraries in all of nim land. I'm sure if you open an issue about whatever problem you have, c-blake will either explain the reasoning for why things are the way they are, or fix them if it's something that's actually unsafe / broken↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
18:06:50 | * | yarrie quit (Quit: leaving) |
18:16:23 | * | ehmry joined #nim |
18:18:46 | FromDiscord | <guttural666> is there some kind of way to be able to use all the beefy procs at the top of the file (which are typically marked with to make them "public")? maybe without having to forward declare anything if that is even a thing? |
18:18:54 | FromDiscord | <giuseppe> Hey all, I'm trying to run my nim code inside vscode and I keep getting this error |
18:18:57 | FromDiscord | <giuseppe> sh: nim: command not found |
18:19:09 | FromDiscord | <giuseppe> I think it's because it runs as sudo |
18:19:10 | FromDiscord | <UnvaxxedPureBlood> In reply to @b1rdf00d "I really appreciate how": Cool example, Thanks for sharing. |
18:19:28 | FromDiscord | <giuseppe> In reply to @giuseppe "I think it's because": though idk how to fix it, any ideas? |
18:19:49 | FromDiscord | <guttural666> In reply to @giuseppe "sh: nim: command not": adding Nimble et al to your environment variables? first thing that springs to my mind |
18:20:00 | FromDiscord | <guttural666> what platform are you on? |
18:20:05 | FromDiscord | <giuseppe> popos |
18:20:14 | FromDiscord | <guttural666> pretty sure that is it |
18:20:39 | FromDiscord | <giuseppe> how do I do this? |
18:20:50 | FromDiscord | <Horizon [She/Her]> What would be an idiomatic way to do `myObj.addX().addY().addZ()`? |
18:21:04 | FromDiscord | <guttural666> In reply to @giuseppe "how do I do": what shell do you use? |
18:21:08 | FromDiscord | <Horizon [She/Her]> I can't initialise the value at once, since it's meant to be a JVM bytecode builder library |
18:21:16 | FromDiscord | <Horizon [She/Her]> And idk how else to do it |
18:21:17 | arkanoid | I'm trying to use "nimble develop" https://github.com/nim-lang/nimble#nimble-develop to test a little change to my project dependencies, but I'm failing to understand what's the intended usage. It seems to just clone the repo in local folder, and is not creating nor editing nimble.develop file |
18:21:48 | FromDiscord | <giuseppe> In reply to @guttural666 "what shell do you": bash |
18:21:57 | FromDiscord | <guttural666> In reply to @giuseppe "how do I do": https://nim-lang.org/install_unix.html↵check this page out and then configuring path environment variable |
18:22:20 | FromDiscord | <giuseppe> thx! |
18:22:32 | FromDiscord | <guttural666> depending on what shell you use it's something like SET /usr/bin/nimble/ $PATH or soemthing like that, you really have to google it haha |
18:22:35 | FromDiscord | <Generic> In reply to @Event Horizon "I can't initialise the": https://nim-lang.org/docs/with.html |
18:22:39 | FromDiscord | <guttural666> pretty sure it's that |
18:22:50 | FromDiscord | <Generic> I actually should be using that more often myself |
18:22:52 | FromDiscord | <guttural666> popos just doesn't find the nim command |
18:23:19 | FromDiscord | <Horizon [She/Her]> In reply to @Generic "https://nim-lang.org/docs/with.html": ooh |
18:23:43 | FromDiscord | <Horizon [She/Her]> That's actually really neat! |
18:24:15 | arkanoid | giuseppe you can do: "$ type nim" from bash to find out the path of nim binary in your $PATH |
18:24:38 | FromDiscord | <guttural666> In reply to @giuseppe "thx!": echo $PATH should tell you if your nimble / nim dirs are already in there |
18:24:43 | FromDiscord | <giuseppe> it's kinda weird because I can use the nim command |
18:24:57 | FromDiscord | <giuseppe> but not if I'm using sudo |
18:25:10 | FromDiscord | <giuseppe> and I think vscode runs it through sudo |
18:25:21 | FromDiscord | <guttural666> I think there are different set commands to make a variable globally accessible?? |
18:25:47 | FromDiscord | <guttural666> set -gh /usr/bin.... something like that? |
18:26:06 | FromDiscord | <guttural666> don't quite remember and I use fish as a console emulator |
18:26:10 | FromDiscord | <guttural666> bit different |
18:26:20 | FromDiscord | <giuseppe> I updated my .bashrc file |
18:26:25 | arkanoid | giuseppe, you really should NOT run vscode as sudo |
18:26:43 | FromDiscord | <giuseppe> Idk if its, just guessing tbh |
18:26:52 | arkanoid | apart from the security matters, it is something outside the general usage patterns |
18:27:24 | FromDiscord | <giuseppe> Thx for all the tips, I'll see what I can do |
18:27:40 | arkanoid | giuseppe, it surely is the problem. Just check "env | grep PATH" vs "sudo env | grep PATH" |
18:29:16 | FromDiscord | <guttural666> arkanoid knows more than I do, listen to him haha |
18:30:15 | FromDiscord | <guttural666> but the env var was what I was stepping over after distro hopping like a maniac and trying to install nim and nimlsp etc. on each machine |
18:30:57 | arkanoid | giuseppe you should understand the difference between running stuff as user vs running stuff as root (sudo) user. They do NOT share the running context (for good reason!) and you should not run stuff like development code as root. But this is not really a nim topic, but a general unix topic |
18:32:27 | FromDiscord | <giuseppe> 👍 👍 |
18:33:09 | arkanoid | could you please tell me what you get with "nimble develop -c <anypackagename>" like "nimble develop -c cliche" ? I'm getting "Error: Unknown option: -c" but it should really exist as it is documented here https://github.com/nim-lang/nimble#nimble-develop |
18:34:23 | FromDiscord | <guttural666> what would be a standard package that is included, i can test that? |
18:34:25 | arkanoid | oh wait, that's documentation for master branch, which is wildly different from current develop branch |
18:34:33 | FromDiscord | <guttural666> 😄 |
18:34:42 | arkanoid | here, there's no -c option https://github.com/nim-lang/nimble/tree/v0.13.1#nimble-develop |
18:34:56 | arkanoid | problem solved then, I was just trying to use a future option |
18:40:59 | FromDiscord | <Horizon [She/Her]> Does nim support something like `0x32`? |
18:41:02 | FromDiscord | <Horizon [She/Her]> For hex |
18:42:34 | FromDiscord | <Horizon [She/Her]> Oh that literally just works |
18:42:36 | FromDiscord | <Horizon [She/Her]> Neat |
18:43:22 | FromDiscord | <guttural666> god, I love IT, problems literally sometimes evaporate 😄 |
18:44:56 | * | jmdaemon joined #nim |
18:44:58 | arkanoid | what's the equivalent AST node name for bool literals? Like nnkIntLit but for bool. nnkBoolLit doesn't exist. |
18:48:39 | * | rockcavera quit (Remote host closed the connection) |
18:50:20 | FromDiscord | <Generic> bool literals don't exist |
18:50:37 | FromDiscord | <Generic> they're an enum defined in system.nim with some magic attached to it |
18:51:18 | FromDiscord | <Generic> I think `bindSym"true"`/`bindSym"false"` should work |
18:59:09 | * | rockcavera joined #nim |
19:00:54 | FromDiscord | <huantian> In reply to @Generic "bool literals don't exist": They can’t hurt you |
19:11:51 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
19:12:45 | FromDiscord | <guttural666> what kind of template do I need to accompany every call to echo with a "inc x"? |
19:18:35 | arkanoid | Generic, what? |
19:19:31 | arkanoid | Generic, what do you think I shold use here instead of the missing nnkBoolLit? https://github.com/juancarlospaco/cliche/blob/e3506e46e685d1f60ce5cc8ac4a039eb6c15a79f/src/cliche.nim#L19 |
19:20:23 | FromDiscord | <Generic> good question |
19:20:45 | FromDiscord | <Generic> is it an untyped or typed macro? |
19:23:28 | arkanoid | Generic: first argument `params` is passed in from "variables: untyped" macro param: func explainHelp(params: NimNode; helpMessage: string; prefix, sepa: char): string = |
19:23:36 | arkanoid | so I'd say it's untyped |
19:24:03 | FromDiscord | <Generic> ok, then true and false will still be idents |
19:25:04 | arkanoid | and? sorry but I'm not into macro a lot, I need an hint |
19:26:47 | FromDiscord | <Generic> sent a code paste, see https://play.nim-lang.org/#ix=4fCF |
19:26:57 | FromDiscord | <Generic> when you compile that, it'll echo at compile time |
19:27:04 | FromDiscord | <Generic> Ident "true" |
19:27:36 | FromDiscord | <Generic> true and false are (mostly) like any other enum |
19:28:05 | FromDiscord | <Generic> if the program is changed to |
19:28:15 | FromDiscord | <Generic> sent a code paste, see https://paste.rs/JOr |
19:28:20 | FromDiscord | <Generic> it'll print `Sym "true"` |
19:28:51 | FromDiscord | <Generic> because with a typed macro, the identifier is already resolved to https://nim-lang.org/docs/system.html#bool |
19:29:18 | arkanoid | ok, so in my context I have to case .. of newIdentNode("true"), newIdentNode("false"): "bool" ? |
19:29:29 | FromDiscord | <Generic> amlost |
19:29:33 | FromDiscord | <Generic> almost |
19:31:07 | FromDiscord | <Generic> you cannot do the check with just a normal case branch |
19:31:07 | arkanoid | it doesn't compile. It says "Error: expression has no type: true" |
19:31:18 | FromDiscord | <Generic> ah I now remember |
19:31:29 | FromDiscord | <Generic> Nim cases do support elif branches, a seldom used feature |
19:32:48 | FromDiscord | <Generic> you can just add `elif element[1].kind == nnkIdent and (element[1].eqIdent("true") or element[1].eqIdent("false")): "bool"` |
19:33:59 | arkanoid | it works! |
19:34:18 | arkanoid | :D thanks. Do you want to PR in my place? The honor is your |
19:34:52 | FromDiscord | <Generic> nah, it's fine |
19:35:20 | FromDiscord | <Generic> though keep in mind that this just literally checks for the ident to be equal regardless of context |
19:35:55 | FromDiscord | <Generic> so if you have a situation where true and false might be overwritten with a variable in nearer scope (which admittedly would be a pretty crazy thing to do) |
19:36:26 | FromDiscord | <Generic> it would still trip, eventhough the proper boolean enum isn't what was meant |
19:38:11 | FromDiscord | <Generic> which I guess it's also just a short coming of untyped macros in general |
19:38:34 | FromDiscord | <Generic> though I guess this could be maybe solved with dynamic bind sym |
19:42:36 | FromDiscord | <SaAnd> It seems I can't use nimble anymore, it just says "could not import\: SSL\_get\_peer\_certificate"↵based off what I've seen, it has something to do with openssl, but how do I fix it? |
19:45:16 | FromDiscord | <Generic> I think it's due to OpenSSL 1.2 (? I don't quite remember) being phased out |
19:45:20 | FromDiscord | <Generic> but Nim still relies on it |
19:45:39 | FromDiscord | <Generic> that's atleast the reason I had this error not too long ago |
19:48:15 | FromDiscord | <guttural666> how do I wrap the lines a tthe bottom into some kind of Nim meta programming thing while preserving the variadic nature of echo? https://media.discordapp.net/attachments/371759389889003532/1040714594085257326/image.png |
19:50:58 | FromDiscord | <Generic> what do you mean? |
19:50:59 | FromDiscord | <guttural666> inc echo_lines at the bottom there, sorry |
19:51:42 | FromDiscord | <Andreas> when i test a simple binary with `valgrind` it always reports leaks ? i tried `-d:useMalloc -gc:refc` ↵No matter what combination i tried valgrind (on osx) always reports :↵`==15940== LEAK SUMMARY:↵==15940== definitely lost: 8,328 bytes in 63 blocks` |
19:52:17 | FromDiscord | <Andreas> (edit) "when i test" => "sent" | "simple binary with `valgrind` it always reports leaks ? i tried `-d:useMalloc -gc:refc` ↵No matter what combination i tried valgrind (on osx) always reports :↵`==15940== LEAK SUMMARY:↵==15940== definitely lost: 8,328 bytes in 63 blocks`" => "long message, see http://ix.io/4fCV" |
19:53:38 | FromDiscord | <guttural666> In reply to @Generic "what do you mean?": pseudo code here https://media.discordapp.net/attachments/371759389889003532/1040715946861535393/image.png |
19:54:33 | FromDiscord | <guttural666> maybe more like echo vararg1, vararg2 ... |
19:58:35 | arkanoid | Generic, let's see what the author thinks https://github.com/juancarlospaco/cliche/issues/8#issuecomment-1312090633 |
20:00:39 | FromDiscord | <Generic> In reply to @guttural666 "pseudo code here": so you want a macro which passes on the arguments to echo and then increments echo_lines? |
20:00:47 | FromDiscord | <guttural666> indeed! |
20:00:57 | FromDiscord | <Generic> you don't need a macro for that |
20:01:04 | FromDiscord | <guttural666> okay |
20:01:53 | FromDiscord | <Generic> this should work |
20:01:55 | FromDiscord | <Generic> sent a code paste, see https://play.nim-lang.org/#ix=4fD1 |
20:02:01 | FromDiscord | <guttural666> just something that takes some echo lines, let's the user enter something and then clears the lines to go on to something else yknow |
20:02:12 | FromDiscord | <guttural666> oh okay, that's how that works |
20:02:34 | FromDiscord | <Generic> ok no, it doesn't |
20:02:37 | FromDiscord | <guttural666> I'm familiar with the concepts, but sometimes don't know what to look for so thanks haha |
20:04:52 | FromDiscord | <Generic> the problem is that the array is passed on as array |
20:05:01 | FromDiscord | <Generic> instead of passed in as the varargs |
20:06:01 | FromDiscord | <Generic> yeah this works |
20:06:05 | FromDiscord | <Generic> sent a code paste, see https://play.nim-lang.org/#ix=4fDb |
20:06:26 | FromDiscord | <guttural666> yes, untyped sounds right |
20:06:53 | FromDiscord | <guttural666> just want the same interface as echo, just with a counter on how many times I call it so I can auto clear the approp. amount of lines |
20:07:15 | FromDiscord | <Generic> I honestly don't really like the interface of echo |
20:07:33 | FromDiscord | <Generic> I almost exclusively use strformat |
20:08:27 | FromDiscord | <guttural666> yeah, gotta look into that |
20:08:58 | FromDiscord | <guttural666> CPP has formatting as well, never looked into it, always wrote my own hacky formatting tool for my needs |
20:11:14 | FromDiscord | <guttural666> sweet man, this works just as I wanted |
20:11:16 | FromDiscord | <guttural666> thanks |
20:11:34 | arkanoid | dom96: just quick question. How I am supposed to catch the exception raised from asyncCheck? Or generally, an exception raised from event loop itself (callback) and not yielded |
20:12:15 | * | Jjp137 quit (Ping timeout: 260 seconds) |
20:12:33 | * | Jjp137 joined #nim |
20:30:12 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
20:32:47 | * | jmdaemon joined #nim |
20:33:29 | * | jmdaemon quit (Remote host closed the connection) |
20:34:41 | * | jmdaemon joined #nim |
20:35:32 | FromDiscord | <gyoren> i need some help with making a wrapper for a c library |
20:35:50 | FromDiscord | <gyoren> are there any resources that can guide me through that or just help with that |
20:43:18 | FromDiscord | <dom96> arkanoid: by not using asyncCheck at all 🙂 |
20:44:38 | FromDiscord | <b1rdf00d> In reply to @gyoren "i need some help": How about this? https://livebook.manning.com/book/nim-in-action/chapter-8/81 |
20:45:56 | arkanoid | dom96, ok I've already done that. I was just curious if there was a way to hook an error catcher inside the event loop/dispatcher |
20:46:02 | arkanoid | thanks for the answer |
20:46:09 | FromDiscord | <dom96> arkanoid: you should set a callback on the future and do whatever you want with the error |
20:46:44 | FromDiscord | <dom96> some errors can be thrown from `poll` (and also `waitFor`/`runForever` since they call `poll`) |
20:46:54 | FromDiscord | <dom96> this is definitely far from ideal |
20:48:13 | * | derpydoo joined #nim |
20:53:24 | FromDiscord | <iffy (Matt Haggard)> Is there a `-d:` flag that changes Nim from v1 to v2 mode? |
20:53:36 | FromDiscord | <iffy (Matt Haggard)> (something that is optional now but will be default in v2) |
20:57:11 | FromDiscord | <albassort> 亙亙亙 |
20:57:33 | FromDiscord | <guttural666> got, universal function calls just provide me with so much options, I don't know what's the best / most pleasing way |
20:57:48 | FromDiscord | <guttural666> I have to think it's func boy1 boy2 |
20:58:08 | FromDiscord | <guttural666> Nim is almost like writing prose 🙂 |
21:05:15 | * | pro quit (Quit: pro) |
21:08:04 | FromDiscord | <iffy (Matt Haggard)> Maybe `when defined(nimv2)`? |
21:08:35 | FromDiscord | <huantian> https://nim-lang.org/docs/system.html#NimMajor |
21:10:39 | FromDiscord | <Elegantbeef> No nim doesnt have a flag to enable the flags that'll be defaulted in v2 |
21:11:12 | FromDiscord | <guttural666> finally Elegantbeef saveds the day of the uneducated masses 😍 |
21:12:13 | FromDiscord | <huantian> oh that's what they mean |
21:14:15 | Amun-Ra | when 2.0 is going to see the light of day? |
21:15:21 | FromDiscord | <iffy (Matt Haggard)> Elegantbeef\: I think I was actually asking the opposite. Is there a defined I can use to fork code for v1/v2? It's for this\: [nim-lang/Nim#20817](https://github.com/nim-lang/Nim/pull/20817) |
21:15:35 | FromDiscord | <Elegantbeef> But i'm uneducated |
21:15:39 | FromDiscord | <albassort> In reply to @Amun-Ra "when 2.0 is going": soon |
21:15:44 | FromDiscord | <Elegantbeef> Araq wants it out before 2023 |
21:16:08 | FromDiscord | <albassort> how do i pronounce Araw |
21:16:09 | FromDiscord | <albassort> (edit) "Araw" => "Araq" |
21:16:09 | Amun-Ra | oh, nice |
21:16:30 | FromDiscord | <guttural666> knowledgable to help plebs and very helpful, so I'm very greatful ❤️ |
21:16:48 | FromDiscord | <guttural666> (edit) "knowledgable ... to" added "enough" |
21:17:27 | FromDiscord | <Elegantbeef> A-rack is how i pronounce it |
21:17:28 | FromDiscord | <Elegantbeef> Ask blizzard↵(@albassort) |
21:17:59 | FromDiscord | <albassort> Lemme call up the overwatch dev team |
21:23:12 | FromDiscord | <Horizon [She/Her]> Uh this code https://paste.ecorous.org/opinunodaz.lua produces https://paste.ecorous.org/tovujatife.rust from https://paste.ecorous.org/upuqacabij.json |
21:23:19 | FromDiscord | <Horizon [She/Her]> And it's absolutely baffling me |
21:23:25 | FromDiscord | <Horizon [She/Her]> Because that makes no sense? |
21:24:04 | FromDiscord | <Horizon [She/Her]> it literally just cuts off a lot of the text, and not appending it to the output |
21:25:03 | FromDiscord | <Horizon [She/Her]> Moving the check for the line length below the token appender makes it generate the full output correctly but that is baffling |
21:28:48 | FromDiscord | <Elegantbeef> Why you dont just parse the json and use macros is beyond me |
21:34:19 | FromDiscord | <Horizon [She/Her]> As in compile the code in the source? |
21:34:28 | FromDiscord | <Horizon [She/Her]> I should probably do that- |
21:34:51 | FromDiscord | <Elegantbeef> Nim has macros so whenever people do string concatenation to generate code it's fucking odd |
21:39:28 | FromDiscord | <Horizon [She/Her]> Yeah fair enough, i'll do that instead |
21:39:39 | FromDiscord | <Horizon [She/Her]> I keep forgetting that macros are powerful |
21:44:33 | FromDiscord | <Horizon [She/Her]> How do i exactly use macros to generate Nim code? :p |
21:44:47 | FromDiscord | <Horizon [She/Her]> Should i just define a macro and call it? or is there something cleaner? |
21:44:54 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/macros.html |
21:45:00 | FromDiscord | <Horizon [She/Her]> (and then obviously return the generated ast) |
21:45:11 | FromDiscord | <Elegantbeef> https://dev.to/beef331/demystification-of-macros-in-nim-13n8 |
21:45:21 | FromDiscord | <Horizon [She/Her]> Ah thanks! |
21:59:40 | FromDiscord | <guttural666> kinda weird does Nm care about the order of declaration of procs in a file? I had the compiler complain about that earlier, which is a bummer since the procs should be at the top |
22:00:07 | FromDiscord | <guttural666> now, I have a template and proc at the top and it's fine? |
22:00:40 | FromDiscord | <guttural666> nah, doesnt't work |
22:01:37 | FromDiscord | <guttural666> having to forward declare stuff is stupid and non befitting nim lel |
22:02:10 | FromDiscord | <guttural666> parse the whole file and figure it out / reorder it compiler boi |
22:03:27 | FromDiscord | <Elegantbeef> Yes order of delcaration matters |
22:03:37 | FromDiscord | <Elegantbeef> Eventually it will not but there is no ETA on that |
22:04:30 | FromDiscord | <guttural666> I've seen some discussions on github about that |
22:04:49 | FromDiscord | <guttural666> experimental {.bois,} |
22:05:02 | FromDiscord | <Elegantbeef> Eh dont use code reorder just forward declare |
22:05:10 | FromDiscord | <guttural666> yeah |
22:05:40 | FromDiscord | <guttural666> kinda sad to see all the procs that got a star down at the bottom |
22:05:51 | FromDiscord | <guttural666> 😦 |
22:06:01 | FromDiscord | <Elegantbeef> What? |
22:06:18 | FromDiscord | <guttural666> procs that are exposed with a |
22:06:41 | FromDiscord | <guttural666> they have the most functionality, so they rely on a lot of other stuff in that module |
22:07:03 | FromDiscord | <guttural666> means, they have to be at the bottom of the file |
22:07:27 | FromDiscord | <guttural666> very sad and inappropriate |
22:09:29 | FromDiscord | <Elegantbeef> They do not, you can forward declare anything they depend on |
22:09:56 | FromDiscord | <guttural666> that's my point, I don't want to do that |
22:09:59 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fEv |
22:10:13 | FromDiscord | <Elegantbeef> Well then be sad |
22:10:27 | FromDiscord | <guttural666> compiler smart, compiler know |
22:10:30 | FromDiscord | <Elegantbeef> You can use code reordering but i generally dont think it's great |
22:10:32 | FromDiscord | <Elegantbeef> Compiler doesnt know |
22:10:41 | FromDiscord | <Elegantbeef> Cause compiler sems code top to bottom |
22:10:53 | FromDiscord | <Elegantbeef> Which means it doesnt know you have a `doThing` if you remove the forward declaration |
22:11:00 | FromDiscord | <Elegantbeef> It's a single pass compiler in that regard |
22:11:37 | FromDiscord | <guttural666> yeah, you know a lot more about this than I do, as a pleb that is my feeling, if I know, the compiler should be able to know |
22:12:35 | FromDiscord | <Elegantbeef> The single pass nature is the same reason you cannot have cyclical imports |
22:13:10 | FromDiscord | <guttural666> yeah, that's another annoyance, in my mind that should be possible / reconcilable |
22:13:29 | FromDiscord | <guttural666> so fucking annoying, the compiler should be able to figure that out |
22:13:36 | FromDiscord | <Elegantbeef> Meh |
22:13:44 | FromDiscord | <Elegantbeef> It's a bit annoying but it makes code more readable imo, ymmv |
22:13:45 | FromDiscord | <guttural666> i think some langs do that |
22:15:31 | FromDiscord | <guttural666> looking up ymmv |
22:16:22 | FromDiscord | <Elegantbeef> Your mileage may vary |
22:16:30 | FromDiscord | <guttural666> but dont you always have to scroll to the bottom of a file if you want to see the public interface? |
22:16:53 | FromDiscord | <guttural666> figured as much, I can google et al elegant 😄 |
22:17:27 | FromDiscord | <Elegantbeef> Not really in my experience, many things i write have only a few hidden things |
22:17:48 | FromDiscord | <Elegantbeef> In fact my game framework is mostly exported procedures |
22:18:25 | FromDiscord | <guttural666> link pls |
22:18:55 | arkanoid | what's wrong with this async code? why it doesn't compile? It returns compile error on future.read https://play.nim-lang.org/#ix=4fEy |
22:19:07 | FromDiscord | <Elegantbeef> https://github.com/beef331/truss3d |
22:20:48 | FromDiscord | <guttural666> thanks man |
22:21:05 | FromDiscord | <guttural666> didn't even know there was a += since there is no ++ |
22:21:24 | NimEventer | New thread by mantielero: Error: cannot convert 'tyObject_XEvent__EZvRvOUywFnBp4PzilZBoA' to 'XEvent&', see https://forum.nim-lang.org/t/9599 |
22:21:37 | * | ehmry quit (Ping timeout: 252 seconds) |
22:21:41 | FromDiscord | <Elegantbeef> arkanoid seems like it's an issue with the asyncmacro |
22:21:48 | FromDiscord | <Elegantbeef> It's not getting told it's a void future so is erroring |
22:22:45 | FromDiscord | <guttural666> do you disable GC for your game stuff Elegant? |
22:23:10 | arkanoid | Elegantbeef, but it gives same error even with "proc foo(): Future[void] {.async.} = discard" |
22:23:27 | * | ehmry joined #nim |
22:23:55 | FromDiscord | <Arathanis> i am so excited for Concepts to be fully realized, still can't do Functors cause `type S = auto` and `each S` both don't work so I have no idea how to inject an otherwise unspecified generic type into a concept. |
22:24:53 | FromDiscord | <Elegantbeef> No i'm not an idiot↵(@guttural666) |
22:25:35 | FromDiscord | <guttural666> is it that good already, can't imagine |
22:25:36 | FromDiscord | <Arathanis> Do you use determinist ref counting for your game to keep the overhead low? |
22:25:38 | arkanoid | Do you mean it is a Nim bug worth opening an issue on github? It seems so trivial |
22:25:57 | FromDiscord | <Elegantbeef> I dont even heap allocate much for my game |
22:26:00 | FromDiscord | <Arathanis> Can you share your game? I'd like to see it or is it WIP? |
22:26:15 | FromDiscord | <Elegantbeef> Like the hell are people doing in their games that the GC is an issue |
22:26:23 | FromDiscord | <Elegantbeef> https://streamable.com/csyb0s |
22:26:58 | FromDiscord | <Elegantbeef> The only time GC is really an issue in games is when you're using Java and want to make a 'infinitely' large block game |
22:27:26 | FromDiscord | <Arathanis> In reply to @Elegantbeef "Like the hell are": My, admittedly limited, understanding is some people think non-deterministic GC is a big no-no for games cause it can randomly cause performance drops. I've heard ref counting where its cleaned up as soon as the ref count is 0 is considered fine. |
22:27:46 | FromDiscord | <Elegantbeef> Meh you've already fucked up in that case |
22:27:59 | FromDiscord | <Elegantbeef> If you're having clean up during gameplay you need to quit what you're doing |
22:28:24 | FromDiscord | <Arathanis> surely some things need to be deconstructed during gameplay, right? |
22:28:50 | FromDiscord | <Elegantbeef> Even in Unity with C# it's good practice to have near 0 GC |
22:29:31 | FromDiscord | <Arathanis> I guess if you use an Arena even objects you no longer need aren't wasted, they are waiting to be reused not just orphaned for when you decide its time to clean the memory up |
22:29:58 | FromDiscord | <Arathanis> In reply to @Elegantbeef "https://streamable.com/csyb0s": this is neat, whats the concept? |
22:30:26 | FromDiscord | <Arathanis> im trying to decide if its tower defense-esque or like a novel kind of chess or something |
22:30:40 | FromDiscord | <Arathanis> oh wiat im dumb i see it now |
22:31:50 | FromDiscord | <Elegantbeef> The most heap allocations i do in my project is loading models/textures and the GUI |
22:31:55 | FromDiscord | <Elegantbeef> Since my GUI is fully retained and OOP based |
22:33:32 | FromDiscord | <dom96> arkanoid: what type is `future`? |
22:33:35 | arkanoid | I think I can't get a smaller example than this: https://play.nim-lang.org/#ix=4fED |
22:34:09 | FromDiscord | <dom96> And no, this is not a problem with the async macro |
22:34:57 | arkanoid | dom96: I'm trying to wrap withTimeout proc with a custom version that raises exception, but I'm failing to understand why it's complaning about returning a future.read for a Future[void] |
22:35:19 | arkanoid | I mean, do I have to check about not-voidness before returning? |
22:35:40 | FromDiscord | <Elegantbeef> You say it's not a problem with the async macro but given that it fails the `isVoid` branch of `completeImpl` says otherwise imo |
22:36:13 | FromDiscord | <Elegantbeef> Ah sorry it's inside asyncfuture |
22:37:23 | FromDiscord | <dom96> You can't `read` a Future[void] |
22:37:39 | FromDiscord | <dom96> But yes, the error message you get sucks |
22:37:43 | FromDiscord | <Elegantbeef> Uhhh |
22:38:00 | arkanoid | sure, but I was expecting it to resolve to a simple "return" |
22:38:14 | FromDiscord | <Elegantbeef> `read` has a branch specifically for `T isnot void` |
22:38:26 | arkanoid | not blaming anyone here, except me |
22:38:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fEE |
22:38:31 | FromDiscord | <Elegantbeef> Also `T: not void` isnt specified |
22:38:33 | FromDiscord | <dom96> okay, let me be more specific |
22:38:42 | FromDiscord | <dom96> You cannot return a void |
22:38:50 | FromDiscord | <dom96> same way you can't echo a void |
22:39:20 | arkanoid | ok, so when T is not void: return future.read |
22:39:27 | FromDiscord | <dom96> yep |
22:41:33 | arkanoid | {.async.} procs without explicit return type are implicit Future[void], correct? |
22:41:40 | FromDiscord | <dom96> yep |
22:41:48 | arkanoid | thanks twice |
22:42:05 | FromDiscord | <dom96> You're welcome 🙂 |
22:43:20 | * | ehmry quit (Ping timeout: 260 seconds) |
22:44:59 | arkanoid | I've created my custom variant of asyncCheck called asyncCatch that never raises exception (it is a server program that never quits), problem is that I'm getting less detailed stacktraces than asyncCheck, and I think its due to asyncfutures.injectStacktrace, but it's not exported |
22:45:50 | arkanoid | well, I'll wrap asyncCheck instead of making a variant of it, I guess |
22:47:07 | FromDiscord | <dom96> I often create an `asyncLog` which logs the exceptions in my server programs |
22:47:10 | * | ehmry joined #nim |
22:49:59 | arkanoid | dom96: this takes me to the initial question. asyncCheck exception cannot be stopped, right? They crash the program |
22:52:37 | FromDiscord | <dom96> there might be some hacky way, but in general they cannot be stopped |
22:58:41 | arkanoid | if asyncCheck is hacking the way to create better stacktraces using private injectStacktrace, I think that an alternative to asyncCheck that can be used as "main async trampoline" that let user controls what is happening in case of error is missing in async api |
23:00:02 | FromDiscord | <dom96> yep, plenty of things missing |
23:03:44 | arkanoid | also my async network code is filled with withTimout code. Basically one for every await. Well, not sure if there's anything nicer here, except considering timeout embedded in asyncnet procs |
23:04:41 | FromDiscord | <dom96> also any operations that timeout won't be cancelled (!) |
23:04:56 | arkanoid | ? |
23:07:11 | arkanoid | do you mean that whenever I get Future[bool] > false from withTimout, the underlying future is left in ram? |
23:08:01 | arkanoid | (asking this as I'm fighting a mysterious memory leak in my 100% nim async-based project) |
23:08:55 | FromDiscord | <dom96> withTimeout(sock.read(1024), 100) # if this times out then the `sock.read` will still continue trying to read data from the socket, and at some point in the future it will read that data |
23:09:56 | arkanoid | oh! |
23:10:12 | * | ehmry quit (Ping timeout: 248 seconds) |
23:10:44 | arkanoid | I need to force close the futures, then |
23:10:52 | FromDiscord | <dom96> what you should do in that case is close the `sock` (or whatever other FD you are using) |
23:10:57 | arkanoid | (and also I guess I've just found where my memory leak is) |
23:11:00 | FromDiscord | <dom96> this will cancel any pending operations on it |
23:11:29 | FromDiscord | <dom96> there is no way to cancel a specific future (the chronos fork of Nim's async supports this though in case you need it) |
23:11:58 | FromDiscord | <dom96> but honestly, if your operation timed out you usually want to close the associated fd anyway |
23:13:04 | arkanoid | dom96: well, now that I know this I have to refactor my code to actually move around AsyncSocket references, instead of abstracting them away |
23:13:12 | arkanoid | (or just move to chronos= |
23:15:03 | * | ehmry joined #nim |
23:27:25 | arkanoid | thanks again for the answers |
23:31:27 | * | derpydoo quit (Quit: derpydoo) |
23:33:30 | * | cornfeedhobo quit (*.net *.split) |
23:33:30 | * | ixmpp quit (*.net *.split) |
23:42:18 | * | cornfeedhobo joined #nim |