<< 11-05-2024 >>

00:00:23FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "So then whatever does": Do you have an exemple so I can better undestand please?
00:08:30FromDiscord<Elegantbeef> https://play.nim-lang.org/#pasty=uFMmKOzX
00:08:34FromDiscord<Elegantbeef> Something like this should suffice
00:08:57FromDiscord<Elegantbeef> You need to explicitly do `addPointer` to extend the lifetime of `MyType` else it destroys at the end of the frame
00:11:54FromDiscord<Elegantbeef> Though the tilengine API sorta sucks from cursory look
00:12:33FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Though the tilengine API": Yeah it's a bit unsafe
00:15:24FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=SGQPMpQL
00:15:41FromDiscord<Elegantbeef> Yes
00:15:45FromDiscord<Elegantbeef> `=wasMoved` explicitly disarms `=destroy`
00:18:09FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=RbvGAmcu
00:18:16FromDiscord<Elegantbeef> Do not try this memory leak at home
00:19:08FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=WaGXiijF
00:19:55FromDiscord<Elegantbeef> when you do `getMyType` in the example if you do not submit it back to tile engine it would be deleted
00:20:19FromDiscord<Elegantbeef> This is the issue with the tile engine api
00:20:35FromDiscord<Elegantbeef> It's not that it's unsafe it's that it infringes on life times 😄
00:21:56FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "It's not that it's": Yeah lifetimes are tricky on this engine↵You have to manage it by yourself
00:22:52FromDiscord<Elegantbeef> Yep which means you either have to do the above where you explicitly add back or you have no automatic management cause the API is poorly designed
00:23:24FromDiscord<System64 ~ Flandre Scarlet> In both cases it will look quite ugly
00:23:51FromDiscord<Elegantbeef> Well time to fork it 😄
00:24:19FromDiscord<Elegantbeef> No longer use globals, pass in a `tileEngineState`!
00:24:46FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Well time to fork": the C language...↵I'm clearly not an expert in this language 🤣
00:25:12FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "No longer use globals,": Oh, the engine stores as globals?
00:25:15FromDiscord<Elegantbeef> I'm not even worried about the ugly code, it's just not correct code
00:26:00FromDiscord<Elegantbeef> Well yea you do not pass in a parameter that holds all your state
00:26:11FromDiscord<System64 ~ Flandre Scarlet> The right way is to have a root object that contains everything
00:27:11FromDiscord<System64 ~ Flandre Scarlet> like an Engine object that contains an array of layer objects, each layer contains a tilemap, a palette and so on
00:30:24FromDiscord<zumi.dxy> Globals but with extra steps
00:42:27FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Well yea you do": In fact I try to make my own engine in Nim↵layers are fairly trivial to do, but sprites...
00:43:13FromDiscord<Elegantbeef> a 2D renderer is not that difficult
00:43:26FromDiscord<Elegantbeef> It's work, but it's not the worst thing in the world
00:44:46FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "It's work, but it's": Well, I don't really know how to optimize sprite rendering
00:44:58FromDiscord<System64 ~ Flandre Scarlet> especially when I do a scanline renderer
00:45:37FromDiscord<Elegantbeef> All in post processing!
00:45:47FromDiscord<System64 ~ Flandre Scarlet> wdym?
00:46:19FromDiscord<Elegantbeef> I'm mostly joking
00:46:50FromDiscord<System64 ~ Flandre Scarlet> Oh alright, sorry↵However the background renderer works fine
00:46:53FromDiscord<Elegantbeef> I'd just avoid doing scanline rendering myself
00:47:05FromDiscord<Elegantbeef> It's just extra work and cannot really be done well on the gpu
00:47:40FromDiscord<Elegantbeef> You can approximate a lot using shaders
00:47:43FromDiscord<Elegantbeef> Not everything, but a lot
00:48:33FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "I'd just avoid doing": Tilengine uses the CPU
00:48:50FromDiscord<Elegantbeef> of course
00:49:05FromDiscord<Elegantbeef> Scan line rendering is not really possible to do on the gpu
00:49:10FromDiscord<System64 ~ Flandre Scarlet> and OpenGL... Is pain
00:50:10FromDiscord<Elegantbeef> Nah opengl isn't that bad
00:50:42FromDiscord<System64 ~ Flandre Scarlet> Raylib 👌
00:51:08FromDiscord<Elegantbeef> Eh
01:18:54*coldfeet quit (Remote host closed the connection)
01:46:01FromDiscord<zumi.dxy> raylib seems alright but it is glfw-based
01:54:40FromDiscord<System64 ~ Flandre Scarlet> In reply to @zumi.dxy "raylib seems alright but": What's the problem with glfw?
01:55:19FromDiscord<polylokh_39446> I keep reading it as Games For Windows Live and I don't like that.
01:55:49FromDiscord<zumi.dxy> In reply to @sys64 "What's the problem with": i heard it has an sdl backend now
01:55:59FromDiscord<zumi.dxy> nothing wrong, practically
02:00:09*beholders_eye quit (Read error: Connection reset by peer)
02:05:56*beholders_eye joined #nim
02:30:45*beholders_eye quit (Read error: Connection reset by peer)
02:36:38*beholders_eye joined #nim
02:58:46*def- quit (Quit: -)
02:59:33*beholders_eye quit (Read error: Connection reset by peer)
03:00:16*def- joined #nim
03:05:30*beholders_eye joined #nim
03:55:47*beholders_eye quit (Read error: Connection reset by peer)
04:01:26*beholders_eye joined #nim
04:07:35FromDiscord<eightbit_dboy> Anyone recommend any good tutorials on wrapping C libraries for Nim? I wanna try wrapping GBDK so people can write GameBoy games in Nim.
04:08:03FromDiscord<eightbit_dboy> It would also require building with GBDK's CC.
04:17:48FromDiscord<treeform> In reply to @eightbit_dboy "Anyone recommend any good": Good Boy Galaxy is written in Nim: https://www.kickstarter.com/projects/penguinrik/goodboy-galaxy-exploration-platform-game-gba-pc-and-switch
04:18:11FromDiscord<treeform> https://exelo.tl/goodboy-demo-tooling.html
04:18:12FromDiscord<Elegantbeef> https://github.com/exelotl/natu
04:18:42FromDiscord<eightbit_dboy> In reply to @treeform "Good Boy Galaxy is": This is for GBA, GBDK is for GameBoy and GameBoy Color.
04:18:51FromDiscord<eightbit_dboy> It also targets SMS, GG, and a couple others.
04:19:02FromDiscord<treeform> Best tool for wrapper C libraries that I found recently is ChatGPT
04:19:11FromDiscord<eightbit_dboy> lol
04:19:14FromDiscord<treeform> (edit) "wrapper" => "wrapping"
04:19:21FromDiscord<eightbit_dboy> Fair.
04:19:22FromDiscord<Elegantbeef> Futhark exists
04:19:30FromDiscord<eightbit_dboy> Futhark?
04:19:42FromDiscord<Elegantbeef> Generates bindings from headers using libclang
04:20:14FromDiscord<treeform> A lot of times C libraries are very big, but you just need a small part. So I recommend just wrapping the small part.
04:20:23FromDiscord<treeform> We do this with Windy and Debby
04:20:56FromDiscord<eightbit_dboy> https://gbdk-2020.github.io/gbdk-2020/docs/api/dir_a9f896cff747ba031115e41245385c17.html
04:21:03FromDiscord<treeform> we wrap small part of win32, x11, wayland, and mac stuff (objc): https://github.com/treeform/windy/tree/master/src/windy/platforms
04:21:12FromDiscord<eightbit_dboy> It's not a large library.
04:22:15FromDiscord<treeform> For debby I wrap libmysql, libpq, and libsqlite3 https://github.com/treeform/debby/tree/master/src/debby
04:22:41FromDiscord<treeform> And Puppy (also just win32, curl and mac stuff)
04:22:58FromDiscord<treeform> https://github.com/treeform/puppy/tree/master/src/puppy/platforms
04:23:03FromDiscord<Elegantbeef> The issue with not using a compiler is that the bindings can be incorrectly typed, so there is a benefit for anything long lived
04:23:13FromDiscord<eightbit_dboy> I'm talking about just wrapping GBDK in general to make it available.
04:23:27FromDiscord<Elegantbeef> Yea you could use futhark or c2nim to get bindings
04:23:27FromDiscord<eightbit_dboy> Not for a specifically tailored purpose.
04:23:40FromDiscord<Elegantbeef> The former is automatic and works relatively well(though expects clang)
04:23:43FromDiscord<eightbit_dboy> Yeah, but are there any good tutorials you recommend?
04:23:46FromDiscord<Elegantbeef> The latter works less well but does work
04:24:07FromDiscord<eightbit_dboy> Because I was asking for tutorials.
04:24:09FromDiscord<Elegantbeef> Futhark is extraordinarily easy to use to get bindings
04:24:31FromDiscord<treeform> I found that C headers contains so much defines and strange stuff that automated wrapping never works well.
04:24:50FromDiscord<Elegantbeef> I mean that's why futhark works so well
04:24:52FromDiscord<Elegantbeef> It's quite literally a C compiler
04:25:06FromDiscord<Elegantbeef> It expects clang though
04:25:17FromDiscord<Elegantbeef> So any defines that do not work or expect clang fail
04:25:33FromDiscord<eightbit_dboy> Hmmm...
04:25:44FromDiscord<eightbit_dboy> Well, GBDK uses its own CC
04:25:59FromDiscord<Elegantbeef> Yea but how wild is the C?
04:26:05*lucasta quit (Quit: Leaving)
04:26:11FromDiscord<eightbit_dboy> Dunno
04:26:20FromDiscord<Elegantbeef> Does it do anything non standard that would break clang and friends
04:26:25FromDiscord<eightbit_dboy> https://gbdk-2020.github.io/gbdk-2020/docs/api/index.html
04:26:57FromDiscord<Elegantbeef> Or is it just a specialised compiler backend
04:27:15FromDiscord<eightbit_dboy> At any rate, do y'all recommend any tutorials, as I have been asking for tutorials on how to do this.
04:27:18FromDiscord<eightbit_dboy> (edit) "this." => "this?"
04:27:36FromDiscord<Elegantbeef> I do not really have any tutorials aside from the manual on `importc`
04:27:53FromDiscord<Elegantbeef> It's not that complicated to import code to Nim, match the types say `importc` add a `header`
04:28:07FromDiscord<eightbit_dboy> This? https://nim-lang.org/docs/manual.html#foreign-function-interface-importc-pragma
04:28:14FromDiscord<Elegantbeef> Yea
04:28:37FromDiscord<Elegantbeef> That and the header pragma
04:28:38FromDiscord<eightbit_dboy> https://tenor.com/view/samuel-l-jackson-shit-negro-pulp-fiction-thats-all-you-had-to-say-talking-on-the-phone-gif-10015334
04:29:14FromDiscord<eightbit_dboy> Huh. It's not showing the actual gif.
04:29:36FromDiscord<Elegantbeef> No embeds here
04:29:40FromDiscord<eightbit_dboy> Ah.
04:38:35*def- quit (Quit: -)
04:39:02*def- joined #nim
04:47:00*beholders_eye quit (Ping timeout: 252 seconds)
04:49:42*def- quit (Quit: -)
04:50:20*def- joined #nim
05:10:03*def- quit (Quit: -)
05:11:14*def- joined #nim
05:12:03FromDiscord<drunkenalcoholic> sent a code paste, see https://play.nim-lang.org/#pasty=YVemyscJ
05:13:15FromDiscord<drunkenalcoholic> (edit) "https://play.nim-lang.org/#pasty=PqWaitLd" => "https://play.nim-lang.org/#pasty=ugDVWhrG"
05:45:36*def- quit (Quit: -)
05:45:54*def- joined #nim
05:53:29*ntat joined #nim
05:55:37FromDiscord<zumi.dxy> sent a long message, see https://pasty.ee/eeTuhakL
05:56:58FromDiscord<eightbit_dboy> In reply to @zumi.dxy "I think I can": Thanks!
06:00:34FromDiscord<zumi.dxy> sent a code paste, see https://play.nim-lang.org/#pasty=SOVBDQRU
06:13:04*def- quit (Quit: -)
06:14:07*def- joined #nim
06:17:16*lumidify quit (Quit: leaving)
06:17:44*def- quit (Client Quit)
06:17:55*def- joined #nim
06:26:30*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
06:26:54*SchweinDeBurg joined #nim
06:31:22*def- quit (Quit: -)
06:32:18*def- joined #nim
06:45:57FromDiscord<aryzen> so... I've been wondering what the general consensus is for what 3D physics engine people enjoy using... I've seen Jolt as the new praised one, theres Bullet, NewtonDynamics, and PhysX too... Which one would be the best choice? (Consider that engine compatibility is not an obstacle, but also conside I'd prefer if there were C bindings so I can get easy interop with other languages)
06:46:30FromDiscord<aryzen> ... And a +1 would be if there are any other 2D physics providers than Box2D that are good for a generale use engine
06:46:34FromDiscord<aryzen> (edit) "generale" => "general"
06:46:45FromDiscord<aryzen> OOPS
06:46:48FromDiscord<aryzen> Wrong server
06:46:50FromDiscord<Elegantbeef> Chipmunk and Box2D are the two popular 2D ones
06:47:16FromDiscord<Elegantbeef> Jolt is the new 3D one that has a lot of eyes for going towards
06:47:52FromDiscord<aryzen> Thank you for answering though, despite my airheadedness
06:48:02FromDiscord<Elegantbeef> Hey I see the message on both servers!
06:48:06FromDiscord<Elegantbeef> I'm special
06:48:50FromDiscord<.lisuwu_> beef is everywhere
06:49:08FromDiscord<Elegantbeef> https://github.com/jrouwe/JoltPhysics?tab=readme-ov-file#bindings-for-other-languages jolt has two C bindings which means it's easy enough to use elsewhere
06:50:50FromDiscord<Elegantbeef> Otherwise bullet is popular choise
06:50:52FromDiscord<Elegantbeef> choice\
06:52:43FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=UnPLjLoL
06:53:48FromDiscord<Phil> This is rather chronos specific so if anyone has any clue that'd be neat 😅
06:58:55FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=safKnusg
07:07:21*coldfeet joined #nim
07:11:17FromDiscord<goerge_lsd> any reason +, - etc procs not implemented for tables, just for HashSet ?
07:13:13FromDiscord<polylokh_39446> tables have keys and values, and only keys are a set. What would these operators do with the values?
07:13:40FromDiscord<goerge_lsd> just ignore the values I guess
07:13:56FromDiscord<polylokh_39446> the whole point of tables is to have values, though. Otherwise you could have a set.
07:15:20FromDiscord<polylokh_39446> any answer would need to be explained, and the explanation would take longer to write and undertand than the code to implement that answer specifically where you want it.
07:18:06FromDiscord<goerge_lsd> I started with a set, then realised I need to store values associated with set elements.. and thus a table
07:18:21*def- quit (Quit: -)
07:18:51FromDiscord<goerge_lsd> and now this doesn't work anymore: ` let toAdd = curFilelist - prevFilelist `
07:19:09*def- joined #nim
07:21:43FromDiscord<polylokh_39446> you can take a set of the keys of both of those tables and assign toAdd to their difference, or you can copy the first table into toAdd and subtract the entries found in the other table
07:22:31FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=QJZwBSYI
07:22:55FromDiscord<goerge_lsd> sent a code paste, see https://play.nim-lang.org/#pasty=lxXNqsgV
07:23:21FromDiscord<Elegantbeef> Big old performance trap
07:25:12FromDiscord<Phil> LGTM george
07:27:32FromDiscord<Elegantbeef> No it does not look good phil
07:28:45FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=opQcDnXF
07:28:50FromDiscord<Phil> It is simple and easy to look at. Unless this is a hot code path for optimization it's not worth the optimization
07:28:50FromDiscord<Elegantbeef> There we go that looks ok
07:30:28FromDiscord<polylokh_39446> tables have value semantics, `result = value1` accomplishes that first loop.↵the conditional on the second loop is a question you answered, that would have to be explained if this were general code. beef's already answered it differently there.
07:31:35FromDiscord<Elegantbeef> Copying a table like the above is faster than copying through getting key, then hashing
07:31:36FromDiscord<Elegantbeef> Whoops add ifs around the for loops 😄
07:32:09FromDiscord<polylokh_39446> since the order can change, it's different even with the ifs
07:32:44FromDiscord<polylokh_39446> with george_lsd's version, the first table's keys always have their values in the result.
07:38:09FromDiscord<Elegantbeef> Yea a union of tables makes little sense, personally I read `a + b` on collections and assume it's doing `c[0] = a[0] + b[0]`
07:46:40FromDiscord<Phil> For me the problem is its always ambiguous
07:46:58FromDiscord<Phil> Are you summing up the values? Are you concatenating the collections? Who knows! Not me !
07:48:08FromDiscord<Elegantbeef> Well you are not concatenating cause `&` is for concatenating in Nim 😛
07:48:20FromDiscord<Elegantbeef> `+` is supposed to be commutative
07:49:58FromDiscord<Phil> I'd just nip it in the bud in the first place and use decent proc names
07:50:47FromDiscord<Phil> I like operator overloading, but more for singular types instead of collections
07:52:23FromDiscord<Elegantbeef> `@[10, 20, 30] & bleh` is fine!
07:53:36FromDiscord<Phil> ehhhhhhh. Like, I could bare reading it, I wouldn't code it myself
08:01:01FromDiscord<odexine> I just read like 5 of the messages here so sorry if I’m wrong but
08:01:13FromDiscord<odexine> Technically tables are unordered
08:01:33FromDiscord<odexine> So + as concatenation would be commutative
08:01:41FromDiscord<Elegantbeef> The values are not though
08:01:51FromDiscord<Elegantbeef> One of the value comes out on top
08:02:08FromDiscord<Elegantbeef> `{"a": "b"} + {"a": "c"}`
08:02:10FromDiscord<odexine> True
08:02:48FromDiscord<odexine> If the rule were different it could be twisted to make that commutative too
08:03:10FromDiscord<Elegantbeef> In what way?
08:05:37FromDiscord<odexine> If it were (naturally only in the case of ordinal values) that bigger values always overwrite smaller ones
08:05:46FromDiscord<odexine> For example only
08:13:52*redj quit (Remote host closed the connection)
08:15:14*redj joined #nim
08:44:45FromDiscord<aintea> Is there some PEP like thing in Nim ?↵For example should I use snake case or camel case ?↵How do I know if I need to `function(object)` or `object.function` or `object.function()`
08:45:25FromDiscord<zumi.dxy> https://nim-lang.org/docs/nep1.html
08:45:37FromDiscord<zumi.dxy> camelCase is preferred
08:48:34FromDiscord<aintea> I didn't remember how to say it, it is "style guide"
08:48:35FromDiscord<aintea> Thanks
09:01:16FromDiscord<rakgew> for the last question\: you can use either, as ucs (iirc\: unified call syntax) makes that possible. \:-D↵(@aintea)
09:05:21FromDiscord<Phil> TIL that "return" in macros will absolutely bite me in the ass
09:05:32FromDiscord<Phil> (edit) "TIL that "return" ... in" added "in quote-do"
09:08:22FromDiscord<Phil> Nevermind, it wasn't the return, still weird as all hell
09:16:46*disso_pch quit (Quit: Leaving)
09:31:53*gst joined #nim
09:57:25*lumidify joined #nim
10:55:10*def- quit (Quit: -)
10:55:30*def- joined #nim
11:17:36FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=HevrDPPc
11:17:55FromDiscord<Phil> I would prefer to improve upon this because stacktrace info can be important
11:24:50NimEventerNew thread by basow53698: How to create a type that accepts a function with any arguments?, see https://forum.nim-lang.org/t/11585
12:07:17*xet7 joined #nim
12:07:33*rockcavera quit (Ping timeout: 252 seconds)
12:13:39*rockcavera joined #nim
12:30:54*beholders_eye joined #nim
12:56:08FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=aeaKPpfI
13:05:34*ntat quit (Remote host closed the connection)
13:05:52*ntat joined #nim
13:13:23FromDiscord<demotomohiro> Check if child nodes of `typ` is a type and print error if it was not a type.
13:21:26FromDiscord<kreatoo> is there a way to list object variable names as a string?
13:27:29FromDiscord<demotomohiro> `local` proc lists can do similar similar thing but contains all local variable names.↵https://nim-lang.org/docs/system.html#locals
13:28:01FromDiscord<demotomohiro> (edit) removed "lists"
13:28:10FromDiscord<goerge_lsd> In reply to @kreatoo "is there a way": https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CT
13:51:33*pbsds3 joined #nim
13:51:46FromDiscord<kreatoo> In reply to @goerge_lsd "https://nim-lang.org/docs/iterators.html#fieldPairs": works great, thanks
14:04:10*xet7 quit (Remote host closed the connection)
14:12:25*beholders_eye quit (Ping timeout: 268 seconds)
14:18:32FromDiscord<Robyn [She/Her]> Hey @odexine what are some concepts in functional programming you think that Nim could/would do well?
14:21:24FromDiscord<odexine> Not sure, that needs a bit of thought
14:22:08FromDiscord<Robyn [She/Her]> Fair enough, if you do get bored enough to think of it, lmk because I'm curious ehe
14:23:05FromDiscord<odexine> I’m not too sure what you mean actually
14:23:20FromDiscord<odexine> Like what would fit the philosophy?
14:24:21FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=QUqIEaqx
14:24:29FromDiscord<Phil> (edit) "https://play.nim-lang.org/#pasty=LuPIbpvP" => "https://play.nim-lang.org/#pasty=XytQVzYg"
14:30:45FromDiscord<Robyn [She/Her]> In reply to @odexine "Like what would fit": Yep
14:32:25FromDiscord<odexine> In reply to @isofruit "Does anyone understand why": It might be that Chronos is re-raising as future defect
14:32:51FromDiscord<Phil> Oh it is, I'm trying to understand why. There's nothing about this exception that makes it "unsolvable, program must crash" levels of bad
14:33:41FromDiscord<odexine> Might be the philosophy of the library. “Handle future errors where you await them, not at the loop”
14:34:42FromDiscord<Phil> The main issue I have with that is that now I either need to except `Exception` because as a lib author if this gets raised in an actor-thread I don't want it to nuke my actor, or I mandate `raises: []` in all async procs (which likely means in all procs)
14:35:58FromDiscord<odexine> Well defect problems apply (panics on means you’re dead anyway etc)
14:36:38FromDiscord<odexine> How would you mandate raises
14:38:14FromDiscord<Robyn [She/Her]> In reply to @odexine "It might be that": I am? 😛
14:39:02FromDiscord<Robyn [She/Her]> Maybe `chronos` has a callback meant for handling errors with futures?
14:42:25FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=kkTTPGdC
14:42:44FromDiscord<Phil> (edit) "https://play.nim-lang.org/#pasty=jskFMfdA" => "https://play.nim-lang.org/#pasty=AmlgUhAs"
14:42:52FromDiscord<odexine> In reply to @isofruit "The *actual* usecase is": Cursed pragma syntax
14:44:02FromDiscord<Phil> Either way I would like to avoid this and just catch where the problem arises at runtime because you're not going to always know which problems you might have
14:44:22FromDiscord<Phil> And nuking the thread in that scenario I would like to avoid
15:00:41FromDiscord<dolfy0191> Hi there!↵Is there an async way of checking for keypress? Like press 'Q' to exit from an async server.
15:02:30FromDiscord<dolfy0191> Ctrl+C is not elegant
15:03:34*coldfeet quit (Remote host closed the connection)
15:04:05FromDiscord<Robyn [She/Her]> Not sure there's a built-in system for that in the stdlib but maybe std/selectors might be usable to implement that somehow?
15:05:43FromDiscord<Phil> That sounds like the kind of thing an application lib would do for you, in which case you'd be using whatever they provide.↵I can't imagine listening to events at a very low level is that easy given that likely every OS does these events differently
15:07:07FromDiscord<dolfy0191> In reply to @isofruit "That sounds like the": Yep. this is my concern. But I will look into this selectors lib. Thanks for the tip!
15:10:35FromDiscord<Robyn [She/Her]> In reply to @dolfy0191 "Yep. this is my": https://nim-lang.org/docs/selectors.html I will warn you it's a bit low level but it's a good lib
15:10:49FromDiscord<Robyn [She/Her]> (edit) "In reply to @dolfy0191 "Yep. this is my": https://nim-lang.org/docs/selectors.html I will warn you it's a bit low level ... but" added "compared to async"
15:11:29FromDiscord<dolfy0191> In reply to @chronos.vitaqua "https://nim-lang.org/docs/selectors.html I will war": Yes, I found it. Thanks for the tip!
15:12:13FromDiscord<Robyn [She/Her]> No worries!
15:31:01*FromDiscord quit (Remote host closed the connection)
15:31:14*FromDiscord joined #nim
16:11:21*beholders_eye joined #nim
16:21:27*kotrcka joined #nim
16:21:42FromDiscord<System64 ~ Flandre Scarlet> Is there a way to convert an hexadecimal string (#FFFFFFFF, 0xFFFFFFFF and stuff like that) to an int?
16:33:53FromDiscord<solitudesf> In reply to @sys64 "Is there a way": https://nim-lang.org/docs/strutils.html#fromHex%2Cstring
16:46:53FromDiscord<System64 ~ Flandre Scarlet> In reply to @solitudesf "https://nim-lang.org/docs/strutils.html#fromHex%2Cs": Thanks!
16:47:18FromDiscord<System64 ~ Flandre Scarlet> It starts to be quite versatile https://media.discordapp.net/attachments/371759389889003532/1238895218007474186/colors.nim?ex=6640f295&is=663fa115&hm=128d338ee31c0ffe350119d6bb889d3cea26282958f353de0864398f9546747f&
16:50:35FromDiscord<Robyn [She/Her]> @System64 ~ Flandre Scarlet why not build your code upon https://github.com/treeform/chroma ?
16:52:23FromDiscord<System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "<@380360389377916939> why not build": Looks good, but seems the colors are in float format↵And Tilengine uses RGBA with 8 bits values
16:54:10FromDiscord<Robyn [She/Her]> In reply to @sys64 "Looks good, but seems": There's a ColorRGBA type
16:58:49*fallback quit (Read error: Connection reset by peer)
17:11:15*xet7 joined #nim
17:15:32*xet7 quit (Remote host closed the connection)
17:19:04*fallback joined #nim
17:29:28FromDiscord<Phil> Okay, remaining problems for me are pretty much "How do I make sure that chronos empties its asyncdispatcher queue before I gracefully shut down a given thread" and "How to I deal with async exceptions"
17:29:56FromDiscord<Phil> Finger's crossed I'll get a response on the exception thing
17:31:27FromDiscord<ieltan> In reply to @isofruit "Okay, remaining problems for": for checking if the queue is empty, maybe `pendingFuturesCount()`?
17:33:31FromDiscord<ieltan> In reply to @isofruit "Finger's crossed I'll get": have you checked https://status-im.github.io/nim-chronos/error_handling.html ?
17:34:25FromDiscord<Phil> I have. However, looking through it I do not see a solid matter to "globally" catch exceptions raised by parts of the code executed on the dispatcher
17:34:37FromDiscord<Phil> (edit) "matter" => "way"
17:34:45*kotrcka quit (Remote host closed the connection)
17:35:21FromDiscord<Phil> The idea is that somebody may be raising an exception in an async proc. I want to allow them to do that. If that happens, well your message is not getting fully processed, I log the exception and that's that.↵I do not want to nuke the entire thread that this exception occurred on
17:35:45FromDiscord<Phil> Chronos appears to not have anything for that case I think, but I'll have to see.
17:37:24FromDiscord<Phil> In reply to @ieltan "for checking if the": Only available with `-d:chronosFutureTracking`, which appears to be for debugging mainly
17:40:13*beholders_eye quit (Ping timeout: 255 seconds)
17:44:39*coldfeet joined #nim
17:50:21FromDiscord<System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "There's a ColorRGBA type": The engine encodes colors in ABGR format
17:52:34*coldfeet quit (Remote host closed the connection)
17:57:30FromDiscord<Robyn [She/Her]> Can always make a distinct `ColorABGR` and then just borrow most of the procedures and reimplement the ones used to output the format
18:00:30*def- quit (Quit: -)
18:00:34FromDiscord<kreatoo> is there a way to get a variable by the variable name?
18:00:48*def- joined #nim
18:03:25NimEventerNew thread by lou15b: Latest GCC version (14.1) breaks Nim's C backend, see https://forum.nim-lang.org/t/11587
18:08:59*fallback quit (Read error: Connection reset by peer)
18:14:05*beholders_eye joined #nim
18:16:12*fallback joined #nim
18:24:58FromDiscord<nocturn9x> uhm
18:25:06FromDiscord<nocturn9x> I'm almost certainly doing something wrong but
18:25:17FromDiscord<nocturn9x> `dealloc(ptr)` doesn't seem to actually release the memory
18:25:19FromDiscord<nocturn9x> like, ever
18:26:44FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=KquDRhVG
18:26:55FromDiscord<nocturn9x> (edit) "https://play.nim-lang.org/#pasty=WJoOYICi" => "https://play.nim-lang.org/#pasty=HiiKJxpz"
18:27:52FromDiscord<System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "Can always make a": Oh alright
18:28:10FromDiscord<Robyn [She/Her]> Yeah aha
18:30:10FromDiscord<nocturn9x> In reply to @nocturn9x "Code that does the": I tried calling the allocation code several times and have it allocate a 1GB table
18:30:19FromDiscord<nocturn9x> and it just keeps eating up more memory which is never released
18:30:22FromDiscord<nocturn9x> what is going on here?
18:33:54FromDiscord<nocturn9x> if I do `doAssert session.transpositionTable.isNil()` right after the dealloc, the assertion fails
18:34:02FromDiscord<nocturn9x> so do I just not get to free my memory? lol
18:36:05FromDiscord<Robyn [She/Her]> Doesn't Nim hold on to memory and not free it to the OS?
18:36:17FromDiscord<nocturn9x> _what_
18:36:26FromDiscord<nocturn9x> it caused a memory leak of 40 gigabytes
18:36:32FromDiscord<nocturn9x> I don't think that's a feature
18:36:53FromDiscord<nocturn9x> also I'm using `-d:useMalloc`
18:37:04FromDiscord<Robyn [She/Her]> Ah
18:37:14FromDiscord<nocturn9x> and while the allocator almost certainly doesn't return memory to the OS right away, it should definitely not pile up 40+ gigabytes of garbage
18:37:20FromDiscord<Robyn [She/Her]> Are you using arc? See if orc fixes the problem
18:37:28FromDiscord<polylokh_39446> Robyn's talking about general knowledge of allocation, not something specific to Nim. There's a naive view that free() instantly releases memory to the OS.
18:37:28FromDiscord<nocturn9x> I'm using ARC, yes
18:37:43FromDiscord<nocturn9x> In reply to @polylokh_39446 "Robyn's talking about general": oh I know `free()` isn't instantaneous
18:37:50FromDiscord<Robyn [She/Her]> In reply to @polylokh_39446 "Robyn's talking about general": Ah, sorry then
18:38:02FromDiscord<nocturn9x> but if I do `alloc(1GB); free(1GB); alloc(1GB);` I should still only have 1GB in use
18:38:05FromDiscord<Robyn [She/Her]> I'm not knowledgeable on how allocators work at all so I'm just guessing
18:38:06FromDiscord<nocturn9x> here I have 2
18:38:37FromDiscord<polylokh_39446> `session.transpositionTable.isNil()` is a bad test here because dealloc doesn't change the pointer that you have.
18:38:49FromDiscord<nocturn9x> gotcha
18:39:19FromDiscord<nocturn9x> ORC does not fix the problem
18:39:24FromDiscord<nocturn9x> I expected it, there's no cycles
18:39:28FromDiscord<nocturn9x> because there's no `ref`s
18:39:31FromDiscord<nocturn9x> but still, was worth a shot
18:39:49FromDiscord<nocturn9x> so how do I deallocate stuff?
18:41:04FromDiscord<polylokh_39446> a way that you might not only have 1GB in use after `alloc(1GB); free(1GB); alloc(1GB);` is if there are smaller allocations after the free.
18:41:29FromDiscord<nocturn9x> okay but here I'm talking about `dealloc()` doing actually nothing until OOM killer steps in
18:41:36FromDiscord<nocturn9x> it's the reason why I noticed in the first place
18:41:41FromDiscord<nocturn9x> you know, 40+ gigs of leaks
18:41:53FromDiscord<nocturn9x> (edit) "it's the reason why I noticed ... in" added "it"
18:42:06FromDiscord<polylokh_39446> in the scenario I just described, dealloc() still does something. It does something internal to the allocaator.
18:42:12FromDiscord<nocturn9x> I understand the allocator's free list might not be continuous
18:42:18FromDiscord<nocturn9x> but it's not an excuse for leaking 30 gigs
18:42:33FromDiscord<nocturn9x> malloc almost certainly doesn't do that
18:42:40FromDiscord<nocturn9x> I'm using mimalloc, for context
18:42:47FromDiscord<polylokh_39446> the allocator can't move your memory around to make all the free spaces large enough for the new allocation that never fits due to smaller allocations after the last free().
18:42:59FromDiscord<nocturn9x> okay so it just leaks???
18:43:22FromDiscord<nocturn9x> like do you see how that is a problem
18:43:35FromDiscord<polylokh_39446> that's malloc()'s interface. It doesn't control lifetimes or your pointers at all. You'd need a compacting GC
18:43:48FromDiscord<nocturn9x> that's not my point
18:43:55FromDiscord<nocturn9x> a memory allocator _should not leak_
18:44:04FromDiscord<nocturn9x> allocation calls might take more times as it compacts the free list
18:44:19FromDiscord<nocturn9x> but "there is not enough free space" is not an excuse when it can just request more memory and then compact
18:44:26FromDiscord<nocturn9x> (edit) "times" => "time"
18:44:33FromDiscord<polylokh_39446> literally any malloc() implementation will leak in the scenario I described. There's no room for the 1GB allocation, it has to ask the OS for more information.
18:44:40FromDiscord<polylokh_39446> it can't compact
18:44:48FromDiscord<nocturn9x> and then it just won't release the free space in between?
18:44:56*krux02 joined #nim
18:45:01FromDiscord<nocturn9x> well that's colossally idiotic
18:45:17FromDiscord<polylokh_39446> if you have smaller allocations keeping the allocator's internal segments alive, it just has to keep them allocated. malloc() doesn't manage your memory, it's not a GC
18:45:29FromDiscord<Robyn [She/Her]> Won't more smaller allocations end up taking up the empty 1 GB space?
18:45:33FromDiscord<nocturn9x> In reply to @polylokh_39446 "it *can't* compact": wdym it can't? It has all the necessary metadata to do so and afaik there are allocators that do that
18:46:10FromDiscord<polylokh_39446> yeah smaller allocations can go in the mostly empty spaces.
18:46:34FromDiscord<nocturn9x> is there a way to force the allocator to just give the memory back to the OS
18:46:48FromDiscord<polylokh_39446> malloc can't control your pointers to change them after it moves memory, so it can't move memory.
18:46:54FromDiscord<Elegantbeef> Write your own allocator\
18:46:58FromDiscord<nocturn9x> also, the actual thing that's taking space
18:47:01FromDiscord<nocturn9x> is a nim `seq`
18:47:06FromDiscord<Elegantbeef> Though when a page is empty it should be returned
18:47:12FromDiscord<nocturn9x> that's the container that's 1GB in size
18:47:29FromDiscord<nocturn9x> and `clear()` does `setLen(0)`
18:47:34FromDiscord<nocturn9x> does that not release the memory?
18:47:43FromDiscord<Elegantbeef> No
18:47:46FromDiscord<Elegantbeef> Nim explicitly does that enable memory reuse
18:47:56FromDiscord<Elegantbeef> `= @[]` will return memory
18:48:00FromDiscord<nocturn9x> well okay then I just need to assign an empty seq
18:48:01FromDiscord<nocturn9x> yeah
18:48:09FromDiscord<nocturn9x> easy enough fix
19:01:05FromDiscord<nocturn9x> well it's always good to know that the issue is you being stupid at least
19:01:10FromDiscord<nocturn9x> this time it was all my fault :P
19:02:38FromDiscord<xkonti> What are the rules for closing channels? "Nim by example" skips it completely:(
19:02:52FromDiscord<nocturn9x> ah, channels
19:02:57FromDiscord<nocturn9x> another of nim's wild beasts
19:03:07FromDiscord<nocturn9x> look at them funny and they'll blow up in your face, violently
19:03:13FromDiscord<nocturn9x> (edit) "another ... of" added "one"
19:03:27FromDiscord<Phil> In reply to @kreatoo "is there a way": You'd need to specify more what you mean. Generally if this is metaprogramming related the naswer is most of the time macro or sometimes template
19:03:53FromDiscord<nocturn9x> In reply to @kreatoo "is there a way": you mean like in Python you can do `globals()["foo"]`?
19:04:04FromDiscord<nocturn9x> I think in nim it's achievable with macros
19:04:09FromDiscord<polylokh_39446> <https://nim-lang.org/docs/system.html#example-passing-channels-safely> talks about `Channel[T]` if that's the one you mean.
19:05:45FromDiscord<Phil> Wait, are we on a crusade against malloc now? I skimmed over the convo
19:05:56*fallback quit (Read error: Connection reset by peer)
19:06:02FromDiscord<Phil> In reply to @nocturn9x "look at them funny": TBF channels never blew up on me
19:06:11FromDiscord<Phil> allocation related to moving memory absolutely did.↵But that's arc
19:06:14FromDiscord<Phil> (edit) "arc" => "arc/orc"
19:06:27FromDiscord<nocturn9x> you would expect a thing meant for thread communication to be safe from race conditions
19:06:34FromDiscord<nocturn9x> channels definitely _claim_ to be race-condition-free
19:06:36FromDiscord<Robyn [She/Her]> In reply to @nocturn9x "I think in nim": Only with static strings though, I believe
19:06:37FromDiscord<polylokh_39446> no, there was a side discussion about malloc.
19:06:38FromDiscord<nocturn9x> keyword claim
19:06:44FromDiscord<nocturn9x> In reply to @chronos.vitaqua "Only with static strings": yeah probably
19:06:56FromDiscord<Phil> In reply to @nocturn9x "channels definitely _claim_ to": Oh they are, (The threading ones, didn't test system.Channels but I assume they're similar)
19:07:07FromDiscord<nocturn9x> they are not afaik
19:07:09FromDiscord<Phil> But that doesn't automagically take care of the MM related issues
19:07:15FromDiscord<nocturn9x> TSAN doesn't like em
19:07:20FromDiscord<nocturn9x> we talked about this iirc
19:07:21FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=bzclfOnN
19:07:37FromDiscord<Phil> Yeh, but I distinguish there: The channel code can't do too much here
19:07:46FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=ZTDdBYRv
19:07:50FromDiscord<Phil> This is a MM problem in my eyes
19:07:58FromDiscord<Robyn [She/Her]> If they're all the same type, you should use a `Table` from `std/tables` though
19:08:03FromDiscord<nocturn9x> In reply to @chronos.vitaqua "If they're all the": this
19:08:12FromDiscord<Phil> Though I'm only medium knowledgeable in the field so take that with a grain of salt
19:08:16FromDiscord<nocturn9x> or if you will know the type at some point
19:08:20FromDiscord<nocturn9x> `cast` it
19:08:22FromDiscord<nocturn9x> (edit) "it" => "them"
19:08:24FromDiscord<Robyn [She/Her]> In reply to @nocturn9x "I have never actually": Macros are pretty easy, just a slight learning curve
19:08:26FromDiscord<nocturn9x> and store `pointer`s
19:08:39FromDiscord<Robyn [She/Her]> Yeah, this, but still would advise against doing this in general since unsafe
19:08:39FromDiscord<Phil> In reply to @nocturn9x "or if you will": Fun fact, I wrote a fairly decent Table-abstraction that allows storing pointers of vastly different types
19:08:44FromDiscord<Phil> By their types
19:08:46FromDiscord<nocturn9x> In reply to @chronos.vitaqua "Yeah, this, but still": yeah
19:09:00FromDiscord<nocturn9x> In reply to @isofruit "Fun fact, I wrote": oh?
19:09:02FromDiscord<nocturn9x> how?
19:09:12FromDiscord<Robyn [She/Her]> In reply to @isofruit "By their types": That's pretty easy though, no?
19:09:12FromDiscord<Phil> It's not even that complicated, one sec
19:09:28FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=LnrUZEwl
19:09:37FromDiscord<Phil> In reply to @chronos.vitaqua "That's pretty easy though,": Yeh
19:09:55FromDiscord<nocturn9x> uh
19:10:00FromDiscord<nocturn9x> what does the borrow pragma do
19:10:05FromDiscord<nocturn9x> steal the impl of the type?
19:10:10FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=qHmFEEOa
19:10:10FromDiscord<nocturn9x> shit I could've used that
19:10:16FromDiscord<Robyn [She/Her]> In reply to @nocturn9x "steal the impl of": Yep
19:10:46FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=QLwwhKnd
19:10:50FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=MxmQBqQU
19:11:03FromDiscord<Robyn [She/Her]> Fair
19:11:05FromDiscord<nocturn9x> that would've been useful to know
19:11:09FromDiscord<nocturn9x> upsie
19:11:11FromDiscord<Robyn [She/Her]> I used similar code for my event system
19:11:19FromDiscord<Phil> And it's kinda nice to be able to go `table[int]` and get a `MyType[int]` out
19:11:23FromDiscord<Robyn [She/Her]> https://github.com/Nimberite-Development/Pulse-Nim
19:11:29FromDiscord<Robyn [She/Her]> Specifically for listeners of objects though
19:11:41FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=KkiMNdhB
19:11:55FromDiscord<nocturn9x> for local variables at least
19:11:59FromDiscord<Phil> In reply to @nocturn9x "is the global pragma": Dunno C enough. In this case per type invocation you're basically instantiating a new global variable
19:12:15FromDiscord<Phil> Since those new global variables all have different pointers, you get one specific type of pointer per type
19:12:16FromDiscord<nocturn9x> that's what `static` does for locals in C but I think it's not type specific
19:12:22FromDiscord<odexine> In reply to @nocturn9x "is the global pragma": p much
19:12:33FromDiscord<nocturn9x> neat
19:13:00FromDiscord<Phil> It's kind of a hack to get something unique per type since getting a unique identifier from a type is kinda difficult
19:13:01FromDiscord<polylokh_39446> what makes it type specific is that the global variable's defined in a generic function
19:13:14FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=diUSGPNH
19:13:24FromDiscord<Robyn [She/Her]> In reply to @isofruit "It's kind of a": `getTypeImpl` in stdlib?
19:13:37FromDiscord<nocturn9x> In reply to @polylokh_39446 "what makes it type": ah so the generic is instantiated only once so there's only one per type
19:13:40FromDiscord<Phil> Yes, ptr = pointer.↵It's just smarter to use `ptr someType` so you know more about what's behind the pointer
19:13:42FromDiscord<nocturn9x> (edit) "In reply to @polylokh_39446 "what makes it type": ah so the generic is instantiated only once ... so" added "per type"
19:13:47FromDiscord<nocturn9x> this would never work in my compiler
19:14:03FromDiscord<nocturn9x> since generics are parametrically polymorphic and typechecked and (currently) compiled once
19:14:11FromDiscord<Robyn [She/Her]> `getTypeInfo`
19:14:14FromDiscord<nocturn9x> I could definitely have the code generator specialize for different implementations though
19:14:25FromDiscord<Robyn [She/Her]> https://github.com/Nimberite-Development/Pulse-Nim/blob/main/src/pulse.nim#L62
19:14:44FromDiscord<nocturn9x> In reply to @isofruit "Yes, ptr = pointer.": I always thought `pointer` was the only way of getting the C equivalent of `void`
19:14:45FromDiscord<Phil> In reply to @chronos.vitaqua "`getTypeImpl` in stdlib?": I no longer recall what the potential problem there was or not. I tried half a dozen things before beef suggested the global, that worked and is goot enough for my purposes.
19:14:48FromDiscord<nocturn9x> `ptr` is way nicer
19:14:56FromDiscord<nocturn9x> I vividly remember that not being allowed syntactically in the past
19:15:00FromDiscord<nocturn9x> did that change
19:15:02*fallback joined #nim
19:15:14FromDiscord<Phil> I've only been part of this community for... 2.5 years or so
19:15:19FromDiscord<Phil> Has been allowed ever since I've joined
19:15:25FromDiscord<Robyn [She/Her]> In reply to @nocturn9x "`ptr` is way nicer": `ptr` is a generic, iirc
19:15:27FromDiscord<Robyn [She/Her]> Is it not?
19:15:31FromDiscord<nocturn9x> I've been using Nim for... idk, 3-4 years?
19:15:42FromDiscord<polylokh_39446> `ptr` isn't a valid type on its own.
19:15:47FromDiscord<Robyn [She/Her]> Yeah thought so
19:16:06FromDiscord<odexine> `ptr` is not concrete
19:16:11FromDiscord<Phil> I will be honest, if it isn't that didn't occur to me so far as the implicit generics it created did the job for me every time
19:16:55FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=rLypEugC
19:17:15FromDiscord<polylokh_39446> (edit) "https://play.nim-lang.org/#pasty=aAtFauwj" => "https://play.nim-lang.org/#pasty=tRKwZBmj"
19:17:24FromDiscord<Robyn [She/Her]> !eval var x: ptr
19:17:26NimBotCompile failed: /usercode/in.nim(1, 5) Error: invalid type: 'ptr' for var
19:17:39FromDiscord<Phil> So far it looked to me like ptr was just the short form of pointer with the added benefit you could specify `ptr T`
19:17:55FromDiscord<Robyn [She/Her]> !eval var x: pointer
19:17:58NimBot<no output>
19:17:59FromDiscord<Robyn [She/Her]> !eval var x: ptr void
19:17:59FromDiscord<polylokh_39446> it's a required benefit, though
19:18:01NimBotCompile failed: /usercode/in.nim(1, 8) Error: type 'ptr void' is not allowed
19:18:21FromDiscord<Robyn [She/Her]> Would've been nice to make `ptr void` valid though
19:18:34FromDiscord<Phil> ~~Anyway, I need chronos experts~~
19:18:51FromDiscord<Robyn [She/Her]> ~~Why do you need an expert on me tho?~~
19:19:34FromDiscord<Phil> ~~Because somebody squeezed you into a lib and I'm using that lib to make you do async work and I need the magic works to make you do your job correctly~~
19:19:52FromDiscord<Robyn [She/Her]> It's called drugs :3
19:19:59FromDiscord<odexine> In reply to @isofruit "So far it looked": `ptr` is a type class, like saying `ref`
19:20:12FromDiscord<Phil> Yeh, I gathered from the other posts so far 😄
19:20:16FromDiscord<odexine> basically it's an implicit generic
19:20:47FromDiscord<odexine> In reply to @chronos.vitaqua "Would've been nice to": id say no, it's not obvious to a non-c user
19:21:01FromDiscord<odexine> then again in a sense pointer isnt but id say its better in some sense
19:21:02FromDiscord<Robyn [She/Her]> !eval var (x, y): (ptr typeof(nil), ptr nil)
19:21:04NimBotCompile failed: /usercode/in.nim(1, 12) Error: expected: '=', but got: ':'
19:21:20FromDiscord<Robyn [She/Her]> Oh
19:21:26FromDiscord<Robyn [She/Her]> !eval var x: ptr nil
19:21:28NimBotCompile failed: /usercode/in.nim(1, 12) Error: expected type, but got: nil
19:21:31FromDiscord<Robyn [She/Her]> !eval var x: ptr typeof(nil)
19:21:33NimBotCompile failed: /usercode/in.nim(1, 5) Error: invalid type: 'typeof(nil)' in this context: 'ptr typeof(nil)' for var
19:21:40FromDiscord<Robyn [She/Her]> Damn
19:21:44FromDiscord<Robyn [She/Her]> Oh well
19:22:22FromDiscord<Elegantbeef> Phil really out here misleading people
19:22:38FromDiscord<odexine> no better than you
19:23:13FromDiscord<Robyn [She/Her]> Lol Einstein's book
19:25:13FromDiscord<michaelb.eth> `object` can also be used as an implicit generic, right?
19:25:21*coldfeet joined #nim
19:25:32FromDiscord<michaelb.eth> or maybe I've misunderstood when I've seen that in the past
19:25:35FromDiscord<Elegantbeef> Yes most types can be
19:25:52FromDiscord<Elegantbeef> `distinct | tuple | enum | object | ref | ptr` is a valid typeclass
19:26:06FromDiscord<Elegantbeef> Whoops left out `set` and `range` but range is brokey
19:27:36FromDiscord<michaelb.eth> huh, bare `distinct` is kind of a weird one
19:28:27FromDiscord<Elegantbeef> Not really
19:28:48FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=NFWzzvyl
19:37:09FromDiscord<kreatoo> sent a code paste, see https://play.nim-lang.org/#pasty=oeXyXpWF
19:40:26FromDiscord<Elegantbeef> Nope `bindsym` is wrong
19:40:48FromDiscord<Elegantbeef> Should be `(a: static string): untyped = ident(a)`
19:44:12FromDiscord<tsoj> How do I embed binary data into an executable? Using `staticRead` I run into this: `fatal error: translation unit is too large for Clang to process: ran out of source locations` (the data I want to embed is ~800 MB large).
19:51:11*beholders_eye quit (Ping timeout: 252 seconds)
19:54:48FromDiscord<Robyn [She/Her]> !eval type↵ A = distinct distinct string↵↵var b: A
19:54:50NimBotCompile failed: /usercode/in.nim(1, 23) Error: invalid indentation
19:55:08FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=hPwzqiBc
19:56:11FromDiscord<Robyn [She/Her]> In reply to @tsoj "How do I embed": What if you break it up into chunks of data?
20:03:32FromDiscord<Elegantbeef> Or compress it using supersnappy
20:20:08FromDiscord<eightbit_dboy> sent a code paste, see https://play.nim-lang.org/#pasty=nsClcGgL
20:21:03FromDiscord<Elegantbeef> You're providing too many parameters
20:22:33FromDiscord<eightbit_dboy> Weird, that's how the skeleton this is based off of came.
20:22:46FromDiscord<eightbit_dboy> Here's the OG skeleton. https://media.discordapp.net/attachments/371759389889003532/1238949442175111228/sdl_skeleton.nim?ex=66412515&is=663fd395&hm=70bdb9122edb06b4153d3307c12a5b286f6f692118b9654a5c086a8677645b21&
20:22:49FromDiscord<eightbit_dboy> And it's worked before.
20:22:50FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=PItUjEKI
20:23:17FromDiscord<System64 ~ Flandre Scarlet> (edit) "https://play.nim-lang.org/#pasty=EQzqJRwx" => "https://play.nim-lang.org/#pasty=HwgfRyVH"
20:23:43FromDiscord<eightbit_dboy> Yeah, it's the official sdl2 skeleton program from here: https://github.com/nim-lang/sdl2/blob/master/examples/sdl_skeleton.nim
20:23:52FromDiscord<eightbit_dboy> It also uses 3 arguments.
20:28:20FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Or compress it using": Supersnapply?
20:28:24FromDiscord<Robyn [She/Her]> (edit) "Supersnapply?" => "Supersnappy?"
20:28:34FromDiscord<eightbit_dboy> Oh, the skeleton uses `createRenderer`
20:30:06FromDiscord<Robyn [She/Her]> Snappy is pretty nice, damn
20:33:34*coldfeet quit (Remote host closed the connection)
20:34:36FromDiscord<System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "Supersnappy?": This thing is very very good
20:42:08*SchweinDeBurg quit (Remote host closed the connection)
20:46:17FromDiscord<Robyn [She/Her]> I wonder how good it is for network compression
20:47:40FromDiscord<System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "I wonder how good": It is good!
20:47:52FromDiscord<System64 ~ Flandre Scarlet> Btw↵Is it normal I can't do this? https://media.discordapp.net/attachments/371759389889003532/1238955761573429382/image.png?ex=66412af8&is=663fd978&hm=31fed6360360a686bec3c51503abf1c4bcb597474eb69917c845b330b71f5bad&
20:54:41*ntat quit (Quit: Leaving)
20:56:09FromDiscord<Elegantbeef> Yes cause an openarray is not nullable
20:56:11FromDiscord<Elegantbeef> `table.len == 0`
20:58:47FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "`table.len == 0`": Oh, thanks!
20:59:24FromDiscord<System64 ~ Flandre Scarlet> and is a normal array nullable? What about a seq?
20:59:45FromDiscord<Elegantbeef> Nope
21:00:01FromDiscord<Elegantbeef> Only `ref` `ptr` and `pointer` are nilable
21:00:24FromDiscord<System64 ~ Flandre Scarlet> Oh alright!
21:03:34*SchweinDeBurg joined #nim
21:10:45FromDiscord<demotomohiro> In reply to @michaelb.eth "`object` can also be": Here is a list of type classes: https://nim-lang.org/docs/manual.html#generics-type-classes
21:11:46FromDiscord<Robyn [She/Her]> The supersnappy impl seems like it could be made to work on the JS backend easily just by reusing the same code on the VM
21:12:11FromDiscord<Elegantbeef> Worth noting in Nim 2.0 you can even do `proc{.nimcall.}` for a typeclass of only nimcall procs 😄
21:12:23FromDiscord<Elegantbeef> I'm sure guzba would welcom PRs
21:12:44FromDiscord<Robyn [She/Her]> Hm, might do that then
21:13:44FromDiscord<Robyn [She/Her]> Is there a way to do `when nimvm and defined(js): ... else: ...`
21:13:55FromDiscord<Robyn [She/Her]> Iirc `nimvm` is special so can't use it like that normally
21:14:02FromDiscord<Elegantbeef> Yep
21:14:19FromDiscord<Robyn [She/Her]> (edit) "and" => "or"
21:14:23FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=hksrvFJN
21:14:45FromDiscord<Robyn [She/Her]> Any way to put that into a clean template? Assuming it's a no
21:15:05FromDiscord<Robyn [She/Her]> I really don't get why that was disallowed tbh
21:15:19FromDiscord<Elegantbeef> Cause `nimvm` needs to be compiled as does the `else`
21:15:23FromDiscord<Elegantbeef> Both branches need to exist
21:15:45FromDiscord<Robyn [She/Her]> Which typically when statements don't do?
21:15:54FromDiscord<Robyn [She/Her]> (edit) "when" => "`when`"
21:16:04FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=zJixKSyX
21:16:17FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=LvFsEVZv
21:17:34FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=cBBKUGwm
21:17:47FromDiscord<Elegantbeef> Sure
21:17:52FromDiscord<Robyn [She/Her]> Looks a bit ugly and probably would be disallowed by Guzba though :P
21:18:10FromDiscord<Robyn [She/Her]> Oh well, no reason not to duplicate the code either way
21:18:38FromDiscord<Elegantbeef> > Which typically when statements don't do?↵Of course not
21:19:16FromDiscord<Robyn [She/Her]> Wait why not `when native: ... else: ...` with `native` being `defined(c) or defined(objc) or defined(cpp)`?
21:19:34FromDiscord<Robyn [She/Her]> Would `else` work in the VM and JS backend?
21:19:47FromDiscord<Elegantbeef> No cause `nimvm` is special
21:19:58FromDiscord<Elegantbeef> You need both branches semmed
21:20:02FromDiscord<Robyn [She/Her]> Unfortunate, oh well
21:32:39*krux02_ joined #nim
21:35:35*krux02 quit (Ping timeout: 272 seconds)
21:39:07FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=cKWeFCmD
21:39:18FromDiscord<Elegantbeef> Using defer... shame
21:39:36FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Using defer... shame": What's the problem with defer?
21:39:48FromDiscord<Elegantbeef> It's just fugly destructors
21:40:29FromDiscord<System64 ~ Flandre Scarlet> It's easy for cleanup↵Anyways if I want really good code I have to make a game context
21:40:51FromDiscord<System64 ~ Flandre Scarlet> (edit) "easy" => "good"
21:43:24FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=VDKXwANT
21:43:45FromDiscord<Elegantbeef> Yep template working as expected 😄
21:43:54*Guest60 joined #nim
21:44:02FromDiscord<Robyn [She/Her]> How do I avoid that issue then?
21:44:02FromDiscord<Elegantbeef> also that `do` should be top level
21:44:10FromDiscord<Elegantbeef> not indented
21:44:14FromDiscord<Robyn [She/Her]> It is, just code got formatted weirdly when pasted
21:44:22FromDiscord<Robyn [She/Her]> They're the same level in the actual code
21:44:32FromDiscord<Robyn [She/Her]> (edit) "https://play.nim-lang.org/#pasty=BfFqDsAd" => "https://play.nim-lang.org/#pasty=WrwxJQnQ"
21:44:37FromDiscord<Elegantbeef> You need to make new symbols for the `let`
21:44:39FromDiscord<Robyn [She/Her]> (edit) "https://play.nim-lang.org/#pasty=dcxkenmv" => "https://play.nim-lang.org/#pasty=fUzrYzAZ"
21:44:45FromDiscord<Elegantbeef> you didn't change this to `typed` parameters did you?
21:44:51FromDiscord<Robyn [She/Her]> Nope, it's untyped
21:45:13FromDiscord<Elegantbeef> Yep well both branches get the same code so it sems once then sems again
21:46:04FromDiscord<Robyn [She/Her]> Ah... So then, how would I fix that? I don't want to have to type the code twice so...
21:46:57FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=KIVBTHXN
21:47:05FromDiscord<Elegantbeef> Use a macro that replaces all declarations with a new ident
21:47:08FromDiscord<Elegantbeef> Or instead of a template try using a macro that does \`copyNimTree
21:48:13FromDiscord<Elegantbeef> Is it normal who knows we don't know your data types
21:49:30FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Is it normal who": Layer is just a distinct int32, and GVec2 is a type from Treeform's vmath library
21:50:27FromDiscord<Elegantbeef> and `setPosition` does?
21:51:12FromDiscord<System64 ~ Flandre Scarlet> setPosition uses a layer, and ints
21:51:33FromDiscord<System64 ~ Flandre Scarlet> Wait, what's Natural here?
21:51:46FromDiscord<System64 ~ Flandre Scarlet> any number including floats?
21:52:12FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Use a macro that": Ugh... :|
21:52:24FromDiscord<polylokh_39446> In reply to @sys64 "Wait, what's Natural here?": probably <https://nim-lang.org/docs/system.html#Natural>
21:52:49FromDiscord<System64 ~ Flandre Scarlet> In reply to @polylokh_39446 "probably <https://nim-lang.org/docs/system.html#Nat": Oh, it's an Int
21:53:08FromDiscord<Robyn [She/Her]> I'll just copy and paste
21:53:10FromDiscord<System64 ~ Flandre Scarlet> I wonder if there is "SomeNumber" of something
21:53:25FromDiscord<System64 ~ Flandre Scarlet> Oh yeah it does
21:54:11FromDiscord<Elegantbeef> You probably didn't export the `position=` from an intermediate module
21:54:35FromDiscord<Elegantbeef> Plus you're showing a tooling error and not a compiler error
21:55:12FromDiscord<Robyn [She/Her]> That's still an issue when they share a name? Bruh
21:55:20FromDiscord<Robyn [She/Her]> I'll just edit the variable name for the JS code
21:55:27FromDiscord<Elegantbeef> What?
21:56:09FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "You probably didn't export": Fixed
21:56:47FromDiscord<eightbit_dboy> What am I doing wrong, here? https://media.discordapp.net/attachments/371759389889003532/1238973100197150840/message.txt?ex=66413b1e&is=663fe99e&hm=b647d1bd0bc3bf2fa3cffe0e34ae75b9eb459c202ab69c3cfaf6fe723a9c6194&
21:57:20FromDiscord<System64 ~ Flandre Scarlet> Is using SomeNumber instead of a predefined type slower?
21:58:05FromDiscord<Elegantbeef> No it's a generic typeclass
21:58:13FromDiscord<System64 ~ Flandre Scarlet> Oh alright, nice
22:00:32*Guest60 quit (Quit: Client closed)
22:06:57FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=vjkCytLA
22:07:13FromDiscord<Robyn [She/Her]> I am compiling with `-d:nodejs` if that even does anything
22:07:36FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=znBoBWpY
22:09:30FromDiscord<Robyn [She/Her]> This is with NodeJS 21
22:10:36FromDiscord<Robyn [She/Her]> Anyone able to test this with an older NodeJS version?
22:22:04*fallback quit (Quit: IRCNow and Forever!)
22:49:39*lucasta joined #nim
22:49:41*fallback joined #nim
22:54:39FromDiscord<sirius_3x> Hey can someone tell me where I can find the arm_neon.h file that is used for the SIMD instructions in Nim (this library: https://github.com/guzba/nimsimd/tree/master/src/nimsimd) , lol.
22:59:55FromDiscord<demotomohiro> In reply to @sirius_3x "Hey can someone tell": Isn't it shipped with your C compiler?
23:01:40FromDiscord<sirius_3x> In reply to @demotomohiro "Isn't it shipped with": Oh lmao, thanks, shouldve thought of that haha.
23:07:03FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=JgBLkEsj
23:09:09FromDiscord<Robyn [She/Her]> You then register AST passes, and then once the file that defines the enum is created, it'll allow for errors in the parsing stage to be returned in an enum (so the `SemanticPass` type will be registered as `PSemanticPass` in the `PassesEnum`)
23:22:31FromDiscord<eightbit_dboy> sent a code paste, see https://play.nim-lang.org/#pasty=tHLoFoZu
23:25:51FromDiscord<eightbit_dboy> How do I set up that backend compiler?
23:25:59FromDiscord<System64 ~ Flandre Scarlet> https://github.com/johnnovak/koi↵Is this thing as featureful as Dear ImGUI?
23:26:04FromDiscord<eightbit_dboy> (edit) "compiler?" => "compiler for aarch64? I know I have it installed."
23:27:43*beholders_eye joined #nim
23:30:07FromDiscord<Robyn [She/Her]> In reply to @eightbit_dboy "I'm trying to cross-compile": Have you tried `--gcc.exe:arm-linux-gnueabihf-gcc` instead of `--arm64.linux.gcc.exe`? Probably won't change anything but just try it anyway, perhaps
23:30:22FromDiscord<eightbit_dboy> I'll try it
23:31:48FromDiscord<eightbit_dboy> sent a code paste, see https://play.nim-lang.org/#pasty=Agxnwjmi
23:32:00FromDiscord<eightbit_dboy> My prior post was only up to the first error.
23:33:49FromDiscord<Robyn [She/Her]> `gcc.e`? Also how about trying the same thing I told you before with the linker flag? `--gcc.linkerexe:arm-linux-gnuabihf-ld`
23:34:24FromDiscord<Robyn [She/Her]> The error is certainly odd though...
23:34:36FromDiscord<eightbit_dboy> ah shit, I backspaced too much, sec.
23:34:39FromDiscord<Robyn [She/Her]> It should be unrelated but I don't know
23:35:07FromDiscord<eightbit_dboy> sent a code paste, see https://play.nim-lang.org/#pasty=BvDcvPZW
23:35:27FromDiscord<eightbit_dboy> Hmm... 🤔
23:35:50FromDiscord<eightbit_dboy> In reply to @chronos.vitaqua "`gcc.e`? Also how about": Yeah, I should try the linker one, too
23:36:06FromDiscord<Robyn [She/Her]> It is really odd, maybe make a bug report if you can't figure it out? This isn't my cup of tea unfortunately
23:36:17FromDiscord<Robyn [She/Her]> Though, you could try if Zig's crosscompiler would work for you
23:36:38FromDiscord<eightbit_dboy> sent a code paste, see https://play.nim-lang.org/#pasty=ebejkcdB
23:36:47FromDiscord<Robyn [She/Her]> Oh it did work, sweet!
23:37:04FromDiscord<Robyn [She/Her]> Oh wait
23:37:17FromDiscord<Robyn [She/Her]> Are you sure your GCC and LD installs are 64 bit ARM?
23:37:32FromDiscord<eightbit_dboy> sent a code paste, see https://play.nim-lang.org/#pasty=dNWgOOsx
23:37:38FromDiscord<eightbit_dboy> Looks like it.
23:37:44FromDiscord<Robyn [She/Her]> Hm, yeah it does
23:37:51FromDiscord<Robyn [She/Her]> Odd then, but at least it's working now :)
23:37:52FromDiscord<eightbit_dboy> Time to throw it up onto my RG35XX H
23:38:02FromDiscord<Robyn [She/Her]> Good luck :)
23:38:26FromDiscord<eightbit_dboy> Thanks!