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