00:21:17 | * | alexdaguy joined #nim |
00:25:05 | * | Goodbye_Vincent1 quit (Remote host closed the connection) |
00:25:57 | * | Goodbye_Vincent1 joined #nim |
01:41:15 | * | tiorock joined #nim |
01:41:15 | * | rockcavera quit (Killed (tantalum.libera.chat (Nickname regained by services))) |
01:41:15 | * | tiorock is now known as rockcavera |
01:43:22 | * | tiorock joined #nim |
01:43:22 | * | tiorock quit (Changing host) |
01:43:22 | * | tiorock joined #nim |
01:43:22 | * | rockcavera is now known as Guest7768 |
01:43:22 | * | tiorock is now known as rockcavera |
01:46:02 | * | Guest7768 quit (Ping timeout: 252 seconds) |
01:47:23 | FromDiscord | <heysokam> Is there any existing Nim type that represents the same concept as Rust/Zig slices and cpp std::span? 🤔↵I noticed that Go's slices are the same as Nim's seq, but that made me realize that I haven't seen the slice version in Nim so far↵Is there an existing type that behaves like them? |
01:50:40 | FromDiscord | <leorize> technically it's `openArray` |
01:50:47 | FromDiscord | <leorize> but borrowing is unstable and buggy |
01:51:10 | FromDiscord | <leorize> and Go's slices are not the same as Nim's seq |
01:51:40 | FromDiscord | <leorize> Go's slice have a ton of gotchas that you need to be aware of when you use it |
01:54:26 | FromDiscord | <heysokam> I thought `openArray` is not really a type, but more like a generic hint. Maybe I misunderstood that? |
01:55:02 | FromDiscord | <Elegantbeef> It's a type |
01:55:17 | FromDiscord | <Elegantbeef> It's `ptr, len` but safe |
01:55:36 | FromDiscord | <heysokam> ah so then it is a slice. kk, had no idea |
01:56:19 | FromDiscord | <heysokam> so `seq` implicitly "casts" to openArray when passed into an openArray argument, right? |
01:56:28 | FromDiscord | <Elegantbeef> Same with array, yes |
01:56:44 | FromDiscord | <Elegantbeef> It's an implicit conversion which can cause many headaches if you're writing generic code 😄 |
01:56:55 | FromDiscord | <heysokam> ic |
01:57:20 | FromDiscord | <Elegantbeef> Mainly that `openarray[T] or T` does not work |
01:57:40 | FromDiscord | <Elegantbeef> since it's a generic it does not do an implicit conversion(which is how all conversions in Nim work) |
01:58:45 | FromDiscord | <heysokam> noted |
01:58:51 | FromDiscord | <heysokam> ty |
01:59:15 | FromDiscord | <Elegantbeef> I choose to believe you have a big ol' "Nim Notes I Noted Notedly" |
02:08:04 | FromDiscord | <heysokam> most definitely 🙂 |
03:58:06 | * | beholders_eye quit (Ping timeout: 244 seconds) |
04:00:00 | * | rockcavera quit (Remote host closed the connection) |
04:30:37 | FromDiscord | <luckyskullsexyniner> hello! I'm new to Nim, just started reading 'Mastering Nim' this weekend. I'm curious about learning more about Nim, especially in security & red-teaming(which im also still very new). |
04:54:26 | * | alexdaguy quit (Quit: a) |
06:13:14 | * | ntat joined #nim |
07:26:16 | * | tokyovigilante_ joined #nim |
07:26:49 | * | tokyovigilante quit (Ping timeout: 260 seconds) |
07:26:50 | * | tokyovigilante_ is now known as tokyovigilante |
07:34:50 | * | MauGal joined #nim |
07:39:29 | * | MauGal quit (Ping timeout: 248 seconds) |
07:39:46 | * | MauGal joined #nim |
08:32:52 | FromDiscord | <nocturn9x> a question for elegantbeef |
08:33:00 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=natmLDOh |
08:33:16 | FromDiscord | <nocturn9x> currently I have modified my constructor like this, whereas before it was simply `result.positions = positions` |
08:33:33 | FromDiscord | <nocturn9x> is there a way I can make `Position` a `sink T` so that I don't need to explicitly clone anything? |
08:40:43 | FromDiscord | <nocturn9x> also, I'm trying to migrate my move generation to use move semantics. Currently I pass around a bunch of `var Position`, but I'm thinking `sink Position` would be best. What I'm not sure about is whether the caller gets ownership of it back at the end of the call, from the docs it seems like the original location is destroyed by wasMoved(p) |
09:15:58 | * | jkl__ joined #nim |
09:15:59 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "also, I'm trying to": why not do `sink seq[Position]`? |
09:16:11 | * | jkl quit (Read error: Connection reset by peer) |
09:16:56 | FromDiscord | <Robyn [She/Her]> I think ownership is not given back, but you could do `proc(_: sink T): T` |
09:20:13 | FromDiscord | <nocturn9x> that's a big problem |
09:20:19 | FromDiscord | <nocturn9x> I need the ownership to come back :') |
09:20:40 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=aSvKXPjb |
09:20:52 | FromDiscord | <nocturn9x> changing `var Position` to `sink Position` makes compilation fail |
09:21:22 | FromDiscord | <nocturn9x> `/home/nocturn9x/heimdall/src/heimdall/position.nim(586, 25) Error: '=dup' is not available for type <Position>, which is inferred from unavailable '=copy'; requires a copy because it's not the last read of 'result'; another read is done here: position.nim(669, 11); routine: loadFEN` |
09:21:39 | FromDiscord | <nocturn9x> (copy is unavailable cuz I explicitly borked it so that every copy has to be explicit via clone()) |
09:23:32 | FromDiscord | <nocturn9x> In reply to @battery.acid.bubblegum "why not do `sink": that also fails |
09:23:36 | FromDiscord | <nocturn9x> rip |
09:26:08 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "`/home/nocturn9x/heimdall/src/heimdall/position.nim": that'll be because you dont do what i suggested |
09:26:16 | FromDiscord | <nocturn9x> such as? |
09:26:17 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "that also fails": oof |
09:26:25 | FromDiscord | <Robyn [She/Her]> In reply to @battery.acid.bubblegum "I *think* ownership is": here |
09:26:51 | FromDiscord | <nocturn9x> In reply to @nocturn9x "currently I have a": so I'd need to mark this as discardable and return Position? |
09:27:50 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=PvJLJctO |
09:28:01 | FromDiscord | <nocturn9x> In reply to @nocturn9x "`/home/nocturn9x/heimdall/src/heimdall/position.nim": cuz it fails the same way |
09:28:48 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=iyKEmTAY |
09:29:43 | FromDiscord | <nocturn9x> it seems like it's trying to make a copy instead of moving it |
09:29:53 | FromDiscord | <nocturn9x> which doesn't make a ton of sense? |
09:29:58 | FromDiscord | <nocturn9x> like isn't the point of move semantics to avoid copies |
09:35:28 | FromDiscord | <nocturn9x> also if I uncomment my overridden copy constructor, the behavior of the program changes |
09:35:31 | FromDiscord | <nocturn9x> and it makes my tests fail |
09:35:35 | FromDiscord | <nocturn9x> so something is clearly not right here |
09:41:46 | FromDiscord | <nocturn9x> I think my problem lies here: A "move" can be regarded as an optimized copy operation. If the source of the copy operation is not used afterward, the copy can be replaced by a move. This document uses the notation lastReadOf(x) to describe that x is not used afterward. |
09:41:57 | FromDiscord | <nocturn9x> I _do_ use x afterwards |
09:42:02 | FromDiscord | <nocturn9x> I need ownership to move back and forth |
09:42:11 | FromDiscord | <nocturn9x> otherwise nothing works |
09:44:17 | * | MauGal quit (Ping timeout: 248 seconds) |
09:52:31 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "so I'd need to": not discardable, you'd need to do `myPos = spawnPiece(myPos, ...)` |
09:52:58 | FromDiscord | <Robyn [She/Her]> So you'd assign the return value to the original variable, giving you back the ownership as soon as the function returns |
09:54:30 | * | jjido joined #nim |
09:54:38 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "which doesn't make a": think about it like how Rust's mutable reference semantics work, you can't have more than one living mutable reference at a time |
09:54:54 | FromDiscord | <nocturn9x> I don't want more than one mutable reference at a time tho |
09:55:00 | FromDiscord | <Robyn [She/Her]> It's a poor way to describe it but, eh |
09:55:03 | FromDiscord | <nocturn9x> I want the single mutable reference to move through the function call chain |
09:55:05 | FromDiscord | <nocturn9x> back and forth |
09:55:10 | FromDiscord | <nocturn9x> there is only ever one mutable ref |
09:55:23 | FromDiscord | <nocturn9x> In reply to @battery.acid.bubblegum "So you'd assign the": ugh |
09:55:24 | FromDiscord | <nocturn9x> annoying |
09:55:34 | FromDiscord | <nocturn9x> but I guess I can try it |
09:55:44 | FromDiscord | <nocturn9x> would that avoid copies? |
09:55:48 | FromDiscord | <nocturn9x> it's my main concern |
09:55:55 | FromDiscord | <nocturn9x> and why I use var parameters in the first place |
09:56:08 | FromDiscord | <Robyn [She/Her]> You're doing `spawnPiece(result, square, piece)` which causes a copy because `spawnPiece` takes a `sink Position` and you still have a living instance (`result`) |
09:56:31 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "would that avoid copies?": Yeah, I used this a few times when messing with parser combinators |
10:12:50 | * | MauGal joined #nim |
10:13:40 | * | ntat quit (Quit: Leaving) |
10:15:28 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
10:42:19 | FromDiscord | <nocturn9x> In reply to @battery.acid.bubblegum "You're doing `spawnPiece(result, square,": I see |
10:42:26 | FromDiscord | <nocturn9x> I'm gonna have to experiment with this |
10:47:26 | * | ntat joined #nim |
10:50:11 | FromDiscord | <nocturn9x> do copies occur if I pass `Position` alone? |
10:50:23 | FromDiscord | <nocturn9x> considering it's immutable it can just pass it as a hidden reference no? |
10:50:34 | FromDiscord | <nocturn9x> iirc the compiler already does this for large objects but it's an implementation detail |
10:50:37 | FromDiscord | <nocturn9x> so not something to rely on |
10:56:27 | FromDiscord | <nocturn9x> I have a function like this as well: `proc isEPLegal(self: var Position, friendlyKing, epTarget: Square, occupancy, pawns: Bitboard, sideToMove: PieceColor): tuple[left, right: Square]` |
10:56:30 | FromDiscord | <nocturn9x> where I return something |
10:56:35 | FromDiscord | <nocturn9x> how do I rewrite this one? :') |
10:57:02 | FromDiscord | <nocturn9x> can I just assign to `self` |
10:58:12 | FromDiscord | <albassort> hashsets[string] isn't matching strings |
10:58:24 | FromDiscord | <albassort> in returns false when it should return |
10:58:48 | FromDiscord | <albassort> that, or the strings are hding characters from me but idk how that would happen here |
11:01:17 | FromDiscord | <albassort> matchId: "CZV-TSC-2025-03-08T12:00:00-05:00",↵ "CZV-TSC-2025-03-08T12:00:00-05:00", |
11:07:58 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "I have a function": uhhhh no clue |
11:08:23 | FromDiscord | <Robyn [She/Her]> I usually just used a type that contained my uncopiable type |
11:08:34 | FromDiscord | <Robyn [She/Her]> You'd probably wanna use ensureMove |
11:14:12 | FromDiscord | <nocturn9x> I just added `position` to the tuple |
11:14:29 | FromDiscord | <nocturn9x> and when I use it (in just like 3 places) I call it and then do `result = thing.position` |
11:14:30 | FromDiscord | <nocturn9x> seems to work |
11:14:34 | FromDiscord | <nocturn9x> will keep refactoring |
11:15:47 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=JYeNurAW |
11:18:06 | FromDiscord | <nocturn9x> now I have this failing to compile |
11:18:10 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=oanefMVi |
11:18:17 | FromDiscord | <nocturn9x> it's trying to make a copy |
11:18:21 | FromDiscord | <nocturn9x> why though? |
11:18:52 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "do you mean something": is ensureMove causing the error? |
11:18:55 | FromDiscord | <nocturn9x> nopes |
11:19:04 | FromDiscord | <Robyn [She/Her]> ah |
11:19:04 | FromDiscord | <nocturn9x> `/home/nocturn9x/heimdall/src/heimdall/movegen.nim(277, 40) Error: '=dup' is not available for type <Position>, which is inferred from unavailable '=copy'; requires a copy because it's not the last read of 'self.positions[1]'; routine: generateMoves` |
11:19:16 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=RQtvMlBp |
11:19:32 | * | ntat quit (Read error: Connection reset by peer) |
11:19:32 | FromDiscord | <nocturn9x> thanks for the help btw |
11:20:09 | * | cornfeedhobo quit (Ping timeout: 276 seconds) |
11:20:49 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=AtegVhMx |
11:20:55 | FromDiscord | <Robyn [She/Her]> and no sweat |
11:21:30 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=HPisnQuQ |
11:21:49 | FromDiscord | <nocturn9x> the only thing that needs to modify the position is `generatePawnMoves` to check for en passant legality |
11:21:54 | FromDiscord | <nocturn9x> everything else just reads from it |
11:22:17 | FromDiscord | <nocturn9x> (edit) "https://play.nim-lang.org/#pasty=feBWbqJD" => "https://play.nim-lang.org/#pasty=aouxynXD" |
11:22:22 | FromDiscord | <nocturn9x> I removed the comments to make the snippet shorter |
11:23:00 | FromDiscord | <Robyn [She/Her]> hm... |
11:23:02 | FromDiscord | <nocturn9x> I assume you'd want to see `generatePawnMoves`? |
11:23:09 | FromDiscord | <Robyn [She/Her]> genuinely can't see a problem |
11:23:09 | FromDiscord | <nocturn9x> it's a bit big so it'll have to be a paste |
11:24:32 | FromDiscord | <Robyn [She/Her]> That's fine though it should be unrelated since the error is at the assignment |
11:24:38 | FromDiscord | <nocturn9x> yeah |
11:24:43 | FromDiscord | <nocturn9x> idk |
11:26:21 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=uKlWXrnc |
11:26:23 | FromDiscord | <nocturn9x> this is the chessboard |
11:26:35 | FromDiscord | <Robyn [She/Her]> Beef will call me a dumbass later but you could try `var pos = ensureMove(self.positions[^1])`, pass that to `generateMoves` and then do `self.positions[^1] = ensureMove(pos)`? |
11:26:46 | FromDiscord | <nocturn9x> that was my thought |
11:26:47 | FromDiscord | <nocturn9x> let's try |
11:27:07 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=cGSgIOcK |
11:27:35 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=sXLmBNAj |
11:27:36 | FromDiscord | <nocturn9x> so like this? |
11:28:05 | FromDiscord | <nocturn9x> `/home/nocturn9x/heimdall/src/heimdall/movegen.nim(277, 40) Error: cannot move 'self.positions[1]', which introduces an implicit copy` |
11:28:08 | FromDiscord | <Robyn [She/Her]> Yeah, try that and lmk |
11:28:20 | FromDiscord | <Robyn [She/Her]> Ah, you could try popping it |
11:28:21 | FromDiscord | <nocturn9x> line 277 is `var pos` |
11:28:28 | FromDiscord | <nocturn9x> In reply to @battery.acid.bubblegum "Ah, you could try": k |
11:28:42 | FromDiscord | <nocturn9x> so just pop without ensureMove? |
11:28:43 | FromDiscord | <Robyn [She/Her]> `self.positions.pop` (iirc pop removes the last elem and returns it?) |
11:28:46 | FromDiscord | <Robyn [She/Her]> Yep |
11:29:15 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=PSBPIgWw |
11:29:18 | FromDiscord | <nocturn9x> like so? |
11:29:22 | FromDiscord | <Robyn [She/Her]> Then you'd do `self.positions.setLen self.positions.len + 1` and `self.positions[^1] = ensureMove(...)` |
11:29:33 | FromDiscord | <nocturn9x> ah right |
11:29:51 | FromDiscord | <Robyn [She/Her]> this is literally just me wildly guessing and hoping it'll stick |
11:30:13 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=fKrILqmZ |
11:30:20 | FromDiscord | <nocturn9x> I could also just do `.add()` ig? |
11:30:24 | FromDiscord | <Robyn [She/Her]> Yeah looks good |
11:30:34 | FromDiscord | <Robyn [She/Her]> Add may work? Not sure if it'll introduce a copy |
11:30:39 | FromDiscord | <Robyn [She/Her]> If lucky, it won't |
11:30:47 | FromDiscord | <nocturn9x> ok so |
11:30:53 | FromDiscord | <nocturn9x> with the assignment it does not compile |
11:30:54 | FromDiscord | <nocturn9x> with add, it does |
11:31:03 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=lQQeQEPI |
11:31:08 | FromDiscord | <Robyn [She/Her]> Oh lol |
11:31:19 | FromDiscord | <Robyn [She/Her]> That's good then at least woo |
11:31:26 | FromDiscord | <nocturn9x> I mean I get another error somewhere else that I have to fix but at least this seems solved |
11:31:27 | FromDiscord | <nocturn9x> so, nice |
11:31:31 | FromDiscord | <Robyn [She/Her]> iss ensureMove necessary there? |
11:31:47 | FromDiscord | <nocturn9x> good question |
11:31:48 | FromDiscord | <nocturn9x> I have no idea |
11:31:53 | FromDiscord | <Robyn [She/Her]> lolol |
11:31:54 | FromDiscord | <nocturn9x> can't hurt, since it's compile time only no? |
11:31:59 | FromDiscord | <Robyn [She/Her]> yep |
11:32:03 | FromDiscord | <nocturn9x> neat |
11:32:16 | FromDiscord | <nocturn9x> ah it's the same problem |
11:32:21 | FromDiscord | <Robyn [She/Her]> oh? |
11:32:26 | FromDiscord | <nocturn9x> `/home/nocturn9x/heimdall/src/heimdall/movegen.nim(366, 44) Error: '=dup' is not available for type <Position>, which is inferred from unavailable '=copy'; requires a copy because it's not the last read of 'self.positions[1]'; routine: doMove` |
11:32:28 | FromDiscord | <nocturn9x> assignment again |
11:32:36 | FromDiscord | <nocturn9x> `self.positions[^1] = self.positions[^1].removePiece(epPawnSquare)` |
11:32:52 | FromDiscord | <nocturn9x> do I have to pop and push every time? that seems horribly slow |
11:32:57 | FromDiscord | <Robyn [She/Her]> I think it's because indexing involves a copy operation |
11:32:58 | FromDiscord | <nocturn9x> I can't do it in performance critical code |
11:33:03 | FromDiscord | <nocturn9x> :P |
11:33:15 | FromDiscord | <nocturn9x> doing it once in generateMoves at the end is fine, since popping at the end is cheap anyway |
11:33:24 | FromDiscord | <nocturn9x> but every time I have to modify stuff? I'd be doing it like 20 times per move |
11:33:40 | FromDiscord | <Robyn [She/Her]> Since it's at the end of a loop, there should be no issue, I don't think pop reduces the capacity at all |
11:33:49 | FromDiscord | <nocturn9x> oh it doesn't I know that |
11:33:58 | FromDiscord | <nocturn9x> but idk if it would affect performance still |
11:34:05 | FromDiscord | <nocturn9x> guess I can just try |
11:34:24 | FromDiscord | <Robyn [She/Her]> then i'd assume no issues in an ideal world |
11:34:28 | FromDiscord | <nocturn9x> let's try ig |
11:34:35 | FromDiscord | <Robyn [She/Her]> you could avoid that variable assignment thouggh |
11:34:41 | FromDiscord | <nocturn9x> how? |
11:34:46 | FromDiscord | <Robyn [She/Her]> would just make it a bit uglier |
11:34:55 | FromDiscord | <nocturn9x> do you mean push and pop in one go? |
11:35:06 | FromDiscord | <nocturn9x> oh but wait a sec |
11:35:08 | FromDiscord | <nocturn9x> can I not do like |
11:35:15 | FromDiscord | <nocturn9x> move it at the beginning of `doMove` |
11:35:18 | FromDiscord | <nocturn9x> then move it back and forth |
11:35:22 | FromDiscord | <nocturn9x> then add it back? |
11:35:35 | FromDiscord | <nocturn9x> no indexing anywhere |
11:35:35 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=laQHYmEr |
11:35:42 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=uXZqJFXI |
11:36:25 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "then add it back?": im struggling to process the words bc im hungry and tired af :p |
11:36:36 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=duBbBwXN |
11:37:04 | FromDiscord | <nocturn9x> In reply to @battery.acid.bubblegum "im struggling to process": ah rip |
11:37:06 | FromDiscord | <nocturn9x> what I mean is like |
11:37:10 | FromDiscord | <nocturn9x> I pop() it |
11:37:13 | FromDiscord | <nocturn9x> do whatever I need to do on it |
11:37:18 | FromDiscord | <nocturn9x> then add it back at the end |
11:37:25 | FromDiscord | <nocturn9x> instead of pop/push/pop/push |
11:37:43 | FromDiscord | <Robyn [She/Her]> yeah that would likely be more ideal |
11:37:47 | FromDiscord | <nocturn9x> lemme try |
11:39:07 | FromDiscord | <nocturn9x> oh but wait |
11:39:13 | FromDiscord | <nocturn9x> doMove already creates a clone |
11:39:33 | * | ntat joined #nim |
11:39:39 | FromDiscord | <Robyn [She/Her]> Ah |
11:39:48 | FromDiscord | <nocturn9x> so I can just |
11:39:52 | FromDiscord | <nocturn9x> clone the previous one |
11:39:54 | FromDiscord | <nocturn9x> and add it at the end |
11:40:03 | FromDiscord | <Robyn [She/Her]> groovin then |
11:40:11 | FromDiscord | <nocturn9x> fr |
11:42:30 | FromDiscord | <nocturn9x> ayy |
11:42:31 | FromDiscord | <nocturn9x> it works |
11:42:40 | FromDiscord | <nocturn9x> I just do `var cloned = self.positions[^1].clone()` |
11:42:46 | FromDiscord | <nocturn9x> do `cloned = cloned.stuff()` |
11:42:57 | FromDiscord | <nocturn9x> and at the end `self.positions.add(ensureMove(cloned))` |
11:43:58 | FromDiscord | <nocturn9x> fun stuff |
11:44:27 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "it works": groovin :) |
11:44:58 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "I just do `var": surely a move would be more effective than a clone tho |
11:45:08 | FromDiscord | <nocturn9x> but I do have to clone it |
11:45:11 | FromDiscord | <nocturn9x> it's a new position |
11:45:15 | FromDiscord | <nocturn9x> doMove creates a new position |
11:45:17 | FromDiscord | <nocturn9x> so it has to clone |
11:45:20 | FromDiscord | <Robyn [She/Her]> ooooh |
11:45:24 | FromDiscord | <nocturn9x> I keep a position stack yk |
11:45:24 | FromDiscord | <Robyn [She/Her]> kk ignore me then lol |
11:45:40 | FromDiscord | <Robyn [She/Her]> yeah that makes sense |
11:45:46 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=NHagptih |
11:45:49 | FromDiscord | <nocturn9x> welp good thing I have tests |
11:45:51 | FromDiscord | <nocturn9x> time to fix shit |
11:45:52 | FromDiscord | <nocturn9x> xD |
11:49:09 | FromDiscord | <Robyn [She/Her]> oof- |
11:50:53 | * | cornfeedhobo joined #nim |
11:58:02 | FromDiscord | <nocturn9x> uh |
11:58:04 | FromDiscord | <nocturn9x> what the fuck |
11:58:06 | FromDiscord | <nocturn9x> `Error: unhandled exception: /home/nocturn9x/heimdall/src/heimdall/tui.nim(84, 13) `pos.zobristKey == incHash` 4973416858127630896 != 4973416858127630896 at a2a3 (Default) (rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1) [AssertionDefect]` |
11:58:11 | FromDiscord | <nocturn9x> sir, those are the same fucking hashes- |
11:59:02 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=gLqHhroe |
11:59:27 | FromDiscord | <nocturn9x> ah I'm printing the wrong thing |
11:59:27 | FromDiscord | <nocturn9x> lol |
11:59:46 | FromDiscord | <nocturn9x> love it when the test is broken |
11:59:55 | FromDiscord | <Robyn [She/Her]> lolol relatable |
12:00:49 | FromDiscord | <nocturn9x> hmm I think I see the problem |
12:00:56 | FromDiscord | <nocturn9x> incremental zobrist hashes are getting fucked |
12:01:37 | FromDiscord | <nocturn9x> ah fuck I see why |
12:01:39 | FromDiscord | <nocturn9x> I'm an idiot |
12:01:42 | FromDiscord | <nocturn9x> using the wrong thing |
12:01:44 | FromDiscord | <nocturn9x> no wonder it's borked |
12:01:57 | FromDiscord | <nocturn9x> I'm cloning the zobrist hash to a new position but then updating it from the wrong hash |
12:04:08 | FromDiscord | <nocturn9x> god I am SO glad I put all of these tests and asserts everywhere |
12:04:15 | FromDiscord | <nocturn9x> it would've been hell to figure bugs out without them |
12:04:27 | * | ntat quit (Read error: Connection reset by peer) |
12:17:52 | FromDiscord | <nocturn9x> hmm the incremental hash seems correct |
12:17:57 | FromDiscord | <nocturn9x> it's the from scratch one that's borked then? |
12:23:40 | * | beholders_eye joined #nim |
12:24:22 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=YYlytmkb |
12:24:32 | FromDiscord | <nocturn9x> does this implementation of `clone` make sense? |
12:24:39 | FromDiscord | <nocturn9x> beef gave it to me but I'm starting to doubt it's the problem |
12:24:55 | FromDiscord | <nocturn9x> if I try to do `board.position.mailbox == board.position.clone().mailbox` I get an overflow error inside the stdlib lol |
12:25:02 | FromDiscord | <nocturn9x> despite both of them printing fine |
12:25:10 | FromDiscord | <nocturn9x> `board.position` is a `lent Position` |
12:28:26 | * | MauGal quit (Ping timeout: 252 seconds) |
12:34:38 | * | ntat joined #nim |
12:36:20 | * | jjido joined #nim |
12:36:38 | FromDiscord | <nocturn9x> oh FUCK |
12:36:44 | FromDiscord | <nocturn9x> I'm cloning the previous position and not changing the side to move |
12:36:47 | FromDiscord | <nocturn9x> hahahahahahahahahahaha |
12:36:48 | FromDiscord | <nocturn9x> what a moron |
12:50:07 | * | ntat quit (Quit: leaving) |
13:03:20 | * | beholders_eye quit (Quit: WeeChat 4.5.1) |
13:05:07 | * | ntat joined #nim |
13:10:55 | * | MauGal joined #nim |
13:14:50 | * | andreas joined #nim |
13:14:56 | * | andreas is now known as yacc |
13:16:23 | yacc | The nim forum seems to refuse to register new users with "could not send email" (no matter if it's a gmail account or on a 3rd party ISP). |
13:17:10 | FromDiscord | <nnsee> yes, this is an ongoing issue, see https://forum.nim-lang.org/t/12690 |
13:17:49 | FromDiscord | <nnsee> @pmunch can register an account for you |
13:21:23 | * | PMunch joined #nim |
13:21:26 | FromDiscord | <pmunch> Just PM me your preferred username and e-mail and I'll create an account for you |
13:21:37 | PMunch | @yacc, you can of course also do this on IRC |
13:24:10 | yacc | Well, let's ask around here: PDF parsing in nim? (Basically data scraping) |
13:30:26 | FromDiscord | <nnsee> tesseract may be an option? https://github.com/DavideGalilei/nimtesseract |
13:31:38 | FromDiscord | <nnsee> although iirc tesseract accepts image formats only, and converting PDF to an image is (obviously) lossy |
13:32:05 | FromDiscord | <nnsee> as PDFs often (but not always) include copyable plaintext |
13:36:49 | yacc | No, it's a text pdf, so no need for OCR. |
13:49:37 | * | ntat quit (Quit: leaving) |
13:52:55 | yacc | Anyway, how does nim handle unicode? I can echo "strings that contain utf-8", but that's a side effect that my terminal is UTF-8 clean, but len(s) does count the unicode codepoints as 2 bytes. |
13:53:22 | Amun-Ra | check out std/unicode and runelen |
13:53:34 | yacc | @PMunch Private message? |
13:55:11 | Amun-Ra | yacc: https://nim-lang.org/docs/unicode.html#runeLen%2Cstring |
14:04:08 | FromDiscord | <nocturn9x> uhhh @Robyn [She/Her] |
14:04:09 | FromDiscord | <nocturn9x> small problem |
14:04:20 | FromDiscord | <nocturn9x> I have this bit of coce |
14:04:22 | FromDiscord | <nocturn9x> (edit) "coce" => "code" |
14:04:35 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=aMpAouYQ |
14:04:47 | FromDiscord | <nocturn9x> for some reason between the loading from FEN and move generation the position gets all fucked |
14:04:55 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=msgDYFCZ |
14:05:00 | FromDiscord | <nocturn9x> it seems like the position is entirely reset to zero |
14:05:53 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=oyeJVNmD |
14:05:57 | FromDiscord | <nocturn9x> is this somehow erasing ownership???? |
14:06:09 | FromDiscord | <nocturn9x> (edit) "https://play.nim-lang.org/#pasty=uvybidAH" => "https://play.nim-lang.org/#pasty=gbfQQROr" |
14:06:28 | FromDiscord | <nocturn9x> I'm so confused |
14:07:33 | FromDiscord | <nocturn9x> ah I may have figured it out |
14:07:35 | FromDiscord | <nocturn9x> lolol |
14:07:58 | FromDiscord | <nocturn9x> for some tests at least |
14:08:59 | FromDiscord | <nocturn9x> still happens for others tho |
14:09:01 | FromDiscord | <nocturn9x> hmmm |
14:12:50 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "uhhh <@524288464422830095>": sorry was busy earlier |
14:12:58 | FromDiscord | <nocturn9x> dw! |
14:13:01 | FromDiscord | <nocturn9x> k so |
14:13:04 | FromDiscord | <nocturn9x> we have a VERY weird case |
14:13:14 | FromDiscord | <Robyn [She/Her]> Oh? |
14:13:19 | FromDiscord | <nocturn9x> the test now works for some cases and fails for others 😠|
14:13:27 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=gHXaLgsF |
14:13:34 | FromDiscord | <nocturn9x> i.e. after generateMoves the position is basically zeroed |
14:14:27 | FromDiscord | <Robyn [She/Her]> hm |
14:15:01 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "i.e. after generateMoves the": check everywhere you use `ensureMove` and check if you should be using a clone |
14:15:34 | FromDiscord | <nocturn9x> I have used ensureMove a bit much tbh |
14:15:36 | FromDiscord | <nocturn9x> upsie |
14:15:59 | FromDiscord | <nocturn9x> would you be able to reproduce my woes locally? |
14:16:04 | FromDiscord | <nocturn9x> I can push to my branch if you're able to run some code |
14:16:33 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "would you be able": unfortunately on my phone rn, if you could wait roughly an hour though... |
14:16:39 | FromDiscord | <nocturn9x> no rush :) |
14:16:50 | FromDiscord | <Robyn [She/Her]> epic |
14:26:06 | FromDiscord | <nocturn9x> lmk when you're available :)) |
14:33:02 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "lmk when you're available": ofc |
14:35:14 | * | ntat joined #nim |
14:35:37 | FromDiscord | <nocturn9x> :D |
14:59:46 | FromDiscord | <Robyn [She/Her]> @nocturn9x i'm able to test ya code now |
15:04:27 | FromDiscord | <nocturn9x> ayy |
15:04:36 | FromDiscord | <nocturn9x> lemme finish up lunch and I'll push to a branch |
15:04:48 | FromDiscord | <Robyn [She/Her]> kk |
15:11:54 | FromDiscord | <nocturn9x> you can clone https://git.nocturn9x.space/heimdall-engine/heimdall |
15:12:03 | FromDiscord | <nocturn9x> I recommend doing --depth 1 since the history is quite chonktastic |
15:12:09 | FromDiscord | <Robyn [She/Her]> kk |
15:12:13 | FromDiscord | <nocturn9x> then `git checkout movegen-tweaks` |
15:12:42 | FromDiscord | <nocturn9x> then to build, satisfy the dependencies once with `make net` and `make deps`, then you can do `make dev IS_DEBUG=1` to make a debug executable |
15:12:56 | FromDiscord | <nocturn9x> I've added some echo statements to the already failing test so it should be obvious what's happening |
15:13:01 | FromDiscord | <nocturn9x> let me know if you have any issues :) |
15:13:23 | FromDiscord | <Robyn [She/Her]> okay |
15:15:15 | FromDiscord | <Robyn [She/Her]> hm |
15:16:18 | FromDiscord | <Robyn [She/Her]> so `king = self.getPiece(kingSq)` specifcally causes an issue |
15:16:25 | FromDiscord | <nocturn9x> well not really |
15:16:29 | FromDiscord | <nocturn9x> that's a symptom |
15:16:33 | FromDiscord | <nocturn9x> the problem is the board is all empty |
15:16:36 | FromDiscord | <nocturn9x> and it shouldn't be |
15:16:41 | FromDiscord | <Robyn [She/Her]> ...huh hold on |
15:16:50 | FromDiscord | <nocturn9x> or rather it's all pawns, which is the default value for a piece |
15:16:53 | FromDiscord | <nocturn9x> (edit) "pawns," => "whitepawns," |
15:16:57 | FromDiscord | <nocturn9x> (edit) "whitepawns," => "white pawns," |
15:17:01 | FromDiscord | <nocturn9x> if you look at the last pair of FENs |
15:17:05 | FromDiscord | <nocturn9x> they should be identical, but aren't |
15:17:21 | FromDiscord | <nocturn9x> the second one shows the position has somehow been zeroed or corrupted |
15:18:41 | FromDiscord | <nocturn9x> btw I have an appointment in like 45 minutes |
15:18:46 | FromDiscord | <nocturn9x> which lasts ~50 minutes |
15:18:53 | FromDiscord | <nocturn9x> so I might disappear in a bit xD |
15:18:56 | FromDiscord | <nocturn9x> will be back soon tho |
15:19:31 | FromDiscord | <Robyn [She/Her]> movegen 281 `self.positions.add(self.positions.pop().generateMoves(moves, capturesOnly))` |
15:19:40 | FromDiscord | <Robyn [She/Her]> could this be a cause? is a clone wanted there? |
15:22:08 | FromDiscord | <nocturn9x> I mean |
15:22:20 | FromDiscord | <nocturn9x> why would simply generating moves warrant a copy? |
15:23:39 | FromDiscord | <nocturn9x> the point is that the position is mutated at some point but is then brought back to its original state |
15:23:57 | FromDiscord | <Robyn [She/Her]> that's fair |
15:24:05 | FromDiscord | <Robyn [She/Her]> honestly im sorta clueless about this |
15:24:08 | FromDiscord | <nocturn9x> it was definitely not copying before |
15:24:13 | FromDiscord | <nocturn9x> since it was all var parameters |
15:25:08 | FromDiscord | <nocturn9x> making a copy kind of misses the point of using move semantics |
15:25:10 | FromDiscord | <Robyn [She/Her]> I feel like something is mutating the board in an unsafe way but I have no clue what it could be, sorry |
15:25:18 | FromDiscord | <nocturn9x> rip |
15:25:30 | FromDiscord | <Robyn [She/Her]> this is just massive to me and i havent programmed much in a bit |
15:25:43 | FromDiscord | <nocturn9x> yeah I get it dw |
15:27:53 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=FztwTbdR |
15:28:07 | FromDiscord | <nocturn9x> something must be forgetting to move stuff or whatever |
15:28:11 | FromDiscord | <nocturn9x> I can't explain it otherwise |
15:29:48 | FromDiscord | <nocturn9x> I've also had it print right after it has generated all the moves |
15:29:50 | FromDiscord | <nocturn9x> and that's fine |
15:29:56 | FromDiscord | <Robyn [She/Her]> makes sense |
15:29:57 | FromDiscord | <nocturn9x> so it must be happening between the return call |
15:30:01 | FromDiscord | <nocturn9x> or something |
15:30:02 | FromDiscord | <nocturn9x> idk |
15:30:05 | FromDiscord | <Robyn [She/Her]> could compare old code and new code? |
15:30:13 | FromDiscord | <Robyn [She/Her]> try and compare the difference in semantics |
15:30:16 | FromDiscord | <nocturn9x> idk they're very different now |
15:30:30 | FromDiscord | <nocturn9x> and I can't think of something that would make it work OK sometimes and break some other time |
15:30:33 | FromDiscord | <nocturn9x> it makes no sense |
15:30:35 | FromDiscord | <nocturn9x> the code is the same |
15:31:38 | FromDiscord | <nocturn9x> cloning it explicitly seems to fix it |
15:31:42 | FromDiscord | <nocturn9x> but causes other issues elsewhere |
15:31:43 | FromDiscord | <nocturn9x> hmm |
15:33:49 | FromDiscord | <nocturn9x> what the fuck is going on 😠|
15:36:45 | FromDiscord | <nocturn9x> I narrowed it down |
15:37:02 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=hGJhOOcZ |
15:38:24 | FromDiscord | <nocturn9x> oh god. |
15:38:34 | FromDiscord | <nocturn9x> @Robyn [She/Her] take a guess |
15:38:38 | FromDiscord | <nocturn9x> what the problem is |
15:38:49 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=MJeNewqd |
15:38:52 | FromDiscord | <nocturn9x> (edit) "https://play.nim-lang.org/#pasty=rcYZrVLt" => "https://play.nim-lang.org/#pasty=TUCewBqq" |
15:38:54 | FromDiscord | <nocturn9x> 💀 |
15:39:43 | FromDiscord | <nocturn9x> the reason for the erratic behavior is that it only occurred in double checked positions 💀 |
15:42:45 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "the reason for the": oh eeesh |
15:42:53 | FromDiscord | <Robyn [She/Her]> did you manage to fix it then? |
15:42:56 | FromDiscord | <nocturn9x> yeah |
15:43:01 | FromDiscord | <nocturn9x> now I have another crash somewhere else |
15:43:02 | FromDiscord | <Robyn [She/Her]> epic |
15:43:05 | FromDiscord | <nocturn9x> but at least, different error |
15:43:08 | FromDiscord | <Robyn [She/Her]> oh oof |
15:44:37 | FromDiscord | <nocturn9x> nevermind |
15:44:41 | FromDiscord | <nocturn9x> the code was actually garbage and made no sense |
15:44:45 | FromDiscord | <nocturn9x> now that I reworked it |
15:44:47 | FromDiscord | <nocturn9x> it works fine |
15:44:51 | FromDiscord | <nocturn9x> weird, but okay 💀 |
15:45:03 | FromDiscord | <nocturn9x> probably was doing something that was OK before but breaks with this new system |
15:45:58 | FromDiscord | <nocturn9x> 💀 https://media.discordapp.net/attachments/371759389889003532/1347233755366166558/image.png?ex=67cb14b5&is=67c9c335&hm=7d658a540e6a62746cfc711340b1495ec4f714f7c481e747903b96188c98050b& |
15:46:04 | FromDiscord | <nocturn9x> there's bugs and it's slower than the original too |
15:46:06 | FromDiscord | <nocturn9x> pain |
15:47:29 | FromDiscord | <nocturn9x> it also fails perft |
15:47:33 | FromDiscord | <nocturn9x> aaaaa |
15:48:05 | FromDiscord | <nocturn9x> I'll fix this later |
15:53:28 | * | ntat quit (Quit: Leaving) |
16:05:25 | FromDiscord | <vazl> Howdy, folks 👋 |
16:05:52 | FromDiscord | <odexine> hello |
16:07:07 | * | ntat joined #nim |
16:30:29 | * | MauGal quit (Ping timeout: 260 seconds) |
16:30:42 | * | PMunch_ joined #nim |
16:32:11 | * | PMunch quit (Read error: Connection reset by peer) |
16:51:50 | FromDiscord | <nocturn9x> In reply to @vazl "Howdy, folks 👋": hi! |
17:30:59 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
17:34:08 | FromDiscord | <nocturn9x> out of curiosity, is there a non eager version of `map` from sequtils? |
17:34:22 | FromDiscord | <nocturn9x> Something that can work with iterators or slices instead of just open arrays |
17:39:44 | FromDiscord | <odexine> not really no, its sequtils after all, but if you dont mind the output being a seq then maybe sugar.collect |
17:41:28 | FromDiscord | <aintea> btw does Nim have a ternary operator ? |
17:42:22 | FromDiscord | <odexine> use a regular if statement |
17:42:31 | FromDiscord | <odexine> `if xxx: somevalue else: someothervalue` |
17:42:59 | FromDiscord | <nervecenter> In reply to @aintea "btw does Nim have": `let cond_val = if something: this elif something_else: that else: another` |
17:43:28 | FromDiscord | <nervecenter> `if` is an expression that can return a value, same for `case` |
17:43:38 | FromDiscord | <aintea> something ore consice |
17:44:18 | FromDiscord | <aintea> (edit) "ore consice" => "more concise" |
17:44:24 | FromDiscord | <aintea> like the ternary operator in C |
17:44:37 | FromDiscord | <nervecenter> you can separate each clause by line if you want clarity, but there aren't any symbols if that's what you're asking |
17:44:45 | FromDiscord | <aintea> how sad |
17:45:03 | FromDiscord | <nervecenter> many such cases |
17:45:40 | FromDiscord | <odexine> nim is generally a "readably concise" language except for a few things |
17:45:42 | FromDiscord | <nervecenter> (obviously I'm joking, I don't think it's a big deal) |
17:47:25 | FromDiscord | <aintea> Do we have a way to make theenary operator ? |
17:49:13 | FromDiscord | <nervecenter> macros and templates exist if you want to try it yourself, but they can't outright change the syntax |
17:50:54 | FromDiscord | <fabric.input_output> In reply to @aintea "Do we have a": `if c: e1 else: e2` is the equivalent |
17:51:41 | FromDiscord | <aintea> sent a code paste, see https://play.nim-lang.org/#pasty=QgqWPjAG |
17:51:59 | FromDiscord | <fabric.input_output> nah you can't do that. why would you need to anyways? |
17:52:04 | FromDiscord | <fabric.input_output> or even want to |
17:52:52 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=xTBghwwJ |
17:55:15 | FromDiscord | <aintea> In reply to @fabric.input_output "or even want to": Nim prides itself of being a programming language with the extensibility of LISP |
17:55:20 | FromDiscord | <aintea> let me do stuff |
17:55:24 | FromDiscord | <nervecenter> sent a code paste, see https://play.nim-lang.org/#pasty=eCrQGkas |
17:55:25 | FromDiscord | <fabric.input_output> sure |
17:57:24 | FromDiscord | <aintea> In reply to @nervecenter "`echo if true: "yes"": this is an example |
18:00:30 | FromDiscord | <aintea> sent a code paste, see https://play.nim-lang.org/#pasty=ZBHIVDdb |
18:00:55 | FromDiscord | <fabric.input_output> you don't need the parens btw |
18:01:08 | FromDiscord | <fabric.input_output> and in this example you can put everything on one line |
18:07:58 | FromDiscord | <odexine> In reply to @aintea "Nim prides itself of": nim doesnt provide you the syntax extensibility |
18:08:50 | FromDiscord | <odexine> that is the shortest you can do |
18:10:23 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=bnYJJCSt |
18:10:26 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=AIdxSMTt |
18:11:11 | FromDiscord | <Robyn [She/Her]> In reply to @demotomohiro "How about to combine": oh this is a better solution than mine (i was gonna make a type that acted as an intermediary) |
18:14:16 | FromDiscord | <Robyn [She/Her]> random question but is array indexing (with the `array` type) faster than if statements? |
18:14:26 | FromDiscord | <demotomohiro> But unlike if expression, it always evaluate both 'true' and 'false' expressions.↵It can be a problem if 'true' or 'false' expression has a side effect. |
18:15:39 | FromDiscord | <demotomohiro> And above code might less efficient than if expression. |
18:17:29 | FromDiscord | <Robyn [She/Her]> In reply to @demotomohiro "But unlike if expression,": enum indexed arrays? |
18:17:45 | FromDiscord | <odexine> In reply to @battery.acid.bubblegum "random question but is": probably not? |
18:18:03 | FromDiscord | <odexine> In reply to @battery.acid.bubblegum "enum indexed arrays?": what about enum indexed arrays would change this? |
18:19:34 | FromDiscord | <Robyn [She/Her]> In reply to @demotomohiro "But unlike if expression,": idk if this was aimed at me or AinTea |
18:19:52 | FromDiscord | <Robyn [She/Her]> In reply to @odexine "what about enum indexed": that's why i said enum indexed array, for more than true and false |
18:20:09 | FromDiscord | <odexine> huh?"? |
18:20:20 | FromDiscord | <odexine> i dont see what that would be useful for |
18:20:49 | FromDiscord | <odexine> the problem is that both branches are evaluated; in a regular if else statement only one branch is evaluated |
18:21:13 | FromDiscord | <odexine> this is inherently from how nim works, since it is an eager language |
18:23:49 | FromDiscord | <Robyn [She/Her]> In reply to @odexine "the problem is that": the value is already known at compile-time, but the access for it varies depending on runtime results, but tbh it's probably not useful even then |
18:24:39 | FromDiscord | <odexine> i have no idea what youre trying to say |
18:27:20 | * | derpydoo joined #nim |
19:04:31 | FromDiscord | <Robyn [She/Her]> In reply to @odexine "i have no idea": Yeah it's hard for me to articulate rn, if I figure out how to write it in english and not whatever tf my brain speaks, I'll let ya know |
19:21:14 | * | derpydoo quit (Quit: derpydoo) |
20:25:25 | FromDiscord | <abraham> sent a long message, see https://pasty.ee/XprOdMrh |
20:26:10 | FromDiscord | <Elegantbeef> Not as soon orc has a collector that doesn't fire instantly, but i'tll free it |
20:27:06 | FromDiscord | <abraham> I thought so, but it seemed a little too good to be true. |
20:27:41 | FromDiscord | <Elegantbeef> It's shitty automatic memory management if you have to manually do something 😄 |
20:42:18 | * | jjido joined #nim |
20:45:10 | * | adigitoleo quit (*.net *.split) |
20:45:29 | * | adigitoleo joined #nim |
21:27:30 | FromDiscord | <nervecenter> In reply to @abraham "Hey folks, I'm trying": It's a type of reference counter so I imagine as soon as anything created with `new` loses all refs or goes out of scope, its count is checked and if 0 the destructor is called. So when the list is destroyed, it should chain to every node. In that case, yes is the answer to the second question. The point of RC and GC is it avoids manual memory semantic code in the vast majority of cases. |
21:27:46 | FromDiscord | <nervecenter> (edit) "loses all refs" => "is deleted" |
21:28:24 | FromDiscord | <nervecenter> (edit) "In reply to @abraham "Hey folks, I'm trying": It's" => "sent" | "type of reference counter so I imagine as soon as anything created with `new` is deleted or goes out of scope, its count is checked and if 0 the destructor is called. So when the list is destroyed, it should chain to every node. In that case, yes is the answer to the second question. The point of RC and GC is it avoids manual memory semantic code in the vast m |
21:30:14 | FromDiscord | <nervecenter> Garbage collectors are finicky in that they'll only collect when memory runs out, so it's "lazy" memory management. Reference counting cleans things up "eagerly". |
21:30:52 | FromDiscord | <nervecenter> They accomplish the same thing, but the eager behavior has a more deterministic impact on moment-to-moment behavior. |
21:31:21 | FromDiscord | <Elegantbeef> > Garbage collectors are finicky in that they'll only collect when memory runs out↵That's not true |
21:31:47 | FromDiscord | <nervecenter> I must have forgotten something along the way then, I forget |
21:31:57 | FromDiscord | <Elegantbeef> When to collect garbage is not forced in any single way. You can attempt to clean up garbage whenever |
21:32:18 | FromDiscord | <Elegantbeef> In fact garbage collectors usually expose procedures to stop automatic collection and allow you to control it manually |
21:32:48 | FromDiscord | <nervecenter> Isn't it the case that if not invoked manually, a GC will only collect when out of memory? Also, I'm pretty sure RCs constrain collection only to relevant objects, while GCs must clean the entire pool the object is contained in. |
21:32:53 | FromDiscord | <fabric.input_output> also generational gc |
21:33:05 | FromDiscord | <Elegantbeef> Nope |
21:33:27 | FromDiscord | <Elegantbeef> Why would you wait until memory issues to invoke GC |
21:34:21 | FromDiscord | <nervecenter> In reply to @Elegantbeef "Why would you wait": Unless I was taught wrong, I though it was an attempt to allocate with `new` when a GC checks its tables and runs a sweep if there's not enough contiguous space |
21:35:07 | FromDiscord | <Elegantbeef> The runtime can do collection whenever |
21:35:12 | FromDiscord | <nervecenter> While I also learned that an RC's only collection condition is a 0 count upon deallocation |
21:35:16 | FromDiscord | <Elegantbeef> It likely also checks on new if there is memory contention |
21:35:18 | FromDiscord | <nervecenter> Or are these just simple naive strategies |
21:35:57 | FromDiscord | <nervecenter> In reply to @Elegantbeef "The runtime can do": Well yes that too, sophisticated GCs can have timed collections and such |
21:36:04 | * | rockcavera joined #nim |
21:36:10 | FromDiscord | <nervecenter> I know high-throughput systems use timed and generational and all sorts of combined strategies |
21:36:41 | FromDiscord | <Elegantbeef> https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/fundamentals#conditions-for-a-garbage-collection C# does seem to do what you say |
21:38:51 | FromDiscord | <nervecenter> iirc JVM and BEAM implement all sorts of crazy knobs and switches |
21:39:14 | FromDiscord | <Elegantbeef> Nim's refc also has a bunch of configuration |
21:39:43 | FromDiscord | <Elegantbeef> Or atleast I think it did |
21:41:16 | * | ntat quit (Quit: Leaving) |
21:42:27 | FromDiscord | <nnsee> In reply to @nervecenter "Isn't it the case": not "out of memory", but rather memory pressure (usually). "pressure" is pretty loosely defined but more often than not it's rather conservative and collects as soon as it's reasonable to do so |
21:42:48 | FromDiscord | <nnsee> when talking about the defaults, that is |
21:43:15 | FromDiscord | <Elegantbeef> Though also what collection means also differs, some returns to the OS others might not |
22:34:58 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
22:50:53 | FromDiscord | <heysokam> @nervecenter might be a case of arc/orc algorithm doing things in a better way than your standard "by the book" GC mark-and-sweep implementation, and whoever gave you context not being aware of the new algorithms out there |
22:51:46 | FromDiscord | <heysokam> education is the slowest industry by far |
23:35:50 | FromDiscord | <nimble install python-zig?> What really gets me with gc is that you do have to think about stuff differently, like the fact that the logic for freeing complex structures like graphs is just baked means I don't need to avoid them as much as I do when writing in the manual languages I typically use. |
23:45:35 | FromDiscord | <Elegantbeef> This is why people like arena allocators for data types like that |
23:45:47 | FromDiscord | <Elegantbeef> Parsers and trees work well with arenas as you just free all of them when you're done |
23:53:18 | FromDiscord | <prestosilver> Yup |
23:53:38 | FromDiscord | <prestosilver> Actually so true, I always forget they exist |
23:57:31 | FromDiscord | <Elegantbeef> Insert people annoyed that Nim does not have an implicit `context` variable like Zig/Odin here |