<< 19-01-2025 >>

00:00:01FromDiscord<albassort> (edit) "https://play.nim-lang.org/#pasty=KhRxXmnl" => "https://play.nim-lang.org/#pasty=ibouzUTJ"
00:00:04FromDiscord<albassort> beef help is this possible
00:00:11FromDiscord<albassort> it should be?
00:00:38FromDiscord<Robyn [She/Her]> What are you tryna do? This looks like the ravings of a madman here
00:01:22FromDiscord<albassort> mannaging open sockets in a server and i need to quickly pull up the connections via various key to value relationships
00:01:42FromDiscord<ieltan> In reply to @albassort "is it possible for": By stale reference you mean a danling pointer ?
00:01:47FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=QyVLiLki
00:02:03FromDiscord<albassort> In reply to @ieltan "By stale reference you": ah yes, its not stale, it would be dangling yes
00:02:05FromDiscord<Robyn [She/Her]> Seqs store data side-by-side so it works fine
00:02:25FromDiscord<albassort> well thats a bad thing robyn
00:02:29FromDiscord<albassort> thats a vulnerability
00:02:32FromDiscord<demotomohiro> It is invalid code. Changing seq size after taking an address of seq element is undefined behaviour.
00:02:47FromDiscord<Robyn [She/Her]> In reply to @albassort "thats a vulnerability": That's why you'd have checks :P
00:03:01FromDiscord<albassort> In reply to @demotomohiro "It is invalid code.": yes thank you domo
00:03:33FromDiscord<albassort> hmm maybe i'll just do it by fd
00:03:54FromDiscord<ieltan> Dangling by definition means it points to invalid memory location (because the memory was freed or it was in the stack). You cannot reuse it once it's like that but what you can do it replace the dangling pointer by another reference that points to valid location
00:04:36FromDiscord<ieltan> Not sure what you want to do tho
00:04:49FromDiscord<ieltan> Oh I see
00:05:03FromDiscord<albassort> i will do fd -> socket↵Then data -> fd
00:05:08FromDiscord<albassort> that makes more sense lol
00:05:23FromDiscord<ieltan> If the seq resize you have invalidated the pointer because of the realloc
00:05:55FromDiscord<albassort> yeah, if the seq will need to be modified so much it would be make morsense to try and store it in a table
00:07:41FromDiscord<ieltan> Why do you have to send a fd over a socket instead of opening it directly tho
00:08:11FromDiscord<albassort> no i'll make a random uuid for the sockets
00:08:21FromDiscord<albassort> In reply to @ieltan "Why do you have": no im managing Keep-Alive requests
00:10:43FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=VLVWdiRQ
00:10:48FromDiscord<Elegantbeef> Gotta use a fat pointer
00:11:06FromDiscord<albassort> i have realized quite quickly that this is all stupid
00:59:08*xet7 quit (Remote host closed the connection)
01:08:43FromDiscord<albassort> https://media.discordapp.net/attachments/371759389889003532/1330343144255914027/image.png?ex=678da21a&is=678c509a&hm=adbaa282feb665fb0a954a04544522c112e0f1c8541474783183f3018f896f56&
01:08:49FromDiscord<albassort> why is this not public?
01:10:26FromDiscord<albassort> its trivial to implement on my own by
01:10:28FromDiscord<albassort> (edit) "by" => "but why"
01:11:59FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=nACnjQAL
02:21:01FromDiscord<albassort> beef was right (who woulda thought)↵my code doesa not transfer sockets between threads
02:21:15FromDiscord<albassort> (edit) "doesa" => "does"
02:22:20FromDiscord<albassort> i am now testing if i can alloc one shared, then free it, after copying it, to prevent from closing
02:34:44FromDiscord<albassort> is deepCopy unsafe now?
03:42:45*ensyde joined #nim
04:50:06*SchweinDeBurg quit (Quit: WeeChat 4.6.0-dev)
05:14:49FromDiscord<Elegantbeef> @albassort I believe Araq wants it to be done in a macro instead of being a compiler magic
05:26:08*SchweinDeBurg joined #nim
08:28:22FromDiscord<albassort> how do i get T from seq[T]
08:31:43FromDiscord<Elegantbeef> `typeof(mySeq[0])`
08:32:16FromDiscord<albassort> will that work if [0] is null
08:32:21FromDiscord<Elegantbeef> Yes
08:32:34FromDiscord<Elegantbeef> If it wasn't magic you could do `mySeq.T`
08:32:42FromDiscord<Elegantbeef> But seems that does not work with magic
08:33:06FromDiscord<albassort> i thought freindship was magic
08:33:07*ensyde quit (Ping timeout: 264 seconds)
08:58:08*ntat joined #nim
09:45:59*thunder quit (Quit: Leaving)
10:56:46FromDiscord<riku5543> sent a code paste, see https://play.nim-lang.org/#pasty=vfmooZAC
11:01:08FromDiscord<riku5543> Oops, I forgot actually logging the object can sometimes give clues, and all of the functions are in the prototype so I just have to figure out how to access that properly. Sorry
11:11:56*coldfeet joined #nim
11:21:26*strogon14 quit (Quit: Auf Wiese geh'n!)
11:22:28*strogon14 joined #nim
11:34:41FromDiscord<riku5543> sent a code paste, see https://play.nim-lang.org/#pasty=CzYMptdn
11:41:41*ntat quit (Quit: Leaving)
12:05:28*Goodbye_Vincent1 quit (Remote host closed the connection)
12:06:18*Goodbye_Vincent1 joined #nim
12:07:32*strogon14 quit (Quit: Auf Wiese geh'n!)
12:08:30*strogon14 joined #nim
12:42:34*Jjp137 quit (Ping timeout: 260 seconds)
12:42:53*Jjp137 joined #nim
15:41:18*krux02 joined #nim
16:12:42*ntat joined #nim
16:56:53FromDiscord<System64 ~ Flandre Scarlet> Hi! Is it possible to make a Duff's Device in Nim?
16:59:28Amun-Rano
16:59:44Amun-Rayou shouldn't write one neither
17:00:20Amun-Rathere's no case fall through in nim
17:00:38FromDiscord<System64 ~ Flandre Scarlet> In reply to @Amun-Ra "you shouldn't write one": Oh alright
17:01:38Amun-Raimho it really doesn't save much, makes reading code harder and optional 'break' is a great source of errors
17:02:58Amun-Ratbh you could make duff's device macro… :P
17:04:17FromDiscord<fabric.input_output> we live in a time where duff's device doesn't really offer any benefits
17:04:50Amun-Ratrue
17:06:53Amun-Raeven current C compilers will always warn you about missing break in a case
17:09:07*ftajhii quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
17:09:51FromDiscord<fabric.input_output> `attribute((fallthrough))`
17:10:29Amun-Ra{.fallthrough.} ;)
17:21:02*ftajhii joined #nim
18:10:59FromDiscord<bostonboston> I hate fall through so much
18:22:06*xet7 joined #nim
18:35:07FromDiscord<jseb> hello, i had an old installation of nimble. I tried to update it by removing ~/.nimble/pkgs, and lost `choosenim`. I tried to reinstall choosenim, but now i get error when git try to get submodules. Should i restart from scratch ?
18:37:27FromDiscord<jseb> sent a code paste, see https://play.nim-lang.org/#pasty=sTxIbWNv
18:41:36FromDiscord<jseb> sent a code paste, see https://play.nim-lang.org/#pasty=WuLsxBKg
18:58:42FromDiscord<jseb> holy me, even `nimble install nimble` dies with `zippy` submodule.
19:20:51FromDiscord<nasuray> Could be an old nimble causing your issues. A simple workaround would be to clone nimble 0.16.4, build it and then replace your existing nimble binary.
19:22:04FromDiscord<bsdooby> That's the best channel to ask beginner questions? If it is here, give it a 👍
19:22:10FromDiscord<bsdooby> (edit) "That's" => "What's"
19:30:09FromDiscord<Elegantbeef> @bsdooby here
19:44:51FromDiscord<bsdooby> I have a hard time understanding the `ref` keyword, especially in the context of `type`s ... and then there's also `ptr` ?
19:46:23Amun-Raptr is an unmanaged pointer, ref pointers are managed by a GC
19:50:32FromDiscord<Elegantbeef> Refs are heap allocated memory safe pointers
19:55:37FromDiscord<bsdooby> OK; THX
19:56:05FromDiscord<bsdooby> And why is it so, that members of a `type` cannot be `let` or `var`?
19:56:21FromDiscord<bsdooby> `type
19:56:26FromDiscord<bsdooby> (edit) "`type" => "type"
19:56:57FromDiscord<fabric.input_output> because why?
19:57:00FromDiscord<bsdooby> (edit) "type" => "type↵ Person = ref object↵ name: string↵ age: int"
19:57:46FromDiscord<bsdooby> name, age are variables, arent't they?
19:57:54FromDiscord<fabric.input_output> no, they're fields
19:58:21FromDiscord<bsdooby> to var let const only for non-fields?
19:58:33FromDiscord<fabric.input_output> they are used to declare variables
19:58:33FromDiscord<bsdooby> (edit) "to" => "so"
19:58:49FromDiscord<bsdooby> as long as a let is a variable 😉
19:59:25FromDiscord<bsdooby> OK, the distinction between variables and fields are Nim's idiosyncrasy
19:59:37Amun-Raif the type instance is var, all its fields are var, etc.
19:59:51FromDiscord<fabric.input_output> In reply to @bsdooby "OK, the distinction between": no, all sensible languages do that
20:00:06FromDiscord<Elegantbeef> C has fields and variables
20:00:19FromDiscord<bsdooby> What is a field in C?
20:00:37FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=zsOnFDEJ
20:00:42FromDiscord<bsdooby> No (visible) distinction of that feature in C
20:00:43FromDiscord<Elegantbeef> `aField` is a field
20:00:49FromDiscord<fabric.input_output> sent a code paste, see https://play.nim-lang.org/#pasty=BttsKANK
20:00:59FromDiscord<bsdooby> That's in the eye of the beholder
20:01:05FromDiscord<fabric.input_output> what
20:01:20FromDiscord<bsdooby> that name,age in C are fields. They are member variables on the struct (IMHO)
20:01:25FromDiscord<bsdooby> Nevermind I got it
20:01:45FromDiscord<fabric.input_output> in C they it just so happens for fields and variables to be declared with the same syntax
20:01:49FromDiscord<fabric.input_output> (edit) removed "they"
20:01:51FromDiscord<bsdooby> Yes
20:02:02FromDiscord<bsdooby> You are right, of course
20:02:12FromDiscord<bsdooby> See my comment above
20:02:21FromDiscord<bsdooby> visible difference not given in C
20:02:30FromDiscord<fabric.input_output> it's given by the context
20:02:35FromDiscord<bsdooby> Exactly
20:02:47FromDiscord<bsdooby> Thx for having enlighten me
20:02:57FromDiscord<fabric.input_output> sent a code paste, see https://play.nim-lang.org/#pasty=FzAjvdOx
20:04:22FromDiscord<bsdooby> Vu de cet angle, it makes sense
20:06:56FromDiscord<peachey2k2> sent a code paste, see https://play.nim-lang.org/#pasty=DrBXkcJM
20:08:11FromDiscord<peachey2k2> and here's the definition in case it's relevant https://media.discordapp.net/attachments/371759389889003532/1330629901329633301/image.png?ex=678ead2a&is=678d5baa&hm=b9470c272bd3921434e10df54c4bdfb438c24def120a1e43a90213cbe8996992&
21:19:45*coldfeet quit (Quit: Lost terminal)
22:12:28FromDiscord<Elegantbeef> @peachey2k2 which parameter is `BigInt`?
22:16:45FromDiscord<peachey2k2> the last one. it's suffixed with n in JS
22:18:32FromDiscord<Elegantbeef> Should it be `int32` instead since `Number.MAX_SAFE_INTEGER` is `9007199254740991`?
22:18:48FromDiscord<Elegantbeef> Or I guess `int` if those work
22:20:49Amun-Rapeachey2k2: int64 will be converted to BigInt unless --jsbigint64 is off
22:21:15Amun-Rajs ints are 52 bit max (or 51)
22:24:25*ntat quit (Quit: Leaving)
23:39:21*beholders_eye joined #nim