<< 21-05-2024 >>

00:24:19*def- quit (Quit: -)
00:25:06*def- joined #nim
00:28:16*pmp-p quit (Ping timeout: 260 seconds)
00:31:13*def- quit (Quit: -)
00:31:50*def- joined #nim
00:40:02*def- quit (Quit: -)
00:50:15FromDiscord<albassort> alright beef
00:50:34FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=GVSnEVub
00:54:46*pmp-p joined #nim
00:58:18*def- joined #nim
01:03:49FromDiscord<Elegantbeef> Who hurt you
01:07:07FromDiscord<fenilli> sent a code paste, see https://play.nim-lang.org/#pasty=sPxRcGJH
01:08:29FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=MXgaFSyU
01:12:20FromDiscord<kots> In reply to @fenilli "I'm wondering why does": Probably because of seq[object]
01:12:47FromDiscord<polylokh_39446> yeah, that's an awful error message though
01:14:17FromDiscord<fenilli> Any idea on what to do to fix it? is `seq[object]` too ambiguous?
01:14:41FromDiscord<fenilli> oh yeh that is probably the case, changing to int works.
01:15:02FromDiscord<kots> object is not a concrete type
01:15:04*def- quit (Quit: -)
01:15:28*def- joined #nim
01:16:18FromDiscord<fenilli> well that is a bit annoying but I guess it makes sense, as nim needs to know at compile time what type of seq is it right?
01:16:24FromDiscord<kots> Right
01:16:24FromDiscord<polylokh_39446> AIUI the error's from Nim trying to take that as a typeclass and give you implicitly generic code.
01:16:58FromDiscord<polylokh_39446> you'll get the same error from `seq[int or float]`
01:16:59FromDiscord<fenilli> well the error is really bad for someone new even worst but I guess it makes sense after I think bout it.
01:17:01FromDiscord<Elegantbeef> Oh damn someone writing a quad tree
01:17:10FromDiscord<Elegantbeef> I wrote a Data oriented one just a few weeks ago
01:17:25FromDiscord<fenilli> well first one I'm making for a simple game of asteroids for colission
01:18:20FromDiscord<Elegantbeef> Yea mine was the first I've written
01:18:30FromDiscord<Elegantbeef> Nice general purpose with no references 😄
01:19:18FromDiscord<fenilli> I'm just a bit in the thinking side now, probably have to make a Entity type to keep track of it now.
01:19:30FromDiscord<fenilli> so `seq[Entity]` would work.
01:19:39FromDiscord<Elegantbeef> https://github.com/beef331/keyboardwarrior/blob/master/data/quadtrees.nim for my version if interested
01:19:44FromDiscord<polylokh_39446> you can make it explicitly generic if that's what it is, or if you want to defer that question until later
01:19:51FromDiscord<Elegantbeef> I force all entries to store a `node`
01:20:33FromDiscord<fenilli> yours seen well more complete from what I'm thinking of doing for this simple game lol but i will take a look learn something from it.
01:20:44FromDiscord<fenilli> In reply to @polylokh_39446 "you can make it": meaning? passing something like <T>?
01:21:30FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=NEWMGKsr
01:21:31*def- quit (Quit: -)
01:21:41FromDiscord<Elegantbeef> Hey I just avoid references like the plague
01:21:55FromDiscord<Elegantbeef> Dear reader I do not think I've even gotten covid once
01:22:18FromDiscord<fenilli> makes sense, just using ref there because it might be better for passing and modifies data from it.
01:22:27FromDiscord<fenilli> oh I see
01:23:13FromDiscord<fenilli> ok don't forget `ne, nw, se, sw: QuadTree[T]` at least the error without it this time is good.
01:23:14FromDiscord<Elegantbeef> Yea using references is less tedious since you do not need to pass the root tree around everywhere
01:23:42FromDiscord<Elegantbeef> I would suggest stealing my usage of `children: array[QuadPos, QuadTree[T]]`
01:24:02FromDiscord<Elegantbeef> This gives you a super power that you can iterate the children without having to manually do 4 branches
01:24:20FromDiscord<fenilli> I guess my problem is thinking of seq as array in JS
01:24:31FromDiscord<fenilli> now I stopped and could see my problem
01:24:38FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=CNywVYIb
01:24:41FromDiscord<fenilli> they can't be of multiple types at the same time.
01:24:42FromDiscord<Elegantbeef> Look at that code 😄
01:25:17FromDiscord<Elegantbeef> Yea you need some form of runtime type information and a pointer for arbitrary typed collections
01:26:05FromDiscord<fenilli> makes total sense, so a generic wouldn't work either for me, still need to create a single Entity type.
01:26:26FromDiscord<Elegantbeef> Yep you need the ugly `type Entity = ref object of RootObj` or an object variant
01:26:42FromDiscord<fenilli> didn't want to use inheritance still thinking a way to avoid it.
01:26:42FromDiscord<Elegantbeef> The latter is more preferable for performance nerds like myself
01:29:50FromDiscord<fenilli> object variant wouldn't work as entities will be separate from the same file, so can't really do a cyclic import there.
01:30:10FromDiscord<fenilli> so not like you can make Entity know about what will implement it.
01:30:16FromDiscord<fenilli> (edit) "what" => "who"
01:30:23FromDiscord<Elegantbeef> You can if you use pointer procs 😄
01:30:35FromDiscord<fenilli> yeh no ptr lol
01:30:40FromDiscord<fenilli> I will probably do a simpler solution
01:31:00FromDiscord<Elegantbeef> I mean pointer procs are not really unsafe
01:31:06FromDiscord<fenilli> by making EntityManager or something like and just add entities there with a tuple of similar functionality
01:31:26FromDiscord<fenilli> I already do this for scenes, so not that different.
01:32:08FromDiscord<Elegantbeef> This sounds like interfaces 😄
01:32:19FromDiscord<fenilli> kinda of lol
01:32:35FromDiscord<Elegantbeef> Shameless spam of traitor here
01:33:44FromDiscord<fenilli> well not like we could do something like `entities: seq[object with id]` or something like that.
01:35:09FromDiscord<Elegantbeef> You can but only statically
01:35:15FromDiscord<Elegantbeef> But with traitor you can 🙂
01:35:24FromDiscord<Elegantbeef> though it'd be `object with setId and getId`
01:37:43FromDiscord<fenilli> sent a code paste, see https://play.nim-lang.org/#pasty=LyfXfqJo
01:38:23FromDiscord<fenilli> as if I had a Entity type with id and a tuple of similar functionality it wouldn't be possible to make an Entity with different vars on it.
01:38:40FromDiscord<Elegantbeef> Your choice is to use object variants, inheritance, or interfaces
01:40:08*pmp-p quit (Ping timeout: 260 seconds)
01:41:10*def- joined #nim
01:43:53FromDiscord<fenilli> sent a code paste, see https://play.nim-lang.org/#pasty=GhlgaNEN
01:44:13FromDiscord<Elegantbeef> That's not the write syntax
01:44:23FromDiscord<Elegantbeef> it'd be `of Bullet: bullet: BullentEntity`
01:45:02FromDiscord<Elegantbeef> The issue will crop up when you want bullet to interact with `Entity`
01:45:08FromDiscord<Elegantbeef> You can use delayed imports to get around this
01:45:12FromDiscord<fenilli> so it doesn't spread the parameters, but set a var with the creation?
01:45:33FromDiscord<Elegantbeef> Nim's object variants is not like Rust's (poorly named) Enums
01:45:51FromDiscord<Elegantbeef> Each branch of a Nim object has fields directly and does not require conversion between
01:46:32FromDiscord<fenilli> I see what does delayed import look like, didn't see in the docs.
01:46:35FromDiscord<Elegantbeef> You just do `Entity(kind: Bullet, bullet: BulletEntity(position: vec2(x, y))).bullet.position.x`
01:46:56FromDiscord<Elegantbeef> https://github.com/beef331/nimtrest/wiki/Code-snippets#delayed-imports
01:47:11FromDiscord<Elegantbeef> You do not need `import` at the top of a file
01:47:19FromDiscord<fenilli> ohh
01:47:22FromDiscord<Elegantbeef> It can be anywhere and can be used to elevate order issues
01:47:24FromDiscord<fenilli> well that looks ugly tho.
01:47:35FromDiscord<Elegantbeef> Meh I disagree
01:48:03*def- quit (Quit: -)
01:48:39FromDiscord<fenilli> it does look useful to circunvent cyclic import tho it makes a file unsure what it imports and uses unless looking at the full code.
01:48:40FromDiscord<Elegantbeef> The single pass nature of Nim is very good for code readability since symbols are introduced inside `import` and code can be read top to bottom without "Where is this proc I've not seen it yet"
01:48:49FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=ujJMBbJn
01:49:21*def- joined #nim
01:49:27FromDiscord<fenilli> does that assume all types are in a single file?
01:49:39FromDiscord<Elegantbeef> Yes
01:49:40*pmp-p joined #nim
01:49:54FromDiscord<Elegantbeef> You either do single file or delayed imports
01:50:02FromDiscord<polylokh_39446> the Entry types can be somewhere else, but they need to exist at the point of the Entity definition
01:50:17FromDiscord<polylokh_39446> (edit) "Entry" => "Entity"
01:50:50FromDiscord<Elegantbeef> Though that assumes there are no implementations of procedures that interact
01:51:16FromDiscord<fenilli> well tbf they shouldn't have it, that would be the job an ecs and all ( not that I have one at the moment )
01:51:33FromDiscord<fenilli> but they have at the moment haha
01:52:40FromDiscord<fenilli> the advantage of an ecs here ( not gonna implement one ) would be that I could just pass an int to entities and get it at runtime after anyways.
01:53:24FromDiscord<fenilli> well I guess I could do a really fun thing and have a `entity_types.nim` file with the forward declaration of all types and any procs in its respective files
01:53:30FromDiscord<fenilli> that should work for all the problems in this case.
01:53:38FromDiscord<Elegantbeef> Just go use polymorph or necsus 😛
01:54:09FromDiscord<fenilli> maybe later, my next objective for the next game is doing a simple ECS from scratch
01:54:10FromDiscord<Elegantbeef> We've reached the `types.nim` portion of this project
01:54:32FromDiscord<fenilli> this one is doing the quadtree lol
01:54:57FromDiscord<fenilli> instead of the amazing ultra good algorithim called double for
01:55:15FromDiscord<Elegantbeef> Hey double for is awful performance but simple code 😄
01:55:32FromDiscord<Elegantbeef> I do also have a semi simple ECS that only uses 1 macro
01:55:39FromDiscord<fenilli> exactly ahha I was going to do that it would work, the game I'm making won't have more than 100 entities on screen at a time anyways.
01:56:13FromDiscord<fenilli> literally capped at 64+30+1 so 95 lol
01:56:32FromDiscord<Elegantbeef> Going to make a quad tree for 100 entities
01:56:38FromDiscord<Elegantbeef> Goin to make an ecs for 100 entities
01:56:39FromDiscord<fenilli> yep lol
01:56:57FromDiscord<Elegantbeef> Being scared of a single file for entities when you have 100 entities!
01:57:00FromDiscord<Elegantbeef> Developers are fickle
01:57:00FromDiscord<fenilli> that is called overengineering
01:57:20FromDiscord<fenilli> not scared
01:57:29FromDiscord<fenilli> i'm doing mostly for " what if I was making a game for real "
01:57:34FromDiscord<fenilli> learning process.
01:57:45FromDiscord<fenilli> I could literall make asteroids in a single file.
01:57:50FromDiscord<fenilli> (edit) "literall" => "literally"
01:57:55FromDiscord<polylokh_39446> lotta raylib examples that do that
01:57:59FromDiscord<fenilli> yeh
01:58:19FromDiscord<fenilli> its not a hard game and you can basically just go horse it all the way
01:58:35*def- quit (Quit: -)
01:58:37FromDiscord<fenilli> just want to use it as a learning experience in a smaller simpler game
01:58:58*def- joined #nim
01:59:02FromDiscord<fenilli> have in mind " new to nim, and new to game development "
01:59:09FromDiscord<fenilli> never used nim, and neither made a game in my life.
01:59:36FromDiscord<fenilli> made the first one two days ago a pong clone in nim, it uses a single file.
02:01:19FromDiscord<polylokh_39446> another way to give yourself a learning experience, is to implement the game as directly as possible - like in those raylib examples - and then start adding significant features, and see where it hurts / how painful it gets.
02:01:47*pmp-p quit (Ping timeout: 264 seconds)
02:02:42FromDiscord<planetis_m> Hey am I not understanding lvalues or is this a bug? https://play.nim-lang.org/#pasty=sZvMahPF
02:02:56FromDiscord<polylokh_39446> persistent bullets that damage you as well↵a large bounded map that you can navigate instead of the wrapping edges↵additional enemies that chase you and phase through obstacles↵a mouse-following cannon instead of shooting bullets where you're facing
02:03:05FromDiscord<Elegantbeef> You do not understand lvalues
02:03:14FromDiscord<Elegantbeef> L values are mutable in Nim best represented by `var T`
02:04:56FromDiscord<fenilli> for sure I could go like that, and it is kinda like that already, I had a working one, refactored to use scenes and a better file structure, now adding collision via quadtrees.
02:05:27FromDiscord<fenilli> but I guess your idea is more in line with adding features and not ideas.
02:05:32FromDiscord<polylokh_39446> where is that `{lvalue}` syntax documented?
02:05:40FromDiscord<fenilli> so If a feature needs something, add something, if not just don't.
02:05:51FromDiscord<planetis_m> In reply to @Elegantbeef "L values are mutable": oh f, how am I going to restrict to passing already declared variables and not hidden temporaries?
02:05:56FromDiscord<michaelb.eth> In reply to @polylokh_39446 "where is that `{lvalue}`": was wondering the same
02:06:05FromDiscord<planetis_m> In reply to @polylokh_39446 "where is that `{lvalue}`": https://nim-lang.github.io/Nim/manual_experimental.html#term-rewriting-macros-parameter-constraints
02:06:26FromDiscord<fenilli> oh are you THE planetis_m? i'm using your bindings, thank you for it.
02:07:11FromDiscord<planetis_m> In reply to @fenilli "oh are you THE": you're welcome I am glad you're able to make your project with them
02:08:57FromDiscord<Elegantbeef> `val: (var T){sym}`?
02:09:36FromDiscord<planetis_m> Yeah I went with sym
02:10:03FromDiscord<planetis_m> without the (var T) part
02:10:51*pmp-p joined #nim
02:11:37FromDiscord<Elegantbeef> Mismatch errors there are not that helpful so I'd be weary about it
02:14:24FromDiscord<planetis_m> sent a code paste, see https://play.nim-lang.org/#pasty=zsSrdMbX
02:17:29FromDiscord<Elegantbeef> Doesn't disabling `=copy` and `=dup` solve this?
02:18:40FromDiscord<planetis_m> They're already disabled for texture
02:19:50FromDiscord<Elegantbeef> So what does this solve?
02:21:10FromDiscord<planetis_m> sent a code paste, see https://play.nim-lang.org/#pasty=McRPWxaS
02:22:01FromDiscord<planetis_m> And also allow texture sharing
02:22:48FromDiscord<planetis_m> And no there're no reference counts, and the alternative would be to have a WeakTexture type that has =destory = discard
02:23:42FromDiscord<Elegantbeef> Can you not throw a `=wasMoved` in there?
02:25:27FromDiscord<planetis_m> In reply to @Elegantbeef "Can you not throw": I am not familiar with =wasMoved please elaborate
02:25:39FromDiscord<Elegantbeef> was moved resets the data to 0
02:25:58FromDiscord<Elegantbeef> So in the above if you do `wasMoved(x.texture); x.texture = val` the old texture is not destroyed
02:26:21FromDiscord<planetis_m> I thought so, pbl I am going to try
02:27:41FromDiscord<planetis_m> No it doesn't work because =copy is not available
02:28:18FromDiscord<Elegantbeef> So copymem 😄
02:30:01FromDiscord<planetis_m> Sure I think I used to, but copymem seems more unsafe, I let the compiler figure it out
02:31:07FromDiscord<Elegantbeef> Time to introduce a weaktexture then
02:38:00FromDiscord<planetis_m> I don't think WeakTexture would save us, it get's more complicated than that. The Model's destructor doesn't touch the resources assigned to the Material, but the Material has a UnloadMaterial that frees them. https://github.com/raysan5/raylib/blob/9d67f4734b59244b5b10d45ce7c8eed76323c3b5/examples/shaders/shaders_basic_pbr.c#L137-L151 freed at L267 Good luck mapping that to destructors
03:38:34FromDiscord<sOkam! 🫐> @ElegantBeef is there a way to do inverted cases for object variants?↵something like `case kind of not MyKind: somefield: T`
03:41:00*SchweinDeBurg joined #nim
03:41:40FromDiscord<Elegantbeef> `else`
03:42:48FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=wyOAoFRj
03:44:04FromDiscord<sOkam! 🫐> i meant in order to exclude a field from the other kinds
03:44:52FromDiscord<Elegantbeef> Nope
03:45:09FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=CnJChFbF
03:45:18FromDiscord<sOkam! 🫐> kk ty ✍️
03:55:28*def- quit (Quit: -)
04:30:03*def- joined #nim
04:42:59*def- quit (Quit: -)
05:02:12*def- joined #nim
05:08:37*coldfeet joined #nim
05:19:45*coldfeet quit (Remote host closed the connection)
06:40:52*rockcavera quit (Remote host closed the connection)
06:48:18*def- quit (Quit: -)
06:48:46*def- joined #nim
07:05:10*khazakar_ joined #nim
07:06:16*khazakar_ quit (Client Quit)
07:06:34*khazakar_ joined #nim
07:06:43*khazakar_ quit (Client Quit)
07:09:37*def- quit (Quit: -)
07:10:53*def- joined #nim
07:58:12*fallback quit (Read error: Connection reset by peer)
08:03:32*fallback joined #nim
08:04:56FromDiscord<that_dude.> sent a code paste, see https://play.nim-lang.org/#pasty=wkmLOttg
08:05:07FromDiscord<that_dude.> I'm still using malebolgia for my multithreading btw
08:12:06FromDiscord<that_dude.> sent a code paste, see https://play.nim-lang.org/#pasty=GNLntQjk
08:15:06FromDiscord<that_dude.> Wrapping the part in a `{.cast(gcsafe).}` doesn't change anything
08:20:47*khazakar joined #nim
08:29:11FromDiscord<that_dude.> Is there something wrong with trying to spawn a thread to a proc in an object?
08:41:24*PMunch joined #nim
08:54:42*def- quit (Quit: -)
08:55:06*def- joined #nim
09:51:16*def- quit (Quit: -)
09:51:29*def- joined #nim
10:01:26*def- quit (Quit: -)
10:10:55Amun-Rahttps://github.com/nim-lang/Nim/blob/devel/lib/std/tasks.nim#L113-L126
10:12:03Amun-Rawrap the body of the function with the cast
10:17:23Amun-Rathat line is for some reason
10:20:19*def- joined #nim
11:12:33*krux02 joined #nim
11:28:14*def- quit (Quit: -)
11:45:52*def- joined #nim
13:00:26*PMunch quit (Quit: Leaving)
13:12:39*Guest18 joined #nim
14:08:08*def- quit (Quit: -)
14:11:44*def- joined #nim
14:22:16*Guest18 quit (Quit: Client closed)
14:22:23*def- quit (Quit: -)
14:22:47*def- joined #nim
14:52:04*ntat joined #nim
15:46:44*def- quit (Quit: -)
15:47:06*def- joined #nim
16:54:41*rockcavera joined #nim
17:00:21*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
17:29:07*beholders_eye joined #nim
17:39:53FromDiscord<maxtachine> sent a code paste, see https://play.nim-lang.org/#pasty=PeKihelc
17:40:45FromDiscord<polylokh_39446> ptr cstring is wrong, it should be cstring for that one as well
17:40:52FromDiscord<maxtachine> oh ok
17:41:52FromDiscord<polylokh_39446> or, if that's the authority, then char is wrong, it should be `char decrypted`
17:42:19FromDiscord<maxtachine> decrypted is the output
17:42:24FromDiscord<maxtachine> (edit) "decrypted is the output ... " added "pointer"
17:42:30FromDiscord<polylokh_39446> it's the type that's the issue
17:43:27FromDiscord<polylokh_39446> a cstring is a pointer to NUL-terminated byte(s). a ptr cstring is a pointer to a pointer to NUL-terminated byte(s).↵char is a pointer to a byte. char is a pointer to a pointer to byte
17:43:56FromDiscord<maxtachine> ah
17:44:53Amun-Rause cstring whether it's const char * or char *
17:51:30FromDiscord<supernova7107> is nim dead?
17:51:42FromDiscord<supernova7107> i cant see torch library matained anymore in nim
17:51:46FromDiscord<supernova7107> what it use then?
17:52:21FromDiscord<Phil> Not really, I have no clue of the torch library so I'm out there.
17:52:52FromDiscord<supernova7107> in ai everything is depend on torch
17:52:59FromDiscord<supernova7107> if u cant have that u are just dead language
17:53:14ehmryyes, but nothing depends on ai
17:53:19FromDiscord<vindaar> Flambeau is maintained https://github.com/SciNim/flambeau/. It's not complete though and users will probably need to help out a bit...
17:53:23FromDiscord<Phil> You may be amazed, but I do not care for ai
17:53:29Amun-Raright
17:54:04FromDiscord<supernova7107> (edit) "dead language" => "then no hope i mean"
17:54:13FromDiscord<supernova7107> In reply to @vindaar "Flambeau is maintained https://github.com/SciNim/fl": will check thnx
18:16:11*beholders_eye quit (Ping timeout: 264 seconds)
18:38:22FromDiscord<Phil> Is there some kind of obvious gotcha with deepcopy that makes it leak?
18:39:54FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=tvdCmLUv
18:40:33FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=gGlnmIKK
18:41:06FromDiscord<Phil> the deepcopy happens on Thread A for a message I'm about to send to thread B
18:41:26FromDiscord<Phil> (edit) "the deepcopy happens on Thread A for a message I'm about to send to thread B ... " added "via threading channel"
18:42:03FromDiscord<Phil> If I just move those messages, I don't have memory leaks, but I do get data races, this is such a mindfuck
18:52:03FromDiscord<polylokh_39446> does `value` get destroyed by send after it's copied?
18:52:50FromDiscord<Phil> Yes
18:53:19FromDiscord<Phil> At least I get use-after-frees if I call `=destroy` on it again
18:53:49FromDiscord<Phil> Still in the business of trying to recreate my problem, I swear doing that is the hardest part of multithreading
18:53:53FromDiscord<Phil> I hate it so much
18:55:11FromDiscord<vindaar> which is why I use multiprocessing unless I absolutely need threads 🤭
18:59:43FromDiscord<Robyn [She/Her]> In reply to @vindaar "which is why I": What's the difference between them? Multiprocessing is spawning an entirely new process, miltithreading is just threads?
19:00:23FromDiscord<Phil> Doesn't really help.
19:01:09FromDiscord<Phil> Socket communication most likely, which even more likely means deep copies, also stricter separation
19:01:48FromDiscord<vindaar> yeah, multiprocessing spawns new processes. Can be done either by hand of course, or just using `fork()`. Has some disadvantages (sharing data directly between threads to mutate for example doesn't work of course) and you duplicate the memory space of the parent process. But for a large number of parallel problems (in particular when they're rather dumb), multiprocessing is great. You don't need to worry about GC safety errors or race con
19:03:02FromDiscord<vindaar> `cligen` has `procpool` which is a low level version of python's multiprocessing module if you will\: https://github.com/c-blake/cligen/blob/master/cligen/procpool.nim
19:04:11FromDiscord<vindaar> but if it sounds interesting, I just finished (literally pushed \~1 hour ago) some syntax sugar around it for the common use case https://github.com/Vindaar/forked 😅
19:04:50FromDiscord<griffith1deadly> In reply to @isofruit "Socket communication most likely,": is pipes better for multiprocessing than sockets?
19:05:11FromDiscord<Phil> You're asking the person that chose multithreading instead of multiprocessing what is better for multiprocessing
19:05:37FromDiscord<Phil> I have a vague idea at best
19:06:12FromDiscord<Phil> I'm too busy getting pissed at these absolute garbage stacktraces from asan that are about as helpful as stepping on a Lego
19:07:25FromDiscord<Robyn [She/Her]> In reply to @vindaar "yeah, multiprocessing spawns new": Fair, sounds neat for sure
19:08:14FromDiscord<leorize> FFI traces?↵(@Phil)
19:08:31FromDiscord<Phil> In reply to @leorize "FFI traces? (<@180601887916163073>)": No, they just tell me somehow deepcopy manages to leak and I'm struggling to write a minimal example
19:08:41FromDiscord<Phil> Though I think I had a breakthrough around 30s ago with that
19:08:56FromDiscord<leorize> if you have a trace and a sample I could figure something out
19:10:53FromDiscord<Phil> sent a long message, see https://pasty.ee/tfRvKuqm
19:11:12FromDiscord<Phil> https://media.discordapp.net/attachments/371759389889003532/1242555312016199811/message.txt?ex=664e434f&is=664cf1cf&hm=f262a7125538e9abfd66103df29beb388e091de67ee57c8d904d5c3dee58c266&
19:11:17FromDiscord<ieltan> lol
19:11:38FromDiscord<Phil> (edit) "https://pasty.ee/RrFGREQL" => "https://pasty.ee/almWLruX"
19:12:17FromDiscord<Phil> And yes that is so far the smallest example I managed, anything else just refused to replicate the behavior
19:12:17FromDiscord<demotomohiro> I think mutipleprocessing is good when cost of sharing or exchanging data is small. And it can easily scale to mutiple computers if you use sockets for communication.
19:13:13FromDiscord<Phil> I'm feeling tempted to jump to multiprocessing with my actor idea, solely because I already want to deepcopy the messages which increases transport-cost, though maybe not as much as using sockets etc.
19:13:19FromDiscord<griffith1deadly> In reply to @demotomohiro "I think mutipleprocessing is": but isnt scaling on local machine with pipes better?
19:13:54FromDiscord<leorize> you don't even have to use pipes with multiprocessing
19:14:03FromDiscord<leorize> a degree of shared memory can be used via shm
19:14:08FromDiscord<griffith1deadly> (edit) "better?" => "better than sockets?"
19:14:51FromDiscord<Robyn [She/Her]> In reply to @isofruit "Okay, I think I": I need to be installed? o.o
19:15:08FromDiscord<demotomohiro> In reply to @griffith1deadly "but isnt scaling on": I don't know if pipes better than sockets.
19:15:19FromDiscord<Robyn [She/Her]> In reply to @leorize "a degree of shared": What's shm?
19:15:34FromDiscord<Phil> I'll try to simplify that clusterfuck of an example tomorrow, I think I'm slightly to annoyed today to do so.↵If you can already work with that leorize, I'd be glad, if not then I can understand, it's 90 loc just for a "minimal example"
19:16:04FromDiscord<Phil> (edit) "I'll try to simplify that clusterfuck of an example tomorrow, I think I'm slightly to annoyed today to do so.↵If you can already work with that leorize, I'd be glad, if not then I can understand, it's 90 loc just for a "minimal example" ... " added "afterall"
19:16:29FromDiscord<leorize> shared memory↵(@Robyn [She/Her])
19:16:37FromDiscord<Phil> I swear async and multithreading is so. much. pain
19:16:43FromDiscord<leorize> this is where mmap comes in
19:16:51FromDiscord<Robyn [She/Her]> In reply to @leorize "shared memory (<@524288464422830095>)": Aah okay
19:16:52FromDiscord<Phil> Or just multithreading with "server-like" qualities
19:17:48FromDiscord<leorize> did tsan yell at you for that sample?
19:18:12FromDiscord<Phil> It shouldn't, nothing is shared here, it's deepcopy all the way
19:18:24FromDiscord<Phil> But I didn't even get to tsan yet, I tend to go for asan first since its the lower-hanging fruit
19:18:25FromDiscord<Phil> Supposedly
19:18:47FromDiscord<leorize> my hunch is that deepCopy + unsafeIsolate created an unowned copy
19:19:05FromDiscord<Phil> If that is the case I will hurt somebody
19:19:06FromDiscord<Phil> physically or emotionally
19:19:09FromDiscord<leorize> basically deepCopy object is copied again while the original was not destroyed
19:19:10FromDiscord<leorize> stuff like that
19:20:07FromDiscord<Phil> Like seriously, how would anyone ever even comprehend this level of fucked?
19:20:22FromDiscord<Phil> You're honestly a lifeline for me here when it comes to these kinds of issues
19:21:11FromDiscord<leorize> you're trying MT in nim
19:21:18FromDiscord<leorize> you gotta expect the growing pains
19:21:35FromDiscord<leorize> or rather the fact that you're the only one currently trying to propel this stuff forward
19:22:39FromDiscord<Phil> I dunno if it's a blessing or a curse that when it comes to computation problems that I invested in that I'm about as stubborn as I am easily frustrated at bs
19:25:35FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=NqvNGvnq
19:25:49*coldfeet joined #nim
19:27:15FromDiscord<leorize> have you tried atomicArc?
19:27:56FromDiscord<Phil> No because I don't want to force my users to use it and theoretically it shouldn't be necessary
19:29:04FromDiscord<Phil> Apparently atomicArc doesn't work with chronos either
19:29:17FromDiscord<leorize> what does that mean?
19:29:51FromDiscord<leorize> is that leak you sent the only one?
19:29:53*ntat quit (Quit: Leaving)
19:32:48FromDiscord<Phil> In reply to @leorize "is that leak you": Not quite, it's 2 leaks, I just sent only one because I thought you ran the example to see the full traces 😄 https://media.discordapp.net/attachments/371759389889003532/1242560743900184637/message.txt?ex=664e485f&is=664cf6df&hm=b3ad97a8f6e10567e87c18c2dbac7562959a582c68f7c0de123bdce655d09970&
19:33:03FromDiscord<leorize> it's gonna take a bit to install nim again
19:47:46*daniel413006 joined #nim
19:55:38*def- quit (Quit: -)
19:56:22*def- joined #nim
19:56:53*daniel413006 quit (Quit: Client closed)
20:01:12NimEventerNew thread by mantielero: Ffmpeg6.nim bindings for FFmpeg v6.x, see https://forum.nim-lang.org/t/11627
20:01:31*jmdaemon joined #nim
20:02:12FromDiscord<leorize> @Phil\: good news\: your problem is very simple
20:02:28FromDiscord<Phil> insert squinting emoji
20:02:38FromDiscord<leorize> your object never left the mailbox
20:02:55FromDiscord<Phil> ... what?
20:03:07FromDiscord<leorize> your mailbox has a capacity phil
20:03:14FromDiscord<leorize> store was non blocking
20:03:33FromDiscord<leorize> so the server shutdown before it ever got anything out
20:04:58FromDiscord<Phil> ... that's bad for me, that means my actual issue is still not represented by that example
20:05:03FromDiscord<Phil> Fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuck
20:05:11FromDiscord<leorize> (cue go's "your channel capacity should either be 1 or 0, anything else is a bug")
20:05:37FromDiscord<leorize> and "if you use 1, you better have a good reason"
20:12:42FromDiscord<leorize> I mean, do you have the same pattern in your actual problematic program?
20:13:29FromDiscord<Phil> I do no.... wait a second, let me see what happens when I increase sleep appropriately
20:14:54FromDiscord<leorize> for this sample at least, you can just empty the mailbox on shutdown to fix it
20:16:22FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=oXZTZcyD
20:17:30FromDiscord<Phil> (edit) "https://play.nim-lang.org/#pasty=nXStyWlm" => "https://play.nim-lang.org/#pasty=MChLeJbR"
20:18:08FromDiscord<Phil> And I already empty all the mailboxes I have before shutdown, that's what I have a `gracefulShutdown` proc for
20:18:59FromDiscord<griffith1deadly> sent a code paste, see https://play.nim-lang.org/#pasty=zdulZrIh
20:20:01FromDiscord<Phil> For some of the things I do I need a mutable server instance, but I don't want to send a mutable instance of ServerActor from Thread A to B
20:20:34FromDiscord<griffith1deadly> sent a code paste, see https://play.nim-lang.org/#pasty=aXeYWHSG
20:21:08FromDiscord<Phil> I'm not aware of it. Ah, it was the atomics. Server stores an atomic determining whether it should be running or not
20:21:22FromDiscord<Phil> And i need to regularly load it as well as manipulate it to false when I want to shut it down
20:25:43FromDiscord<leorize> still doesn't explain `var server = server` \:p
20:25:57FromDiscord<leorize> isn't your server a ref?
20:31:06FromDiscord<Phil> Just played around, turns out I can indeed remove that when I adjust a proc.↵Odd, doesn't fix the leak but at least less code
20:32:25FromDiscord<leorize> let me know if you minimized a new sample
20:42:58*Lord_Nightmare quit (Ping timeout: 246 seconds)
21:08:58*coldfeet quit (Remote host closed the connection)
21:11:00*jmdaemon quit (Ping timeout: 260 seconds)
21:24:48*jmdaemon joined #nim
22:43:36*Lord_Nightmare joined #nim
22:52:40*jmdaemon quit (Ping timeout: 268 seconds)
22:56:42*beholders_eye joined #nim
23:15:10*termer_ is now known as termer