00:03:24 | * | ltriant joined #nim |
00:24:37 | NimEventer | New question by Noah: Installing Nim on windows 11, see https://stackoverflow.com/questions/74870209/installing-nim-on-windows-11 |
00:24:58 | FromDiscord | <nqeron> I'm new to nim - mainly just testing it out and stuff, but I'm having some trouble installing it - as can be seen by the post above |
00:25:39 | FromDiscord | <Elegantbeef> Antiviruses falsely flag Nim software as a virus |
00:25:51 | FromDiscord | <Elegantbeef> The only way to install it is to disregard your antivirus and say "I'm the boss" |
00:27:35 | FromDiscord | <nqeron> would you recommend using choosenim over trying to force the main download to work? |
00:30:21 | FromDiscord | <nqeron> ok - it seems to have created a .nimble directory, but not a bin subdirectory? |
00:30:55 | FromDiscord | <Elegantbeef> Choosenim and friends are the best way to install languages |
00:31:42 | FromDiscord | <Elegantbeef> Might be antivirus stopping it |
00:31:49 | FromDiscord | <Elegantbeef> I dont know though, dont use windows |
00:34:14 | FromDiscord | <nqeron> I used to use a mac as my main development machine, but it's now sluggish and constantly low on memory |
00:45:52 | FromDiscord | <nqeron> Ok - I disabled my antivirus for Nim - that seems to help. |
00:48:54 | FromDiscord | <jtv> AV products tend to make things sluggish and eat memory |
00:51:38 | FromDiscord | <Elegantbeef> They also like to make things not work |
00:52:34 | FromDiscord | <jtv> sent a long message, see http://ix.io/4jab |
01:17:07 | FromDiscord | <@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4jag |
02:23:54 | FromDiscord | <Boston> Group policy disabling windows defender is the best thing you can do for sanity |
02:30:05 | FromDiscord | <Boston> In reply to @auxym "link the c#, maybe": If anyone wants a go at it, please do https://media.discordapp.net/attachments/371759389889003532/1054948847278903316/c_recieve_broadcast.txt |
02:36:41 | FromDiscord | <cia.gov> proper way to walk a directory? |
02:42:15 | FromDiscord | <Gumbercules> https://nim-lang.org/docs/os.html#walkDirRec.i%2Cstring |
02:42:24 | FromDiscord | <cia.gov> thx |
02:42:33 | FromDiscord | <Gumbercules> Yw |
02:43:28 | FromDiscord | <Gumbercules> Non-recursive version also exists above I believe |
02:49:37 | FromDiscord | <auxym> In reply to @Boston "If anyone wants a": ah, so you are trying to receive from a server which is broadcasting? I thought you wanted to write a server |
02:51:16 | FromDiscord | <Boston> In reply to @auxym "ah, so you are": think of it as two clients reading each others messages, its an embedded device that sends udp packets out of its own ethernet port to the broadcast address and the PC connected to that port listens to any packet that isnt from itself |
02:51:50 | FromDiscord | <Boston> theres more to that UDP client class that sends messages to this device, and i have successfully implemented that bit |
03:04:48 | FromDiscord | <auxym> sent a long message, see http://ix.io/4jav |
03:07:05 | FromDiscord | <Boston> Both have their own IP address, the PC's adapter being 192.158.1.1 and the Device IP being 192.168.1.206, both of them send their messages to 192.168.1.255 and both will read any packet that ends up at 192.168.1.255 but through a combination of filtering the sending IP and some unique data contained in the datagram can pick out packets meant for them |
03:08:25 | FromDiscord | <Boston> I have successfully ported the send function in Nim, and i can see in wireshark that the device receives' it and replies correctly however I can not get the reply packet into Nim |
03:08:27 | FromDiscord | <auxym> they are sending to which port though? pretty sure you will have to bind to that port (so as a server, sort of) |
03:09:05 | FromDiscord | <Boston> the PC sends to port 0x11ab and the Device sends to 0x11aa |
03:10:03 | FromDiscord | <auxym> right, so on PC, bind port 0x11aa and listen for stuff from there. as in https://github.com/mashingan/nim-etc/blob/master/udp-server/server.nim |
03:10:12 | FromDiscord | <auxym> sorry, got to go though. good luck |
03:10:18 | FromDiscord | <Boston> Thanks |
03:51:20 | FromDiscord | <albassort> alright so |
03:51:51 | FromDiscord | <albassort> sent a code paste, see https://paste.rs/phy |
03:51:56 | FromDiscord | <albassort> (ocr) |
03:52:35 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#ix=4jay" => "https://paste.rs/1bF" |
03:52:44 | FromDiscord | <Elegantbeef> Linux binaries require atleast the libc they were compiled with |
03:52:52 | FromDiscord | <albassort> which is very strange because... I compiled it on this platform, how could it compile against a newer they were compiled against |
03:53:01 | FromDiscord | <albassort> but it was compiled against its own libc |
03:53:16 | FromDiscord | <Elegantbeef> Well that makes no sense |
03:53:42 | FromDiscord | <albassort> no i didn't how did this happen |
03:53:48 | FromDiscord | <albassort> dang old bash script |
03:56:21 | FromDiscord | <Elegantbeef> So no issue? |
04:15:28 | * | arkurious quit (Quit: Leaving) |
04:22:30 | FromDiscord | <albassort> new issues |
04:22:31 | FromDiscord | <albassort> but not this one |
05:22:36 | * | sagax joined #nim |
06:14:42 | FromDiscord | <array.in.a.matrix> is nim able to use javascript modules from npm? |
06:18:36 | FromDiscord | <array.in.a.matrix> oh i think i need to write wrappers for them |
07:27:28 | FromDiscord | <dizzyliam [they/them]> Is it possible to use sqlite .commands via std/db_sqlite |
07:27:32 | FromDiscord | <dizzyliam [they/them]> (edit) "std/db_sqlite" => "std/db_sqlite?" |
07:28:06 | FromDiscord | <dizzyliam [they/them]> I'm getting syntax errors trying it through `exec` |
07:45:25 | FromDiscord | <Phil> In reply to @karma_corrections "Is it possible to": Stuff like `.tables`? |
07:45:32 | FromDiscord | <Phil> Not to my knowledge |
07:45:53 | FromDiscord | <Phil> `exec` for example is purely for firing SQL |
07:55:41 | * | junaid_ joined #nim |
08:28:15 | * | junaid_ quit (Remote host closed the connection) |
08:33:30 | FromDiscord | <Bung> it seems sugar defined proc will not implicitly convert to closure make it fails to match to proc argument. |
08:33:50 | FromDiscord | <Elegantbeef> It should |
08:34:02 | FromDiscord | <Elegantbeef> Atleast i seen it emitted a `closure` typed proc earlier |
08:34:48 | FromDiscord | <Bung> I've seen two related issues in this situation |
08:35:21 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4jbf |
08:35:40 | FromDiscord | <Bung> the funny thing is they are both hidden in original issue, when origianl solved it comes up. |
08:36:43 | FromDiscord | <Bung> you may try some proc argument passing |
08:37:40 | FromDiscord | <Bung> the original issue am looking in https://github.com/nim-lang/Nim/issues/16541 |
08:40:10 | FromDiscord | <Elegantbeef> Oh this is just Nim generics 'working' |
08:40:25 | FromDiscord | <Elegantbeef> Implicit conversions do not happen to generics |
08:41:20 | FromDiscord | <Elegantbeef> Well the compiletime segfault isnt |
08:42:14 | FromDiscord | <Bung> is it possible "Implicit conversions do not happen to generics" |
08:42:24 | FromDiscord | <Bung> fix that |
08:42:40 | FromDiscord | <Elegantbeef> Well it should be a compile time error |
08:43:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/AMs |
08:44:34 | FromDiscord | <Elegantbeef> I say should just due to the rule that implicit conversions do not happen in the case of ambiguity |
08:45:12 | FromDiscord | <Elegantbeef> It's written somewhere 😄 |
08:45:42 | FromDiscord | <Elegantbeef> I cannot presently find it in the manual so might be a fever dream |
08:47:25 | FromDiscord | <Bung> ok, then I'll make this CT error for now. |
08:56:18 | FromDiscord | <Bung> I know why the two issues are homogeneous, when user want use sugar the same time they want use generic.. |
09:00:14 | FromDiscord | <Bung> `tuple[x: var int]` is invalid I guess ? |
09:02:13 | FromDiscord | <Elegantbeef> Without `views` yes |
09:06:04 | FromDiscord | <Bung> hmm, it didn't mentioned in manual, even view types section |
09:06:27 | FromDiscord | <Bung> in fact , it's first time see that |
09:07:40 | FromDiscord | <Elegantbeef> Well view types allow you to use `var T` as a field of an object |
09:09:16 | FromDiscord | <Bung> is that in manual? for a plain object |
09:11:32 | FromDiscord | <Phil> View type stuff? Best I can find: https://nim-lang.org/docs/manual_experimental.html#view-types |
09:11:42 | FromDiscord | <Elegantbeef> Yes that's them |
09:12:34 | FromDiscord | <Bung> but still I dont see example code like that a object filed type is `var T` |
09:13:13 | FromDiscord | <Elegantbeef> It's valid |
09:16:37 | FromDiscord | <Bung> I guess I need try myself, I even cant find a search result in nim repo |
09:16:55 | FromDiscord | <Elegantbeef> Yea views only really exist as a opt in feature |
09:16:58 | FromDiscord | <Elegantbeef> They're practically unusable |
09:17:13 | FromDiscord | <Elegantbeef> `var T` as a field is just a mutable borrow of memory |
09:18:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4jbn |
09:18:58 | FromDiscord | <Elegantbeef> `var T` and `lent T` in object definitions are just memory safe `ptr T` in theory |
09:19:01 | FromDiscord | <arkanoid> I really wish a page full of examples how to work with generic/typeclasses even in complex scenarios. I'm basically stuck in a loop trying to refactor my generic-based types into something more typeclassy |
09:20:08 | FromDiscord | <Elegantbeef> What's the hitch? |
09:20:33 | FromDiscord | <Bung> hmm, in such case I see it only meaningfully with stricfunc |
09:20:55 | FromDiscord | <Elegantbeef> I dont follow bung? |
09:21:20 | FromDiscord | <Elegantbeef> The entire point of view types is to allow borrowing memory safely instead of using a ptr |
09:21:25 | FromDiscord | <Bung> I mean `data: var int` can just be `data: int` |
09:21:32 | FromDiscord | <Elegantbeef> No it cannot |
09:21:37 | FromDiscord | <Elegantbeef> That wouldnt back propagate to `a` |
09:22:22 | FromDiscord | <Elegantbeef> view types are borrowing memory so `data: var int` is really a `data: ptr int` but safe |
09:22:31 | FromDiscord | <Elegantbeef> It's safe in that the compiler will ensure you do not have dangling pointer |
09:23:29 | FromDiscord | <Bung> hmm, didn't know that , it's complex situation in other language too I think |
09:23:49 | FromDiscord | <Elegantbeef> Views are akin to rust's borrow checker |
09:24:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4jbo |
09:25:05 | FromDiscord | <Elegantbeef> Rust is the most well known language with similar semantics to what view types are to offer |
09:28:29 | FromDiscord | <Bung> I see it changes a , without view type it will not. |
09:29:49 | FromDiscord | <Bung> does it have another name "borrow memory" |
09:30:41 | FromDiscord | <Elegantbeef> Yes |
09:37:45 | FromDiscord | <Bung> that's cool , I was think of that's a pass field by ref or value problem. |
10:08:37 | FromDiscord | <4zv4l> sent a code paste, see https://paste.rs/Yds |
10:19:26 | FromDiscord | <Rika> `cast[proc]` is nonsensical; `cast[proc(): int]` + the calling convention perhaps but i cannot help you with that because i dont know |
10:23:17 | FromDiscord | <amadan> You also need to make sure you are casting a pointer and not some values `cast[proc () {.cdecl.}](addr shellcode[0])()` (Replace the proc type with the correct one) |
10:25:08 | FromDiscord | <Bung> I'd say most time cast to proc wont work. |
10:28:56 | FromDiscord | <4zv4l> In reply to @amadan "You also need to": almost work, I get a segault |
10:29:08 | FromDiscord | <4zv4l> I compiled like this↵`nim c --passC:"-z execstack"` |
10:33:52 | FromDiscord | <Rika> In reply to @Bung "I'd say most time": most likely, yes |
10:35:10 | FromDiscord | <4zv4l> why not ? |
11:21:40 | FromDiscord | <cia.gov> is there a way to list all the processes on my windows computer using nim. i found an article but all it does is list all the PIDs, and i need the names. |
11:22:04 | FromDiscord | <cia.gov> (edit) "is there a way to list all the processes on my windows computer using nim. i found an article but all it does is list all the PIDs, and i need the names. ... " added "https://forum.nim-lang.org/t/5390" |
11:23:20 | FromDiscord | <Phil> That software targetted at only unix or only windows? |
11:24:23 | FromDiscord | <cia.gov> mine or the one in the article? |
11:25:27 | FromDiscord | <Bung> cia try psutils package |
11:25:32 | FromDiscord | <Phil> Yours, as I'm semi-sure the OS-api's to get that kind of information differ between linux and windows and I don't see any nim-lib providing it, so you're likely either wrapping a C-lib to do this or interacting with the shell |
11:26:43 | FromDiscord | <Phil> In reply to @Bung "cia try psutils": you mean posix_utils? |
11:27:20 | FromDiscord | <cia.gov> In reply to @Isofruit "Yours, as I'm semi-sure": well yes it does differ, im just looking on how to do it in windows. |
11:27:35 | FromDiscord | <4zv4l> any equivalent or wrapper around this in Nim ?↵https://man7.org/linux/man-pages/man2/mprotect.2.html |
11:28:33 | FromDiscord | <Phil> In reply to @cia.gov "well yes it does": Bung's suggestion was pretty good, psutil-nim has the solution for you:↵https://github.com/juancarlospaco/psutil-nim/blob/master/doc/windows/functions/pid_name.md |
11:29:05 | * | alice quit (Ping timeout: 260 seconds) |
11:29:13 | FromDiscord | <Phil> Basically I think it makes sense to skim through python's psutil docs and then use whatever you find there with psutil-nim as that module appears to be a direct port |
11:29:30 | FromDiscord | <Bung> https://github.com/johnscillieri/psutil-nim |
11:29:52 | FromDiscord | <Bung> the original one which contains my contribution |
11:30:39 | FromDiscord | <Phil> Ah, yeah good point, didn't notice that the juancarlospaco one was a fork |
11:30:46 | * | jmcantrell quit (Ping timeout: 265 seconds) |
11:31:31 | FromDiscord | <cia.gov> https://media.discordapp.net/attachments/371759389889003532/1055085103098908674/image.png |
11:32:54 | FromDiscord | <Bung> nim version and os ? |
11:33:21 | FromDiscord | <cia.gov> `Nim Compiler Version 1.6.10 [MacOSX: amd64]` |
11:33:25 | FromDiscord | <chri> but int is not int32 as from as i remember |
11:34:59 | FromDiscord | <Bung> sadly, mac support added by me is two years ago |
11:35:38 | FromDiscord | <cia.gov> sent a code paste, see https://play.nim-lang.org/#ix=4jbV |
11:35:46 | FromDiscord | <cia.gov> with adding a `.int` to the end of the function calls |
11:36:12 | FromDiscord | <Bung> so create a PR |
11:36:22 | * | alice joined #nim |
11:36:34 | FromDiscord | <Phil> In reply to @cia.gov "ive fixed it by": int by default is plattform dependant, but given that any computer nowadays is 64 bit based int by default tends to be int64 |
11:36:55 | FromDiscord | <Phil> And you get no auto-conversion from int32 to int64 (and thus none from int32 to int) |
11:37:01 | FromDiscord | <Bung> no, don't do that |
11:37:54 | FromDiscord | <Phil> In reply to @Bung "no, don't do that": What would be the detrimental effect? At worst he wastes 4 bytes converting from int32 to int64 |
11:39:19 | FromDiscord | <Bung> int on 16bit os will match int16 |
11:39:45 | FromDiscord | <Phil> In that case he wastes 48 bit = 6 byte, also not a big deal |
11:39:48 | FromDiscord | <cia.gov> In reply to @Bung "sadly, mac support added": sadly `pid_name` doesn't work on mac either |
11:40:21 | FromDiscord | <Bung> so another PR |
11:40:42 | FromDiscord | <cia.gov> i couldn't be asked to make a PR |
11:42:50 | FromDiscord | <Bung> just a suggestion |
11:44:43 | FromDiscord | <cia.gov> i know, if i ever actually add the features i need, ill make a PR but for now im gonna set this part of my code aside |
11:44:49 | FromDiscord | <cia.gov> as its not needed |
11:45:12 | * | jmcantrell joined #nim |
11:47:24 | FromDiscord | <kaddkaka> sent a code paste, see https://paste.rs/0dJ |
11:48:46 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/uPg |
11:48:53 | FromDiscord | <kaddkaka> yes |
11:49:38 | FromDiscord | <Phil> Ohhhh wait, so you have "up, left, right, down" and for each of those you want to call count and then multiply that together |
11:49:48 | FromDiscord | <kaddkaka> yes |
11:50:42 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jbW |
11:50:53 | FromDiscord | <Phil> That'd be how I'd do it |
11:51:08 | FromDiscord | <Phil> If you're performance sensitive you'd do it in a normal for-loop: |
11:51:43 | FromDiscord | <kaddkaka> oh mapIt, great, yeah or use zerofunctional as pointed yesterday I guess 😉 |
11:51:55 | FromDiscord | <kaddkaka> (edit) "oh mapIt, great, yeah or use zerofunctional as pointed ... yesterday" added "out" |
11:52:02 | FromDiscord | <kaddkaka> (https://github.com/zero-functional/zero-functional) |
11:52:59 | FromDiscord | <Phil> In reply to @kaddkaka "oh mapIt, great, yeah": I don't write that much functional and even more rarely do I need to chain the operators so `std/sequtils` typically doesn't bother me 😛 |
11:53:40 | FromDiscord | <Phil> And I was actually not around when zero-functional got dropped, assuming it got mentioned somewhere yesterday |
11:53:45 | FromDiscord | <kaddkaka> I feel the code gets much more succinct and to the point |
11:53:48 | FromDiscord | <Phil> But good to know! |
11:54:23 | FromDiscord | <kaddkaka> It would be cool if Nims standard library could optimize in the same way as that library in the future 🙂 |
11:54:37 | FromDiscord | <Phil> In reply to @kaddkaka "I feel the code": You won't find me disagreeing, it also gets more correct / forbids ways to do things wrongly, just didn't have a usecase that required more than 1 operator at a time, or the 1-2 times where I did have to the performance implications were irrelevant |
11:55:02 | FromDiscord | <kaddkaka> 👍 |
11:55:28 | FromDiscord | <Phil> The good ol case of "sequtils is good enough for me" ^^ |
11:58:19 | FromDiscord | <kaddkaka> I guess there is also the collect macro, but I dont really get it 😛 https://nim-lang.org/docs/sugar.html#collect.m%2Cuntyped%2Cuntyped |
11:58:54 | FromDiscord | <kaddkaka> or rather |
11:58:58 | FromDiscord | <kaddkaka> it's not very pretty |
11:59:01 | FromDiscord | <Phil> In reply to @kaddkaka "I guess there is": That's a minor convenience way of writing bog standard for-loops and not having to instantiate a seq[int] variable and adding to it |
11:59:11 | FromDiscord | <Phil> And yeah, not that easily readable in my eyes either |
11:59:49 | FromDiscord | <Phil> I can imagine it being pretty useful if you have to do fairly complex scenarios where you'd need to otherwise chain 4+ functional operators together |
12:00:05 | FromDiscord | <Phil> And don't want to add the zero-functional package as dependency |
12:01:26 | FromDiscord | <4zv4l> how can I get the page start address of a variable ? |
12:01:36 | FromDiscord | <4zv4l> so I can use `mprotect` on it |
12:05:04 | FromDiscord | <Phil> In reply to @4zv4l "how can I get": I have no idea of anything when it comes to memory layout but Vindaar explained some hacky magic to me once on an unrelated topic that does play around with memory layout and mprotect so maybe that can help you:↵https://discord.com/channels/371759389889003530/371759607934353448/1054033069826392104 |
12:08:18 | FromDiscord | <4zv4l> thanks a lot ! |
12:08:39 | FromDiscord | <4zv4l> can you show me how you imported the mprotect function and constants ? because I'm not quite sure I did it the best way |
12:08:54 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4jc1 |
12:10:38 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=4jc2 |
12:11:40 | FromDiscord | <Phil> In reply to @4zv4l "thanks a lot !": I was actually not the one writing that, I was copy-pasting the code that vindaar wrote to refer to them as I asked questions line by line |
12:12:00 | FromDiscord | <Phil> But I'm like 30% certain mprotect is in posx_utils |
12:12:38 | FromDiscord | <Phil> In reply to @4zv4l "can you show me": Yep, std/posix it is: https://nim-lang.org/docs/posix.html |
12:12:50 | FromDiscord | <Phil> https://nim-lang.org/docs/posix.html#mprotect%2Cpointer%2Cint%2Ccint |
12:13:14 | FromDiscord | <Phil> If that doesn't suit your needs, then the way it's done there can just be copy pasted as well |
12:13:28 | FromDiscord | <Phil> (edit) "it's" => "of importing that is" |
12:13:58 | FromDiscord | <4zv4l> thanks it seems to be almost good |
12:14:31 | FromDiscord | <Phil> In reply to @kaddkaka "So my first usage": I mean, it beats having to have a `var x: seq[sth] = @[]` before the let call |
12:14:32 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4jc3 |
12:14:51 | FromDiscord | <Phil> Erm... Beeeeef? |
12:15:20 | FromDiscord | <Phil> (edit) "In reply to @kaddkaka "So my first usage": I mean, it beats having to have a `var x: seq[sth] = @[]` before the let call ... " added "and an `x.add line` inside the loop" |
12:15:27 | FromDiscord | <Rika> In reply to @kaddkaka "So my first usage": Couldn’t you just directly toSeq the lines iterator |
12:16:49 | FromDiscord | <kaddkaka> In reply to @Rika "Couldn’t you just directly": seems like an idea! |
12:17:17 | FromDiscord | <Phil> Wait, I thought that was a demonstrative question that the collect macro in use looks clunky, that was an actual one?↵My bad |
12:17:50 | FromDiscord | <kaddkaka> cool, I didnt know about that! `let map: Map = toSeq(lines("input"))` |
12:18:35 | FromDiscord | <Phil> I'm partial to object call syntax so if it works I'd likely go for `lines("input").toSeq()` |
12:18:48 | FromDiscord | <kaddkaka> I mix a lot |
12:18:51 | FromDiscord | <Phil> Fair |
12:19:07 | FromDiscord | <kaddkaka> Too beginner to have settled an opinion perhaps 😛 |
12:20:03 | FromDiscord | <4zv4l> In reply to @amadan "You also need to": oui sure about that one ? |
12:20:14 | FromDiscord | <Phil> Being a beginner never stopped me on having strong opinions, only made it easier to adjust them later after learning more xP |
12:20:19 | FromDiscord | <kaddkaka> `lines("input").toSeq()` arguably beats ` toSeq(lines("input"))` because the distance between the farthest `(``)` pair is shorted |
12:20:25 | FromDiscord | <4zv4l> (edit) "oui" => "you" |
12:20:29 | FromDiscord | <amadan> In reply to @4zv4l "you sure about that": the proc signature? no |
12:20:30 | FromDiscord | <kaddkaka> (edit) "shorted" => "shorter" |
12:20:37 | FromDiscord | <4zv4l> the addr of shellcode array |
12:20:51 | FromDiscord | <Rika> Looks correct to me |
12:20:56 | FromDiscord | <amadan> oh, that I'm kinda sure about |
12:21:05 | FromDiscord | <4zv4l> I get this when using that |
12:21:06 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4jc5 |
12:21:10 | FromDiscord | <Phil> In reply to @kaddkaka "`lines("input").toSeq()` arguably beats `": I'd argue the `lines("input").toSeq()`follows the order of your thoughts better. Get the lines from input, then turn it into a seq, done |
12:21:56 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4jc6 |
12:22:07 | FromDiscord | <amadan> sent a code paste, see https://play.nim-lang.org/#ix=4jc7 |
12:22:24 | FromDiscord | <amadan> So Nim is putting the array directly there (so it becomes an r value) |
12:23:43 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4jc8 |
12:23:43 | FromDiscord | <4zv4l> even with the mprotect |
12:25:19 | FromDiscord | <amadan> Where did you find the shellcode from? iirc it needs to be written for your specific CPU (segfaults for me also though) |
12:25:46 | FromDiscord | <4zv4l> it's a correct shellcode, I made it works in C and Zig |
12:25:59 | FromDiscord | <4zv4l> for example |
12:26:05 | FromDiscord | <4zv4l> this is the zig code |
12:26:06 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4jca |
12:28:03 | FromDiscord | <4zv4l> and with gdb the pointers it gives me isn't the pointer to the shellcode at all |
12:28:16 | FromDiscord | <4zv4l> while with zig when it segault before, it showed me the addr of the shellcode |
12:32:21 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=4jcd |
12:32:36 | FromDiscord | <4zv4l> the actual return is int32 |
12:32:51 | FromDiscord | <4zv4l> I put u8 in zig because main cannot returns a i32 |
12:33:32 | FromDiscord | <4zv4l> it can only be a pointer issue |
12:33:51 | FromDiscord | <4zv4l> either the pointer to the mprotect isn't right (the page pointer)↵either the shell_code pointer isn't right |
12:33:58 | FromDiscord | <4zv4l> and from what I see I think both are wrong |
12:34:27 | FromDiscord | <4zv4l> https://media.discordapp.net/attachments/371759389889003532/1055100940354588812/image.png |
12:34:28 | FromDiscord | <4zv4l> this isn't my shellcode |
12:35:26 | FromDiscord | <4zv4l> this in other hand (with zig) is my shellcode https://media.discordapp.net/attachments/371759389889003532/1055101186614767677/image.png |
12:36:50 | FromDiscord | <Rika> Set a break point before the call and check the value of the pointer |
12:37:21 | FromDiscord | <Rika> The call is perhaps working but maybe the contents is causing the fault |
12:43:42 | FromDiscord | <Gumbercules> @4zv4l you're also doing an `alignCast` in your zig code |
12:43:59 | * | jmdaemon quit (Ping timeout: 260 seconds) |
12:44:04 | FromDiscord | <Gumbercules> to get the pointer to pass to `mprotect` |
12:44:25 | FromDiscord | <Rika> I think that is equivalent to the and not calculation he does with the page variable |
12:45:54 | NimEventer | New thread by evad: Windows Defender detected Trojan.AndroidOS/Multiverze in Nim-1.6.10_64.zip, see https://forum.nim-lang.org/t/9744 |
12:46:33 | FromDiscord | <Gumbercules> gotcha |
12:47:16 | FromDiscord | <kaddkaka> How do the equivalent of applying `allIt` to an iterator? `toSeq` doesn't feel right |
12:49:52 | FromDiscord | <4zv4l> In reply to @Rika "The call is perhaps": wdym ? |
12:49:57 | FromDiscord | <4zv4l> the zig code works with the mprotect |
12:50:05 | FromDiscord | <4zv4l> in the Nim code, the call doesn't work |
12:50:11 | FromDiscord | <4zv4l> the pointer isn't right |
12:50:21 | FromDiscord | <4zv4l> or gdb should show me what's at that memory address |
12:58:15 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=4jch |
12:58:46 | FromDiscord | <kaddkaka> But inserting a `toSeq` solves it. 🤔 |
13:00:51 | FromDiscord | <vindaar> that's because `allIt` only works on actual collections and not iterators |
13:01:17 | FromDiscord | <vindaar> (imo sequtils needs a big overhaul) |
13:13:14 | * | PMunch joined #nim |
13:40:06 | FromDiscord | <albassort> so is nim suggest just totally broken on 1.9.1 |
13:40:22 | FromDiscord | <albassort> https://media.discordapp.net/attachments/371759389889003532/1055117526310334534/image.png |
13:40:30 | FromDiscord | <albassort> compiles fine |
13:40:38 | FromDiscord | <albassort> but nimsuggest don't like it |
13:40:51 | * | Phytolizer joined #nim |
13:42:24 | Amun-Ra | what's up with that weird indent? |
13:42:36 | Amun-Ra | ah, nvm, I'm blind |
13:44:39 | Amun-Ra | what does nimsuggest say? |
13:45:19 | FromDiscord | <albassort> template of construct |
13:57:00 | * | oddish joined #nim |
13:58:33 | * | oddish quit (Client Quit) |
13:59:55 | FromDiscord | <albassort> oh i see |
13:59:58 | FromDiscord | <albassort> its giving me runtime errors |
14:00:07 | FromDiscord | <albassort> interesting |
14:00:22 | FromDiscord | <albassort> good job? |
14:00:40 | FromDiscord | <albassort> does't give me any errors tho |
14:00:48 | FromDiscord | <albassort> (edit) "tho" => "tho, just says its broken" |
14:00:55 | FromDiscord | <albassort> so i gotta run it to see the actual problem |
14:01:07 | FromDiscord | <albassort> in this case, nimyal broke |
14:01:12 | FromDiscord | <albassort> (edit) "nimyal" => "nimyaml" |
14:05:28 | FromDiscord | <kaddkaka> `incl` of `hashset` was hard to find 🙈 https://nim-lang.org/docs/sets.html |
14:21:13 | NimEventer | New Nimble package! ttop - Monitoring tool with historical snapshots, see https://github.com/inv2004/ttop |
14:28:23 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=4jcG |
14:29:39 | PMunch | @kaddkaka, `var rope = newSeq[Pos](10)` |
14:29:50 | PMunch | And what do you mean incl was hard to find? |
14:31:09 | FromDiscord | <kaddkaka> In reply to @PMunch "<@185793553539137537>, `var rope =": It was not in the top example, and I was searching for `add` and `push` |
14:31:52 | FromDiscord | <kaddkaka> so it took me a while to find `incl` |
14:33:05 | PMunch | Aah I see |
14:34:32 | FromDiscord | <kaddkaka> Btw, is there a way to give an "extra name" to a variable? Something like a reference to the last entry in a seq: `let p: ptr Pos = rope[^1]` |
14:37:01 | PMunch | `template last = rope[^1]` |
14:37:27 | FromDiscord | <leorize> don't forget `: untyped` |
14:37:44 | FromDiscord | <kaddkaka> hmm? do I need an untyped for that template? |
14:38:04 | PMunch | Ah, I was just in the playground testing if it needed the :untyped :P |
14:38:25 | FromDiscord | <leorize> yes, you need a return type if you want to use the expression |
14:39:03 | PMunch | Otherwise Nim complains that `rope[^1]` has to be used or discarded |
14:39:23 | PMunch | You could of course use `: Pos` instead |
14:39:36 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=4jcP |
14:41:05 | FromDiscord | <kaddkaka> it's a bit verbose, but works I guess. perhaps I could create some template/macro to shorten it into something like: `head := rope[0]` or `head aliases rope[0]` |
14:42:01 | PMunch | I was just about to say that if you do this a lot you could of course define a simple template for it: https://play.nim-lang.org/#ix=4jcQ |
14:56:38 | * | Phytolizer quit (Ping timeout: 260 seconds) |
14:58:52 | FromDiscord | <Phil> Wait, why wouldn't a proc work? |
15:01:10 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jd1 |
15:01:34 | FromDiscord | <Phil> Actually, you can even make those funcs |
15:01:49 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4jd1" => "https://play.nim-lang.org/#ix=4jd2" |
15:04:32 | FromDiscord | <Rika> In reply to @kaddkaka "Btw, is there a": they wanted specifically something without referencing rope or parens |
15:04:34 | FromDiscord | <Rika> (edit) "In reply to @kaddkaka "Btw, is there a": they wanted specifically something without referencing rope or ... parens" added "without" |
15:04:43 | FromDiscord | <Rika> (edit) "or" => "and" |
15:07:44 | FromDiscord | <Phil> Ah, without possibly making a copy, okay that would be likely a fair bit harder with a generic when you can do it with just a template to substitute the code |
15:23:27 | FromDiscord | <Yandall> @Phil I made something https://media.discordapp.net/attachments/371759389889003532/1055143468403535954/image.png |
15:26:53 | FromDiscord | <Phil> Okay that is slick |
15:27:16 | FromDiscord | <Phil> I assume when you tested for p you can enter any kind of querySelector-string ? |
15:27:21 | FromDiscord | <Phil> (edit) "querySelector-string" => "css-selector-string" |
15:27:30 | FromDiscord | <Yandall> Yes, |
15:27:48 | FromDiscord | <Yandall> (edit) "Yes, ... " added "I use nimquery for that" |
15:29:44 | FromDiscord | <Phil> Now the big question is: Did you use templates or procs for this?↵I'm mostly asking because test-suites at least for me always behaved funky when `check` wasn't used inside of the template itself (that's why I suggested templates for this)↵Basically, what does the printed output of that test-suite look like? |
15:30:29 | FromDiscord | <Yandall> https://media.discordapp.net/attachments/371759389889003532/1055145239788146788/image.png |
15:30:45 | FromDiscord | <Yandall> I used templates for all the checks |
15:30:50 | FromDiscord | <Phil> Sweet! |
15:32:33 | FromDiscord | <Phil> Generally I really like the syntax, let me think if I can think of anything else that would make sense in the package, but generally this is definitely good enough to publish.↵Depending on how much frill you want to add surrounding this I can help guide you through, since I had to do something similar not too long ago |
15:33:05 | FromDiscord | <Phil> Frill being:↵- Docs↵- Pipeline that auto-publishes doc to github pages↵- Pipeline that auto-runs test-suite on changes |
15:33:41 | FromDiscord | <Yandall> Those pipelines would be great |
15:33:42 | FromDiscord | <Phil> But imo this can get by with just a small reference what procs are all available and publishing to nimble |
15:34:19 | FromDiscord | <Phil> In that case give me a bit to get off work, sadly this won't be all that straightforward since I also had to copy quite a bit and imo CI/CD pipelines are always enormously painful |
15:34:55 | FromDiscord | <Phil> (edit) "In that case give me a bit to get off work, sadly this won't be all that straightforward since I also had to copy quite a bit and imo CI/CD pipelines are always enormously painful ... " added "to set up" |
15:35:03 | FromDiscord | <Phil> But so worth it in the long-term |
15:35:22 | FromDiscord | <Yandall> Right, I'll just finish writing the docs for this |
15:35:50 | FromDiscord | <Phil> In terms of documentation I think it suffices to just throw quick `##` doc comments underneath each proc, doesn't have to be too complicated |
15:36:04 | FromDiscord | <Phil> If you feel really invested you can add runnable examples |
15:36:29 | FromDiscord | <Phil> Those have the benefit that when you later use nims doc-tools, they'll be made part of the documentation |
15:36:49 | FromDiscord | <Yandall> I'll do that to some procs just for fun |
15:38:22 | FromDiscord | <Phil> In reply to @Yandall "I'll do that to": https://nim-lang.org/docs/system.html#runnableExamples%2Cstring%2Cuntyped↵Here some docs around runnable examples |
15:38:40 | FromDiscord | <Yandall> Thanks |
16:27:04 | FromDiscord | <Phil> In reply to @Yandall "Thanks": Alrighty, finally off.↵First thing you may want to do is write a simple command that generates docs for you as that's what can be used by the pipeline later and just generally makes your life easier |
16:27:56 | FromDiscord | <Phil> A nice mechanism to do so is nimble tasks.↵You may have noticed that there are nimble files.↵Well you can define tasks in them using nim-code that will run and can be executed via `nimble <TaskName>`. |
16:29:07 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jdl |
16:30:33 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jdm |
16:30:58 | FromDiscord | <Phil> `exec` in this context basically just executes whatever string you provide it in a shell |
16:31:22 | FromDiscord | <Phil> so `exec "echo lala"` is the same as typing `echo lala` in a bash shell |
16:36:44 | FromDiscord | <Phil> Luckily you won't need to do anything like that for your tests, as that `nimble test` already exists by default (In some cases such as web-applications you'll have to plug your own in there because your test-setup is likely more involved and may require specific flags etc., but you don't have to worry about that for now) |
16:36:55 | FromDiscord | <Phil> (edit) removed "that" |
16:38:10 | FromDiscord | <Yandall> In reply to @Isofruit "For you that could": What does the --git option? |
16:38:13 | FromDiscord | <Phil> If you want examples for all the kinds of things that nimble files can looks like, here 2 examples:↵https://github.com/planety/prologue/blob/devel/prologue.nimble↵https://github.com/PhilippMDoerner/Snorlogue/blob/main/snorlogue.nimble |
16:39:05 | FromDiscord | <Yandall> (edit) "option?" => "option do?" |
16:41:22 | FromDiscord | <Phil> In reply to @Yandall "What does the --git": If you looked at nim docs you may have seen a "see source" grey hyperlink here and there, that option is used to generate the hyperlinks |
16:41:23 | FromDiscord | <Phil> See https://nim-lang.org/docs/docgen.html#related-options-see-source-switch |
16:42:36 | FromDiscord | <Yandall> Ohh so that what is does |
16:42:45 | FromDiscord | <Yandall> Very cool |
16:44:36 | FromDiscord | <Phil> Alrighty, once you got the task down (feel free to try it out and open the docs in your browser, should work well enough. Don't commit the docs themselves though, you want github to take care of that). |
16:44:55 | FromDiscord | <Phil> (edit) "(feel" => "we can continue.↵Feel" | "that)." => "that." |
16:47:10 | FromDiscord | <Phil> (Sidenote for everybody else: I happily take corrections on anything I'm writing here, I'm not insanely knowledgeable about the setup either, I've just done it once or twice) |
16:49:38 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jdt |
16:50:01 | FromDiscord | <Phil> This will generate a link in the docs where "FormField" will be a clickable hyperlink that'll automatically jump you to the definition of FormField on the page |
16:50:46 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jdv |
16:51:40 | * | pro joined #nim |
16:52:20 | * | pro left #nim (#nim) |
16:54:09 | FromDiscord | <Phil> Got the docs down so far? |
16:55:13 | FromDiscord | <Yandall> Right now I'm a little busy, but I'll write you when I get it |
16:56:25 | FromDiscord | <Phil> We can split this over time no problem, it's a fair bit as you'll also need to define a dockerfile, a docker-compose file and then a couple workflow files for github |
16:56:43 | FromDiscord | <Phil> So we can do this step by step |
16:59:00 | FromDiscord | <Phil> I think I may just write that down as we go along.↵I don't have a blog myself, but I'm sure somebody here would be willing to publish it somewhere |
16:59:09 | FromDiscord | <Phil> IIRC at least beef, ringabout and demo have blogs |
17:28:20 | FromDiscord | <Boston> @auxym from our conversation earlier, which net recv proc do you think I should be using |
17:58:31 | FromDiscord | <auxym> In reply to @Boston "<@882793909246369864> from our conversation": they are all mostly equivalent I think? The easiest is probably this one: https://nim-lang.org/docs/net.html#recv%2CSocket%2Cint%2Cint |
17:58:51 | * | wallabra quit (Ping timeout: 260 seconds) |
18:06:59 | FromDiscord | <Hoss> How are folks doing networking with nim? ZMQ? Is there a popular web server or library for building web apps? Something that could take advantage of running the same code in js? |
18:10:03 | * | wallabra joined #nim |
18:13:19 | FromDiscord | <Phil> sent a long message, see https://paste.rs/PeT |
18:13:33 | FromDiscord | <Phil> (edit) "https://paste.rs/7Kd" => "https://paste.rs/Km2" |
18:13:47 | FromDiscord | <Phil> Popular webservers are httpbeast (for windows: Httpx, it's a fork) and asynchttp and I honestly don't know any others |
18:14:01 | FromDiscord | <Phil> I only know those two because prologue allows their use |
18:14:15 | FromDiscord | <Phil> As for networking, good question, haven't looked into that yet |
18:14:42 | FromDiscord | <Phil> Apparently there's an asyncrabbitmq package |
18:17:51 | Amun-Ra | is an object returned from function malloced? |
18:20:11 | FromDiscord | <Hoss> Thanks Phil. Any idea how concurrency works with these? Is there any lightweight concurrency mechanism or do people use “OS” threads? |
18:23:24 | FromDiscord | <willyboar> There are more web frameworks but that @Phil mention is the most popular. There also: phoon, akane, basolato, rosencrantz and scorper. Also for servers there is also guildestern and zfcore ( I think this is the right name) but the last I never test it. |
18:24:56 | FromDiscord | <willyboar> There is also whip but is broken after nim or httpbeast latest release |
18:34:36 | FromDiscord | <Hoss> Seems like most things use httpbeast? |
18:51:14 | FromDiscord | <willyboar> Nope! Akane, rosencrantz and phoon use std/asynchttpserver |
18:51:53 | FromDiscord | <willyboar> Scorper use its own if I remember right |
18:55:02 | FromDiscord | <willyboar> You can check some of them in this basic benchmark: https://github.com/the-benchmarker/web-frameworks |
19:16:00 | FromDiscord | <Phil> Mandatory disclaimer that benchmarks are to be taken with a GINORMOUS amount of salt and are 99% of the time completely worthless |
19:19:09 | NimEventer | New thread by samdze: Create a ref to a C allocated object to manage its memory, see https://forum.nim-lang.org/t/9745 |
19:27:25 | FromDiscord | <nqeron> Is there a way to create a type that resolves to one of two types? |
19:28:39 | FromDiscord | <exelotl> You can do like↵type Something = Foo | Bar |
19:29:29 | FromDiscord | <nqeron> I think I tried that, but when I use that type in another type, e.g. type G = (P, Something), I was having issues |
19:30:08 | FromDiscord | <nqeron> well, technically I'm using a named tuple |
19:31:30 | FromDiscord | <exelotl> Ah right, to use a typeclass in another type the only way is to do it as a generic constraint |
19:31:39 | FromDiscord | <exelotl> Ah sorry g2g |
20:17:30 | * | blackbeard420 quit (Quit: ZNC 1.8.2 - https://znc.in) |
20:19:12 | FromDiscord | <willyboar> In reply to @Isofruit "*Mandatory disclaimer that benchmarks": True but it is nice to see all this frameworks together. Also examples are a nice resource to start. |
20:25:20 | FromDiscord | <narimiran> Quick question for `choosenim` users:↵↵Does `choosenim "#version-2-0"` work for you? |
20:40:15 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=4je8 |
20:40:38 | FromDiscord | <narimiran> In reply to @auxym "On W10, build fails": Thanks! |
20:50:10 | * | jmdaemon joined #nim |
20:53:06 | FromDiscord | <geekrelief> is it possible to run a nimble task with the same name as one of the builtin commands? I'm on devel and trying to run `nimble setup` seems to run the nimble command instead of the nimble task from https://github.com/jmgomez/NimForUE/blob/c0f154d2b664eeac1023e50ab1afd32b1f8b9e59/NimForUE.nimble#L19 The weird thing is that for most others they're able to run the task. |
20:55:35 | * | LuxuryMode joined #nim |
21:03:25 | NimEventer | New thread by miran: Nim version 2.0 RC1, see https://forum.nim-lang.org/t/9746 |
21:05:37 | FromDiscord | <Hoss> good day to start learning about Nim I guess! |
21:12:29 | FromDiscord | <nqeron> Is there a way to create a default constructor for a generic type. e.g. if I have ` type Some[N: int] = array[N, array[N, int]] `, how could I call default(Some[N])? |
21:31:33 | FromDiscord | <federico3> the database clients have been moved out of the stdlib?! \:( |
21:33:24 | FromDiscord | <Yepoleb> Yeah, not too long ago |
21:37:19 | FromDiscord | <federico3> a bundle of Nimble libraries shipped as an extension to the compiler would really help |
21:46:25 | FromDiscord | <treeform> I don't see it as a problem, its so easy to install libs |
21:51:42 | FromDiscord | <Phil> How is it regarding the docs? Are they still hosted and accessible on the general nim lib page? |
21:55:14 | FromDiscord | <Elegantbeef> Nope they're no longer in the stdlib 😄 |
21:55:52 | FromDiscord | <Elegantbeef> In theory the docs could be hosted on the nim website but I dont know if they will be |
21:56:10 | FromDiscord | <Phil> That sucks a whole lot of balls |
21:56:38 | FromDiscord | <Elegantbeef> Well the nimble.directory is supposed to generate docs |
21:57:53 | PMunch | @federico3, it should be easy enough to create a meta-package which just requires a bunch of packages for a "Nimble standard library" kind of thing |
21:58:03 | FromDiscord | <Elegantbeef> Treeform's also got nimdocs though it's opt-in n an author basis |
21:58:04 | PMunch | I've done that in the past for docker containers |
21:58:33 | FromDiscord | <Elegantbeef> I very much think the stdlib should be it's own package |
21:58:37 | PMunch | And there has been some talk about making Nimble documentation more easily accessible on the main site |
21:58:42 | FromDiscord | <Elegantbeef> So it can develop without the language |
22:00:52 | PMunch | I would really like to make a push for removing HTML generation of documentation, so the compiler only spits out JSON. And then ship a nim-doc tool which can generate the standard HTML. That would make it very easy to add new documentation targets because you're ensured that all the stuff in the HTML documentation would be accessibly through the JSON documentation. And it would be a lot easier to consume this documentation into e.g. a database for some "Nim |
22:00:52 | PMunch | documentation website" |
22:01:33 | FromDiscord | <willyboar> In reply to @Elegantbeef "I very much think": I've only see gleam do that |
22:01:57 | PMunch | My initial goal when I first started looking at the Nim jsondoc target was exactly that. Create a Nim documentation website which allowed more features, better searching, and the ability to supply comments similar to the Clojure documentation |
22:02:13 | PMunch | Those comments where incredibly helpful when I first started out learning Clojure |
22:02:18 | FromDiscord | <Elegantbeef> I'm simple the Nim doc generator is fine for me |
22:02:38 | PMunch | It's fine, but it could be so much better |
22:03:12 | FromDiscord | <albassort> @Rika you do somethin with your hair? |
22:03:14 | FromDiscord | <willyboar> Agree with pmunch |
22:04:28 | FromDiscord | <willyboar> It would be easy to have different doc gens and choose what suites best for you |
22:06:08 | FromDiscord | <gcao> sent a code paste, see https://paste.rs/Tgk |
22:06:13 | FromDiscord | <albassort> nah |
22:06:21 | FromDiscord | <Elegantbeef> Yes |
22:06:23 | FromDiscord | <Phil> Instead of splitting out HTML generation from the docs, why not just have generating JSON as an alternative to the current HTML, useable via flag?↵That would require less tooling change, while at the same time enabling 3rd party doc-gen tools |
22:06:27 | FromDiscord | <gcao> (edit) "https://play.nim-lang.org/#ix=4jej" => "https://play.nim-lang.org/#ix=4jei" |
22:06:35 | FromDiscord | <albassort> oh i misreead |
22:06:38 | FromDiscord | <albassort> (edit) "misreead" => "misread" |
22:06:39 | FromDiscord | <Elegantbeef> sleepasync stops the current operation and allows background tasks be done |
22:06:46 | FromDiscord | <albassort> keep in mind it stays on the same cpu |
22:07:31 | FromDiscord | <albassort> so if you're using 100% of the cpu on a complex operation, it wont allow you do really do anything else |
22:07:39 | FromDiscord | <amadan> In reply to @Isofruit "Instead of splitting out": Kinda already do with `jsondoc` command. But it still has html in the description for stuff |
22:07:59 | FromDiscord | <Phil> That just means the current tooling needs a slight refactor |
22:08:08 | FromDiscord | <Phil> Not that you need to swap out the entire process |
22:09:06 | FromDiscord | <albassort> I think something I'd like to see in nim is something akin to interfaces to make callback procedures a litter nicer |
22:09:32 | FromDiscord | <Elegantbeef> There are already multiple solutions to interfaces |
22:09:37 | FromDiscord | <albassort> because currently theres no special mechanism, and it works, but it requires a lot of type fiddling to make sure--- |
22:09:38 | FromDiscord | <Phil> You mean module-wide interfaces? |
22:09:51 | FromDiscord | <albassort> no procedure local |
22:09:55 | FromDiscord | <albassort> like |
22:09:59 | FromDiscord | <Phil> What about concepts? |
22:10:08 | FromDiscord | <Elegantbeef> https://github.com/yglukhov/iface |
22:10:40 | FromDiscord | <Elegantbeef> https://github.com/beef331/traitor |
22:10:44 | FromDiscord | <Phil> What I would love would be module-wide interfaces so I can swap out module files as I need/want them |
22:10:47 | FromDiscord | <albassort> yes but i meant specifically the overwriting part of interfaces |
22:10:52 | FromDiscord | <gcao> For better use of cpu, should sleepAsync be preferred in most cases? if I want to juggle between multiple tasks in the same thread |
22:11:02 | FromDiscord | <Elegantbeef> "Overwriting part of interfaces"? |
22:11:22 | FromDiscord | <albassort> In reply to @gcao "For better use of": Threading shouldn't happen unless absolutely necessarily |
22:11:36 | FromDiscord | <Elegantbeef> We already have modules↵(@Phil) |
22:11:54 | FromDiscord | <albassort> In reply to @Elegantbeef ""Overwriting part of interfaces"?": for example, in a class that implements a interface, you write a function that gets called, that "overwrites" the interfaced method |
22:12:07 | FromDiscord | <albassort> currently you type your paramaters |
22:12:23 | FromDiscord | <Elegantbeef> Most interfaces are static that i know of |
22:12:26 | FromDiscord | <Elegantbeef> So there is no overwritting |
22:12:44 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4jel |
22:12:46 | FromDiscord | <Elegantbeef> They force you to declare a method for a given type and then you can categorise your types to said interface |
22:12:47 | FromDiscord | <albassort> java is a whacky thing beef |
22:13:06 | FromDiscord | <Phil> In reply to @Elegantbeef "We already have modules": Yeah but I deal with database and often enough that I often enough have compile-time switches determining for which DB I'm compiling and I would love to see an error message along the line of "this module does not implement all required procs" instead of "this proc in this completely unrelated module is missing" |
22:13:18 | FromDiscord | <Elegantbeef> So then why not make them?↵(@Phil) |
22:13:28 | FromDiscord | <Phil> (edit) removed "and often" | removed "often enough" |
22:13:52 | FromDiscord | <gcao> even if it's a single-threaded program, I may be writing code to talk to db, socket. I guess async socket, sleep async should be used, just like in Node.js, callback based non-blocking calls are the default |
22:14:01 | FromDiscord | <Phil> In reply to @Elegantbeef "So then why not": Becuase I can't think of how |
22:14:07 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4jem |
22:14:46 | FromDiscord | <Elegantbeef> Well there you go you now have a module interface! |
22:14:51 | FromDiscord | <albassort> sent a code paste, see https://paste.rs/4Ks |
22:14:54 | FromDiscord | <Elegantbeef> Can even turn it into a template |
22:15:11 | FromDiscord | <albassort> im sorry beef but we can do better |
22:15:51 | FromDiscord | <albassort> @Phil so, like, a meta type called "module" which is a collection of procs and templates |
22:16:01 | FromDiscord | <albassort> and you can use that as a parameter |
22:16:10 | FromDiscord | <albassort> thats kinda how my brain imagined it |
22:16:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4jeo |
22:16:35 | FromDiscord | <Elegantbeef> There we go you now can define in your importing module what procedures must be exported in your submodules |
22:16:40 | FromDiscord | <Elegantbeef> Module level interfaces done |
22:17:34 | FromDiscord | <Phil> sent a long message, see https://paste.rs/XCo |
22:17:47 | FromDiscord | <Elegantbeef> Yes |
22:17:59 | FromDiscord | <Elegantbeef> It doesnt even need to export them |
22:18:18 | FromDiscord | <Elegantbeef> You just use `ensureProcExists` after importing |
22:18:26 | FromDiscord | <Elegantbeef> You dont always export the modules you use sometimes you consume them directly |
22:18:35 | FromDiscord | <albassort> :WaltCook: writing nim so disgusting I didn't know you could write it |
22:18:50 | FromDiscord | <albassort> (edit) "writing" => "beef making" | "beef makingnim ... so" added "code" |
22:19:14 | FromDiscord | <Phil> I mean, at times I have had to resort to equally unpretty means |
22:19:27 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/eUB |
22:19:48 | FromDiscord | <albassort> hey guys why did nobody tell me about {.error.} |
22:19:52 | FromDiscord | <albassort> this is bullshit |
22:20:01 | FromDiscord | <albassort> i've been using asserts and raiseassert |
22:20:08 | FromDiscord | <Phil> Nobody told me about the `convert` keyword either |
22:20:16 | FromDiscord | <albassort> what the fuck is that |
22:20:24 | FromDiscord | <Phil> (edit) "`convert`" => "`converter`" |
22:20:28 | FromDiscord | <vindaar> `{.error.}` and `assert` are for CT and RT respectively |
22:20:51 | FromDiscord | <albassort> yea i didn't know about that I've been doing RT Errors |
22:20:57 | FromDiscord | <albassort> (edit) "Errors" => "errors" |
22:20:58 | FromDiscord | <vindaar> (and obv don't serve the same purpose) |
22:21:47 | FromDiscord | <albassort> @Phil explain converter |
22:22:13 | FromDiscord | <Elegantbeef> I mean it doesnt matter that the internals are ugly |
22:22:19 | FromDiscord | <Elegantbeef> As long as we get what we want and it's readable |
22:22:28 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix= |
22:22:31 | FromDiscord | <albassort> o shit |
22:22:43 | FromDiscord | <Phil> Implicit type conversion |
22:22:45 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jep |
22:23:02 | FromDiscord | <Elegantbeef> Do people even read the tutorial/manual ever? |
22:23:06 | FromDiscord | <albassort> I HAVE |
22:23:09 | FromDiscord | <albassort> MANY TIMES |
22:23:23 | FromDiscord | <albassort> https://media.discordapp.net/attachments/371759389889003532/1055249148485570601/image.png |
22:23:28 | FromDiscord | <Phil> you can literally throw a string into a proc expecting an int and nim will implicitly call the converter |
22:23:30 | FromDiscord | <albassort> its mentioned basically never |
22:23:38 | FromDiscord | <albassort> never in the docs, rarely in code |
22:23:46 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1055249243457200228/image.png |
22:23:49 | FromDiscord | <albassort> 16 times on the tutortial |
22:24:03 | FromDiscord | <albassort> https://media.discordapp.net/attachments/371759389889003532/1055249316563910666/image.png |
22:24:15 | FromDiscord | <albassort> of course im not gonna see it |
22:24:34 | FromDiscord | <albassort> for every mention of converter theres 21 mentions of a procedure |
22:24:38 | FromDiscord | <albassort> anyway, L take beef |
22:25:01 | FromDiscord | <Elegantbeef> "L take beef" |
22:25:02 | FromDiscord | <Elegantbeef> What |
22:25:04 | FromDiscord | <Phil> In reply to @Elegantbeef "image.png": 0 times in nim tutorial part 1, 2 and 3.↵There's only a section in the nim manual but I am convinced that manual is more for reference than actual studying |
22:25:27 | FromDiscord | <Elegantbeef> The manual explains a lot |
22:25:41 | FromDiscord | <Phil> take as in "take of a situation", an opinion of something.↵And L as in lose. |
22:26:01 | FromDiscord | <Phil> An "L take" is a Lose/Loser opinion/interpretation of a something |
22:26:18 | FromDiscord | <Elegantbeef> Lol |
22:26:28 | FromDiscord | <auxym> In reply to @narimiran "Quick question for `choosenim`": on my arch linux laptop, the build seems stuck in an infinite loop. it turns my cpu into a heater and never completes |
22:26:34 | FromDiscord | <albassort> I barely remember what concepts are and im still not sure how to properly use them |
22:26:35 | FromDiscord | <Phil> "Take the L" and "Take the W" are in a similar vein |
22:26:54 | FromDiscord | <albassort> im sure i can use them in more places |
22:27:18 | FromDiscord | <Phil> In reply to @albassort "I barely remember what": My code is strictly speaking the perfect breeding ground for concepts given how I use copious amounts of generics basically everywhere |
22:27:30 | FromDiscord | <Phil> Still almost never use em |
22:27:32 | FromDiscord | <Elegantbeef> Sure but those are full sentences↵(@Phil) |
22:27:45 | FromDiscord | <Elegantbeef> I can read full sentences |
22:27:54 | FromDiscord | <Phil> In reply to @Elegantbeef "Sure but those are": So is "Bad opinion Beef" |
22:27:55 | FromDiscord | <albassort> beef hasn't met a zoomer before |
22:28:09 | FromDiscord | <Phil> This times you just add abbreviations to it |
22:28:10 | FromDiscord | <Elegantbeef> You realise i'm technically one right? |
22:28:30 | * | PMunch quit (Quit: leaving) |
22:28:31 | FromDiscord | <albassort> i think of you as more an eldritch concept |
22:28:35 | FromDiscord | <albassort> (edit) removed "" |
22:28:40 | FromDiscord | <albassort> logic itself |
22:28:45 | FromDiscord | <albassort> something that has existed and always will exist |
22:28:48 | FromDiscord | <Phil> Which is the thing I tell everybody never to do because abbreviations are evil and you're guaranteeing that sooner or later somebody will not understand you and make communication harder! |
22:28:56 | FromDiscord | <Elegantbeef> I'm only 23, i just avoid speaking inanely |
22:29:00 | FromDiscord | <Phil> If I see an abbreviation in your code it illicits violent thoughts |
22:29:12 | FromDiscord | <albassort> 4 years is a big age cap |
22:29:21 | FromDiscord | <Phil> Ohhhhh you youngins |
22:29:25 | FromDiscord | <Elegantbeef> Ah you write `newHyperTextTransferProtocolClient`↵(@Phil) |
22:29:38 | FromDiscord | <albassort> when i was playing with my GBA in 2008 you were learning divison or somethin |
22:29:46 | FromDiscord | <Phil> In reply to @Elegantbeef "Ah you write `newHyperTextTransferProtocolClient`": You got me there: Abbreviations that aren't industry standards |
22:30:00 | FromDiscord | <Elegantbeef> Ah so you also write `integer`? 😛 |
22:30:07 | FromDiscord | <albassort> wasn't my gba was my sisters gba |
22:30:22 | FromDiscord | <Elegantbeef> Nah 2008 i was playing on GBA |
22:30:22 | FromDiscord | <Phil> In reply to @Elegantbeef "Ah so you also": That, similarly to "i" for index, are coding industry standards 😛 |
22:30:28 | FromDiscord | <Elegantbeef> Still have my gbasp in front of me |
22:30:29 | FromDiscord | <Phil> GBA wouldn't count for example |
22:30:47 | FromDiscord | <albassort> in my old room i have my gamecube |
22:31:38 | FromDiscord | <Phil> ... the fact I have the SNES I played as a kid on in a box collecting dust somewhere is illiciting strange feelings rn |
22:31:56 | FromDiscord | <Elegantbeef> The snes and nes i had as a kid were sadly sold 😄 |
22:31:57 | FromDiscord | <albassort> hah old man you'll die before transhumanism |
22:31:59 | FromDiscord | <Phil> Though nothing manages to make me feel as old as looking up when LotR was released |
22:32:06 | FromDiscord | <albassort> I may be 90 when it happens |
22:32:48 | FromDiscord | <albassort> my mom sold our nes's when i was a kid |
22:32:56 | FromDiscord | <albassort> (edit) "nes's" => "nes" |
22:33:06 | FromDiscord | <albassort> i wonder where my sisters old apple tower went |
22:33:13 | FromDiscord | <albassort> ...how did she even get that wth |
22:33:17 | FromDiscord | <Elegantbeef> The trash where it belongs! |
22:33:38 | FromDiscord | <Elegantbeef> In summary there you go phil you now have module interfaces, you can praise my supreme intelligence later |
22:34:20 | FromDiscord | <Phil> In reply to @Elegantbeef "In summary there you": ~~By calling for you the next time somebody with a macro question shows up~~ |
22:34:32 | FromDiscord | <Elegantbeef> Hey i dont mind |
22:35:02 | FromDiscord | <albassort> heres what i want |
22:35:41 | FromDiscord | <Phil> In reply to @albassort "heres what i want": A macro course covering 2 dozen examples in detail? |
22:36:08 | FromDiscord | <Elegantbeef> Macros are just so hard to write good tutorials for |
22:36:11 | FromDiscord | <Elegantbeef> There's just so much to worry about |
22:36:28 | FromDiscord | <Elegantbeef> You're literally writing user defined compiler passess |
22:36:40 | FromDiscord | <Phil> I think going through examples one after another is the way to go |
22:37:00 | FromDiscord | <Phil> Showing a lot of ways how you can use them and how they achieve what they want |
22:37:20 | FromDiscord | <Phil> From there those examples can be the basis for your own macros and you can branch out from there |
22:37:30 | FromDiscord | <Phil> (pun intended) |
22:37:53 | FromDiscord | <Elegantbeef> Meh the AST is awful to explain |
22:38:41 | FromDiscord | <Phil> You make a statement, write circles around the individual node-elements, give them names and show how you can mix them around, no? |
22:38:47 | FromDiscord | <Phil> (edit) "write" => "draw" |
22:40:01 | FromDiscord | <Elegantbeef> It's all fine and dandy for untyped ast and how it works |
22:40:08 | FromDiscord | <Elegantbeef> Type ast is where demons lie |
22:40:54 | FromDiscord | <Phil> That can be chapter 2 😛 |
22:41:03 | FromDiscord | <Phil> Or "The advanced chapter for big boy macros" |
23:11:52 | FromDiscord | <@thatrandomperson5-6310e3b26da03> How would i make a lz77 compression algo in nim as described here\: https://en.wikipedia.org/wiki/LZ77_and_LZ78↵Im mainly stumped on how to get the longest reapted occurence and all these values |
23:29:52 | NimEventer | New thread by JohnAD: OpenGPT seems to sort-of work with Nim also., see https://forum.nim-lang.org/t/9747 |
23:30:36 | FromDiscord | <federico3> That still depends on pulling stuff from the Internet using Nimble↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |