<< 12-08-2025 >>

00:51:06*skippy8 joined #nim
01:05:48*oisota0 joined #nim
01:06:03*oisota quit (Read error: Connection reset by peer)
01:06:03*oisota0 is now known as oisota
01:07:20*ttkap quit (Ping timeout: 260 seconds)
01:07:55*FromDiscord quit (Ping timeout: 260 seconds)
01:08:23*FromDiscord joined #nim
01:08:42*ttkap joined #nim
02:10:12*acidsys quit (Server closed connection)
02:10:35*acidsys joined #nim
02:45:38*rockcavera quit (Remote host closed the connection)
05:28:56*andy-turner joined #nim
06:41:08FromDiscord<albassort> do any other languages have an \r\L thing
06:41:19FromDiscord<albassort> or is it just nim that does recvLine like this
06:47:31FromDiscord<albassort> beef
06:47:45FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=sNxPbxdD
06:49:33FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=GRLfmhjs
06:50:29FromDiscord<Elegantbeef> Hell not you're converting an integer to a string
06:50:37FromDiscord<Elegantbeef> That's not how any of this work
06:51:20FromDiscord<albassort> integer -> ordinals -> string
06:51:44FromDiscord<albassort> i bother beef when i could just reference my own code :3
06:52:03FromDiscord<Elegantbeef> `cast[string]` should never be valid
06:52:50FromDiscord<albassort> then whats the cheap way to convert an array[char] to string
06:53:20FromDiscord<leorize> who doesn't have support for CRLF these days↵(@albassort)
06:53:37FromDiscord<albassort> gonna do byte prefix just encase
06:54:51FromDiscord<Elegantbeef> There is no cheap way↵(@albassort)
06:55:02FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=KYrOAvTS
06:55:28FromDiscord<albassort> what if i just like, told the compiler that if i add a length prefix to my array[char] its now a stirng and leave me alone
06:55:56FromDiscord<albassort> just like that
06:55:56FromDiscord<albassort> at the codebase
06:56:08FromDiscord<Elegantbeef> That's not what a Nim string is
06:56:27FromDiscord<albassort> what is a nim string
06:56:30FromDiscord<albassort> i thought we had pascal strings
06:57:29FromDiscord<Elegantbeef> They are pascal
06:57:45FromDiscord<Elegantbeef> but they' `len, data: ptr (cap: int, chars: UncheckedArray[char]])`
06:58:27FromDiscord<Elegantbeef> Also cap is used to indicate whether the string is cow
06:58:57FromDiscord<albassort> ok but what would that look like in packed memory
06:59:06FromDiscord<albassort> int, int, array
06:59:12FromDiscord<albassort> (edit) "array" => "data"
06:59:34FromDiscord<leorize> I don't know why you want to mint strings like this even
07:00:20FromDiscord<albassort> it would be... fast?
07:00:23FromDiscord<Elegantbeef> This is questionable
07:01:42FromDiscord<Elegantbeef> Why do you need to return the array
07:01:48FromDiscord<Elegantbeef> Just give the procedure the socket
07:02:24FromDiscord<leorize> or like, perform vectorized I/O, which was designed precisely for this
07:03:08FromDiscord<Elegantbeef> Same difference
07:03:30FromDiscord<albassort> what is this
07:05:00FromDiscord<albassort> i can google if you wihs
07:05:02FromDiscord<albassort> (edit) "wihs" => "wish"
07:08:55FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=nLWsBlOA
07:09:26FromDiscord<albassort> this does 2 copies 2 writes
07:09:50FromDiscord<albassort> 1. copies from the sizes, makes sure its little endian↵2. copies the message into the char array
07:09:57FromDiscord<Elegantbeef> `cast[array[3, char]]` are you uh... sure you want a cast?
07:11:06FromDiscord<leorize> you should lookup `writev`
07:11:10FromDiscord<albassort> no, i dont need a cast, thats stupid, why would i need that i can just copy from the integer
07:11:27FromDiscord<albassort> :)
07:11:47FromDiscord<leorize> `writev` let you drop the output buffer by allowing you to send disjoint buffers in one `write` operation
07:12:34FromDiscord<albassort> https://media.discordapp.net/attachments/371759389889003532/1404724225108869161/image.png?ex=689c3ae1&is=689ae961&hm=29e6bd21dd8680f6598744e3d5d137f7acf30cdf3a9dbbc53c13453010575d4e&
07:12:48FromDiscord<albassort> this one?
07:13:14FromDiscord<leorize> I'm not talking about nim
07:13:34*shrikant joined #nim
07:13:41FromDiscord<leorize> https://www.man7.org/linux/man-pages/man2/writev.2.html
07:14:11FromDiscord<albassort> ah i see
07:14:20FromDiscord<leorize> nim might not have high-level wrappers for this, but this is more or less a standard i/o operation by now and everyone supports it
07:15:32FromDiscord<albassort> In reply to @leorize "nim might not have": i could probably make one and make it part of the bundle of things im doing
07:15:37FromDiscord<albassort> seems somewhat useful
07:15:45FromDiscord<albassort> or i could just not
07:22:01FromDiscord<albassort> if someone says "bazinga" within the next 15 minutes I'll make a vwrite vread wrapper
07:22:17FromDiscord<albassort> (edit) "if someone says "bazinga" within the next 15 minutes I'll make a vwrite vread wrapper ... " added "with complete unittests and documentation"
07:22:32FromDiscord<albassort> and i'll have it finished before my birthday
07:22:38FromDiscord<albassort> (edit) "and i'll have it finished before my birthday ... " added "aug 25th"
07:23:01FromDiscord<albassort> (edit) "vwrite vread" => "writev readv"
07:27:10*xet7 joined #nim
07:29:24FromDiscord<albassort> i suppose not
08:39:21*beholders_eye joined #nim
09:01:52*beholders_eye quit (Ping timeout: 260 seconds)
09:06:16*beholders_eye joined #nim
09:21:12*andy-turner quit (Quit: Leaving)
10:43:44FromDiscord<saint._._.> Is there any progress on NIR (is that what it’s called?)
10:44:09FromDiscord<saint._._.> The compile to byte code that’s needed for IC
11:14:14FromDiscord<Phil> Forgive me if I'm wrong, brain fighting off a headache rn, but wouldn't that fall under nimony?
11:59:25FromDiscord<saint._._.> In reply to @isofruit "Forgive me if I'm": Oh cool thanks! That answers my question! Glad it’s coming along now
13:42:03FromDiscord<blashyrk> If Nim's dynamic dispatch uses subtype checking (ifs) to identify the subtype and call the appropriate method, does that mean in memory, all objects contain all possible fields of each subclass?
13:42:33FromDiscord<blashyrk> (edit) "If Nim's dynamic dispatch uses subtype checking (ifs) to identify the subtype and call the appropriate method, does that mean in memory, all objects ... contain" added "of base type"
13:42:51FromDiscord<blashyrk> (edit) "subclass?" => "subclass?↵↵For example in a seq of BaseType"
14:27:41FromDiscord<lainlaylie> each subtype contains the base type and its own fields, and the dispatch uses rtti to cast to the correct subtype
14:27:49FromDiscord<lainlaylie> you can check the generated c
15:57:41FromDiscord<ollicron_53732> https://tenor.com/view/ive-got-it-figured-out-thinking-idea-ive-got-it-all-gif-17924943
15:58:00FromDiscord<ollicron_53732> I've figured it out! 😄
15:58:24FromDiscord<ollicron_53732> I can now write macros for anything! 😄 ....MAYBE.
16:33:24FromDiscord<omar.bassam88> sent a long message, see https://pasty.ee/PUROgPaU
16:45:02*beholders_eye quit (Ping timeout: 260 seconds)
16:51:13FromDiscord<heysokam> In reply to @omar.bassam88 "Hi Everyone, I'm new": 1. None that I heard of↵2. https://github.com/nim-lang/nimony↵3. Dont know, but I'm sure beef would know↵4. Nim's stdlib lives in the main repo, so it sounds like the right place to me
16:54:03FromDiscord<omar.bassam88> In reply to @heysokam "1. None that I": So Nimony is like Nim v3 right? so does that mean hotCodeReloading is not expected to work in Nim 2?
16:54:46FromDiscord<heysokam> I don't know the answer to that myself, sorry
17:17:05FromDiscord<nervecenter> In reply to @omar.bassam88 "Hi Everyone, I'm new": iirc both concepts and object variants are going to get a look-over when Nim 3 is out, there have been implementation and syntactic discussions for quite a while
17:28:32FromDiscord<Phil> In reply to @ollicron_53732 "I can now write": If you want a pointer how to approach macros I can provide, I worked a decent amount with them and personally would consider my habits with them pretty decent
17:30:25FromDiscord<Phil> In reply to @omar.bassam88 "So Nimony is like": It isn't from all I've noticed. So far the general recommendation for larger projects have been to split the project up into a main binary and dynamically loaded libs that get compiled separately
17:30:49FromDiscord<Phil> (edit) "separately" => "separately, which isn't really all that different from the options you have in general in compiled languages without hot code reloading"
17:48:42FromDiscord<omar.bassam88> In reply to @nervecenter "iirc both concepts and": Will the code already written in Nim 2 compatible with Nim 3? or will it have breaking changes and libraries will need to be re-written?
17:50:07FromDiscord<Phil> I believe the aim is full compatibility, how much of that will be achieved we'll only know when the time comes
18:26:50FromDiscord<Elegantbeef> @omar.bassam88 Hot code reloading is not supported at all in Nim, I made my own solution myself. Automatic hot code reload is fraught with issues imo
18:28:15FromDiscord<Elegantbeef> Like HCR is there, but it's not tested or used
18:29:46FromDiscord<ollicron_53732> In reply to @isofruit "If you want a": That would be very helpful actually, as much as I find it easy to work with NimNode building, anything to speed up the process is nice
18:31:14FromDiscord<ollicron_53732> how does your process work ? because what I do is I write a sample, dump the tree and use it to build the AST using things like `newNimNode()`
18:31:30FromDiscord<Elegantbeef> Use `genast` as much as posible
18:31:34FromDiscord<Elegantbeef> possible even
18:32:54FromDiscord<ollicron_53732> genAst gets the AST from a macro; its useful for if you already have a macro and are using one to build another
18:33:28FromDiscord<ollicron_53732> didn't know that until you mentioned it 🤭
18:33:56FromDiscord<ollicron_53732> works with templates too
18:34:06FromDiscord<ollicron_53732> but I like `dumpTree:` the most
18:34:15FromDiscord<ElegantBeef> Bridge went down, but nope
18:34:17FromDiscord<ElegantBeef> That's not genast
18:34:20FromDiscord<ElegantBeef> https://nim-lang.org/docs/genasts.html#17 is genast
18:34:52FromDiscord<omar.bassam88> In reply to @Elegantbeef "<@547488017737318425> Hot code reloading": Can you share your solution as an example please? I tried to make a solution myself using inotify but it felt hacky and not much re-usable
18:35:07FromDiscord<ElegantBeef> I also use inotify
18:35:22FromDiscord<ElegantBeef> My solution is very reusable and I've hooked it into two of my games https://github.com/beef331/potato
18:35:52FromDiscord<Elegantbeef> https://nim-lang.org/docs/genasts.html#17
18:37:20FromDiscord<ElegantBeef> In reply to @omar.bassam88 "Can you share your": Checkout potatowatcher to see how I do the watching. I actually get the compiler to emit a list of all imported modules and watch every one, everytime it recompiles it gets a new list
18:38:50FromDiscord<ElegantBeef> But like I said automatic HCR is a bit of a pickle, I dump to a tagged union so you can add fields, but if you use pointer procedures it points to the previous procedures
18:38:58FromDiscord<ollicron_53732> what's a code reloader?
18:39:06FromDiscord<ollicron_53732> wait i should just use ai
18:39:13FromDiscord<ElegantBeef> No you should not just use ai
18:39:57FromDiscord<ollicron_53732> lol I just did, I think it's a cool concept
18:40:55FromDiscord<ollicron_53732> I don't even know how I would start a project like that
18:41:30FromDiscord<ollicron_53732> maybe using times module 🤷‍♂️
18:41:42FromDiscord<ElegantBeef> Why would you use times to do anything?
18:41:52FromDiscord<ElegantBeef> There is no part of HCR that requires knowing the date or time
18:42:21FromDiscord<omar.bassam88> sent a code paste, see https://play.nim-lang.org/#pasty=TlFuBWQM
18:43:07FromDiscord<ElegantBeef> Well that's why it felt so hacky, cause it was just a hack
18:43:50FromDiscord<ollicron_53732> In reply to @elegantbeef "Why would you use": like use a timer to check for changes idk.
18:44:02FromDiscord<ElegantBeef> Your OS provides an API to alert you on file changes
18:44:08FromDiscord<ollicron_53732> o.O
18:49:56*xet7_ joined #nim
18:51:04*xet7 quit (Ping timeout: 276 seconds)
19:48:10FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=DadQzFmd
19:49:05FromDiscord<leorize> it kinda explained itself
19:49:08FromDiscord<leorize> you're giving it a type
19:49:24FromDiscord<heysokam> what does that mean
19:49:35FromDiscord<Elegantbeef> You're giving it a type instead of a value
19:50:10FromDiscord<Phil> sent a long message, see https://pasty.ee/GjisqUHp
19:50:13FromDiscord<Elegantbeef> I'm repeating Leo today
19:50:16FromDiscord<heysokam> oh, `X`.. but should be `x`↵Classic me
19:50:28FromDiscord<Phil> (edit) "https://pasty.ee/vaLlWGAr" => "https://pasty.ee/YbNoCqzz"
19:51:06FromDiscord<Phil> (edit) "https://pasty.ee/ZjgRDBvF" => "https://pasty.ee/PRtKosMC"
19:53:28FromDiscord<Phil> Fundamentally generating code is not that different from generating HTML really. It is in fact better than generating HTML because if you generate broken HTML you only see that when you actually look at the file
20:06:52FromDiscord<ollicron_53732> I see, although I've never generated HTML, should be fun
20:30:45*Jjp137_ joined #nim
20:30:51*Jjp137 quit (Quit: Leaving)
21:04:02*shrikant quit (Ping timeout: 260 seconds)
21:18:22*rockcavera joined #nim
21:31:39*tiorock joined #nim
21:31:40*rockcavera quit (Killed (tungsten.libera.chat (Nickname regained by services)))
21:31:40*tiorock is now known as rockcavera
21:42:58*ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
21:43:30*ehmry joined #nim
22:28:36*skippy8 quit (Quit: WeeChat 4.6.3)
23:29:49*xet7 joined #nim
23:29:56*xet7 quit (Remote host closed the connection)
23:32:31*xet7_ quit (Ping timeout: 276 seconds)
23:37:04*xet7 joined #nim