<< 18-04-2025 >>

00:15:59FromDiscord<devlop_gaming> In reply to @demotomohiro "Maybe the files you": I took the .lib files from the vc zip file as I was told to do
00:27:41FromDiscord<demotomohiro> In reply to @devlop_gaming "I took the .lib": Are you sure these .lib files are static link libraries, not import libraries?↵On windows, both static link libraries and import libraries have the same extension.↵If you link import libraries, your executable needs dlls.
00:33:55FromDiscord<devlop_gaming> In reply to @demotomohiro "Are you sure these": So what am I rlly supposed to do with the .lib files??
00:35:01FromDiscord<demotomohiro> DLLs and static link libraries are used for long times by C/C++ programs and there are many resources on the internets that explains about them.↵SDL is a library written in C and Nim can use C libraries.↵Nim uses C compiler and linker to link C libraries and produces an executable.↵Learning about DLL/static link libraries and how to use them with C compilers would helps you.
00:35:50FromDiscord<devlop_gaming> I can't today so this is all I can do for now
00:41:52FromDiscord<demotomohiro> If you really need static link libraries, you need to somehow find the static link libraries on the internet built by someone.↵But those static link libraries might be built with C compilers different from the one you use and might not work for you.↵Another way is build static link libraries from source yourself. Most of open source project have readme or some documentations explains how to build from source.
00:44:55FromDiscord<devlop_gaming> Ik how to build from source(only for linux)
01:10:07*derpydoo joined #nim
03:40:54*n|Phreak quit (Ping timeout: 276 seconds)
04:30:08FromDiscord<amadALTuzia> sent a code paste, see https://play.nim-lang.org/#pasty=zgWOyYCo
04:30:56FromDiscord<amadALTuzia> im pretty unconfident about Tags being a ref (but its better than a distinct of for now) but does this look not terrible?
04:31:39FromDiscord<Elegantbeef> It looks ok, why do you need `ref`?
04:32:04FromDiscord<Elegantbeef> If you don't mind sentinel values `@[]` and `""` can be used instead of `Option` of course
04:32:19FromDiscord<amadALTuzia> tbh, doesn't look like i need ref in particular
04:32:38FromDiscord<amadALTuzia> it wouldn't be optimal to use a `distinct of seq[string]` either
04:32:52FromDiscord<amadALTuzia> though it may be? idk
04:33:41FromDiscord<Elegantbeef> What semantics are you trying to get?
04:35:17FromDiscord<amadALTuzia> i'm mostly just trying to make it as easy on myself as possible so i don't have to go insane bringing back functions i need
04:35:41FromDiscord<Elegantbeef> So then just use `seq[string]`
04:36:03FromDiscord<amadALTuzia> fairs, cheers \:)
04:36:30FromDiscord<amadALTuzia> i might need to make command an enum? since theres a few irc commands i would really need
04:36:38FromDiscord<Elegantbeef> I'm just amazed you're actually making an irc API and not just some matrix spam with the just appearing with a link
04:36:46FromDiscord<Elegantbeef> Yes enums are preferable
04:37:07FromDiscord<amadALTuzia> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1362647957316436232): i might need to make command an enum? since theres a few irc commands i would really need to implement into the parser
04:37:10FromDiscord<amadALTuzia> gotcha, what i thought
04:37:12FromDiscord<amadALTuzia> cheers \:)
04:37:33FromDiscord<Elegantbeef> You can use `case` with enums and force everything to be handled so it's the best to do
04:38:18FromDiscord<amadALTuzia> im making a bot to provide an automod/slowdown for a discord irc bridge
04:38:30FromDiscord<amadALTuzia> not here btw, its some linux discord server
04:38:43FromDiscord<Elegantbeef> Damn one way to say "Beef talks too much"
04:38:56FromDiscord<amadALTuzia> reason being is that discord has an automod and slowmode implemented into the daemon
04:38:59FromDiscord<amadALTuzia> which is really bad
04:39:46FromDiscord<amadALTuzia> https://github.com/allthingslinux/atlchat
04:40:14FromDiscord<amadALTuzia> not even kidding, they wrote it directly into ergo (and now i have slowmode in direct messages!!!)
04:56:46FromDiscord<amadALTuzia> wait, interesting
04:56:54FromDiscord<amadALTuzia> i didn't know you can't delete messages in irc
04:57:35FromDiscord<Elegantbeef> It's just a stream of messages afterall
04:57:54FromDiscord<Elegantbeef> You only get what you're there for unless you have a bouncer
04:58:36FromDiscord<amadALTuzia> that is true, it would be out of scope for the bot to handle that stuff so it doesn't seem feasible
04:59:12FromDiscord<amadALTuzia> that is true, it would be out of scope for the bot to handle blocking messages daemonside so it doesn't seem feasible
04:59:18FromDiscord<amadALTuzia> that is true, it would be out of scope for the bot to handle blocking messages daemonside
05:00:56FromDiscord<amadALTuzia> aghhhhhhh whatever, i could make a point system
05:32:43*amadaluzia quit (Ping timeout: 252 seconds)
06:02:29*SchweinDeBurg quit (Quit: WeeChat 4.7.0-dev)
06:02:56*SchweinDeBurg joined #nim
06:05:54*amadaluzia joined #nim
06:14:37*coldfeet joined #nim
06:48:22*ntat joined #nim
07:00:06*zgasma quit (Ping timeout: 244 seconds)
07:14:57*n|Phreak joined #nim
09:05:44FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=oLQstRpC
09:06:23FromDiscord<heysokam> but not `toOct` (typo)
09:07:33FromDiscord<heysokam> same for `toBin`, if you don't pass in the correct length the result is not what you'd expect compared with toHex
09:07:38FromDiscord<leorize> because there's a [shortcut](https://nim-lang.org/docs/strutils.html#toHex%2CT) for `toHex` and none for `toOct`
09:08:26FromDiscord<heysokam> oh, kk
09:14:25*jinn6 quit (Ping timeout: 272 seconds)
09:22:16*jinn6 joined #nim
11:43:08*derpydoo quit (Quit: derpydoo)
11:50:41*amadaluzia quit (Ping timeout: 265 seconds)
11:51:09*amadaluzia joined #nim
12:47:10*beholders_eye joined #nim
13:13:21*ntat_ joined #nim
13:20:18*coldfeet quit (Quit: Lost terminal)
13:20:27*amadaluzia quit (Remote host closed the connection)
13:46:31*ntat_ quit (Quit: leaving)
13:49:04*amadaluzia joined #nim
13:55:41*xtr00 quit (Read error: Connection reset by peer)
13:59:52*xtr00 joined #nim
14:08:49FromDiscord<dawidek.2137> what's the difference between malloc and the default allocator?
14:09:17*n|Phreak is now known as Guest2085
14:09:17*Guest2085 quit (Killed (copper.libera.chat (Nickname regained by services)))
14:09:25*Guest2085 joined #nim
14:33:23*ntat quit (Quit: leaving)
14:53:52*ntat joined #nim
15:38:18*amadaluzia_ joined #nim
15:39:08*xtr00 quit (Read error: Connection reset by peer)
15:41:27*tiorock joined #nim
15:41:28*tiorock quit (Changing host)
15:41:28*tiorock joined #nim
15:41:28*rockcavera is now known as Guest4520
15:41:28*Guest4520 quit (Killed (calcium.libera.chat (Nickname regained by services)))
15:41:28*tiorock is now known as rockcavera
15:43:31*tiorock joined #nim
15:43:31*tiorock quit (Changing host)
15:43:31*tiorock joined #nim
15:43:31*rockcavera quit (Killed (tantalum.libera.chat (Nickname regained by services)))
15:43:31*tiorock is now known as rockcavera
15:44:06*xtr00 joined #nim
15:52:31*xtr00 quit (Read error: Connection reset by peer)
15:58:23*xtr00 joined #nim
16:38:54*rockcavera quit (Remote host closed the connection)
17:53:02*xet7 joined #nim
17:53:53*xet7 quit (Remote host closed the connection)
17:55:37*xet7 joined #nim
17:57:46FromDiscord<.bobbbob> I think I've asked this before, but is there no way to do some kind of parse tree or recursive descent parsing in npeg?
18:05:22*xet7 quit (Remote host closed the connection)
18:09:47FromDiscord<leorize> there's an example of building json out of npeg
18:10:00FromDiscord<leorize> that's what you'd do to build a parse tree out of it too
18:11:32FromDiscord<.bobbbob> that example doesnt show any captures, all the examples only show capturing into a table or seq, sorry but i'm not understanding how to capturing things into some kind of recursive structure
18:12:50FromDiscord<.bobbbob> (edit) "capturing" => "capture"
18:17:07FromDiscord<summarity> npeg isn't good at this (another problem is the firing of blocks whether matches occur or not). I did wrangle it a while ago into giving me a clean parse tree, but it's definitely not something I'd use again for this. Great for one-shot validation though.
18:17:27FromDiscord<summarity> If you just want recursive descent, the builtin parse utils are fine (take a look at the SQL parser for example)
18:18:14FromDiscord<leorize> https://github.com/zevv/npeg/blob/master/misc/rod.nim \<- that's basically how you do it↵(@.bobbbob)
18:18:20FromDiscord<leorize> but yea I agree that npeg isn't really made for this
18:23:10FromDiscord<Mason Wheeler> sent a code paste, see https://play.nim-lang.org/#pasty=dKyHiolO
18:25:42FromDiscord<.bobbbob> ic thanks
18:35:39FromDiscord<amadaluzia> I have further progressed.https://bpa.st/GNQQ
18:36:45FromDiscord<lainlaylie> In reply to @stormhunter__ "Anyone have any idea": maybe state creation fails and returns nil, that gets caught and an exception is raised, then that nil is passed to the deferred destroy call?
18:38:40FromDiscord<Mason Wheeler> In reply to @lainlaylie "maybe state creation fails": I'm new to Nim. How would I go about debugging something like that?
18:39:13FromDiscord<leorize> move the `defer` line to after `if ...isNil`
18:41:53FromDiscord<lainlaylie> sent a code paste, see https://play.nim-lang.org/#pasty=wwQtOGVo
18:42:33FromDiscord<leorize> it's equally likely that their version of the brotli C library is broken
18:43:05FromDiscord<Mason Wheeler> In reply to @leorize "it's equally likely that": Any way to verify that?
18:43:59FromDiscord<leorize> if you can write C, you can write the same program and see if it SIGSEGV
18:44:50FromDiscord<leorize> oh wait, that brotli package comes with brotli included
18:44:59FromDiscord<leorize> are you using the included one or your own library?
18:47:03FromDiscord<Mason Wheeler> I'm using the package
18:47:18FromDiscord<leorize> if you're using the included one, then your best bet is to build a `--debugger:native` build, then use a debugger to step and see what went wrong
18:47:19FromDiscord<Mason Wheeler> And everything builds without any problems
18:51:56FromDiscord<lainlaylie> BrotliDefaultFreeFunc doesn't seem to nil the freed pointer, so could it be some kind of double free? the other raises in that proc are preceded by an additional call to BrotliDecoderDestroyInstance
18:58:09FromDiscord<Mason Wheeler> In reply to @leorize "if you're using the": And where do I get a debugger? I try opening this in VS Code and it doesn't understand the Nimble build system or how to run and debug a native build. All the debugging options appear to be JS-related.
19:05:42FromDiscord<leorize> I'm not familiar with VSCode unfortunately
19:06:04FromDiscord<leorize> but usually you'd use `gdb` to run the executable
19:06:39FromDiscord<Mason Wheeler> I tried building it like that, putting in a readline() call, and using that to stop the program so I can attach the normal Visual Studio debugger. It debugs the readline call OK, but it gets lost coming back to my code.
19:08:46FromDiscord<leorize> assuming that you're using gcc, I'm not sure if VS debugger can follow the code
19:09:15FromDiscord<Mason Wheeler> GDB? Are people still using that? Like Obi-Wan Kenobi, "that's a name I have not heard in a long time." Like, since the 1990s.
19:09:19FromDiscord<leorize> but note that stepping within a nim program produces various jumps to helper functions before you enter a function
19:09:56FromDiscord<leorize> gdb and lldb is still the main debugger on all non-Windows platform
19:10:06FromDiscord<Mason Wheeler> That's horrifying!
19:10:39FromDiscord<leorize> if anything, using VS debugger is considered behind the times \:p
19:11:35FromDiscord<Mason Wheeler> if ever there was any class of developer tool where you'd expect it was simply inconceivable for anyone to use as a command-line-only process, it would be a debugger.
19:13:23FromDiscord<leorize> lldb/gdb have various GUI integrations (either via their own protocol or Microsoft's DAP), so it's usually integrated with your editor
19:19:58FromDiscord<summarity> In reply to @stormhunter__ "And where do I": You can get basic debugging with CodeLLDB and the VS Code integration, You'll need the python script from the nim dist to format some of the built-in data types though.
19:20:32FromDiscord<Mason Wheeler> Thanks, I'll try that
19:22:10FromDiscord<summarity> Here are some snippets I often use when setting this up in VSC: https://gist.github.com/turbo/1ff608f7488556357f7b07d8f13c1bd4
19:31:49FromDiscord<Mason Wheeler> It's erroring because the `preLaunchTask` is undefined
19:38:14FromDiscord<threefour> I'm getting murdered lately trying to make generic vtables work. I submitted that compiler bug I had before @leorize, and apparently the workaround is to use an object as the vtable instead of a tuple. But now I'm running into this: https://play.nim-lang.org/#pasty=FwHNUPnc
19:40:06FromDiscord<Elegantbeef> Gotta be atraitor
19:40:42FromDiscord<leorize> welcome to nim
19:40:48FromDiscord<threefour> I'd like to make it work manually before I use an abstraction
19:41:11FromDiscord<Elegantbeef> `--expandMacro:implTrait` wam bam thank you maam
19:42:01FromDiscord<Mason Wheeler> In reply to @lainlaylie "BrotliDefaultFreeFunc doesn't seem to": Looks like that's exactly what's going on. Now that I can debug into this, I see that I'm hitting the case on line 187, which is freeing the state, and then hitting the defer call.
19:42:48FromDiscord<threefour> No way. Reordering the declarations made it compile lol
19:43:02FromDiscord<Elegantbeef> So what traitor does is it boxes the data inside of the object with the Vtable
19:44:51FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=EkzaHpdh
19:45:16FromDiscord<Elegantbeef> Though it actually does this with more boxing
19:45:38FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=UIQuqdsb
19:46:00FromDiscord<Elegantbeef> `typeId` is for serializatio
19:47:07FromDiscord<Elegantbeef> Then you convert your types to `Traitor[T]` after construction as `TypedTraitor`
19:47:55FromDiscord<threefour> > `# This does not work cause Nim generics really hate fun.`↵I'll say.
19:50:06FromDiscord<leorize> you haven't used nim if you didn't invoke a compiler bug or two
19:50:06FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=PvrfUymk
19:50:21FromDiscord<leorize> you haven't used nim if you hadn't invoke a compiler bug or two
19:50:45FromDiscord<Elegantbeef> The important thing is `toTrait` which does the boxxing
19:51:10FromDiscord<Elegantbeef> `emitPointerProc` emits an array of the procs required for the vtable
19:51:26FromDiscord<Elegantbeef> Which in the above is just `[doStuff]`
19:52:26FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=ORZAbnbh
19:52:57FromDiscord<threefour> Gonna need about a week to unpack all this
19:53:09FromDiscord<Elegantbeef> No there is a `unpackIt` template
19:53:12FromDiscord<Elegantbeef> 😛
19:53:16FromDiscord<threefour> Ha
19:53:39FromDiscord<Elegantbeef> I could make a small example if you have `Img` and `Graphic` defs laying about
19:55:19FromDiscord<Elegantbeef> Or I of course could just make my own protect interfaces
19:55:27FromDiscord<Robyn [She/Her]> what are you talking about Beef
19:55:37FromDiscord<Elegantbeef> Huh?
19:55:48FromDiscord<Robyn [She/Her]> I'm curious, haven't followed the convo
19:55:54FromDiscord<Robyn [She/Her]> Just saw traitor mentioned
19:55:56FromDiscord<Elegantbeef> Traits
19:56:07FromDiscord<threefour> You mean functions? In this case, just a straightforward testing impl: https://play.nim-lang.org/#pasty=NeSHFEcc
19:56:11FromDiscord<Elegantbeef> They're doing it from scratch so I thought I'd pass along my grand wisdom
19:56:19FromDiscord<threefour> If I can implement this, that'll help me extrapolate to the larger codebase.
19:56:30FromDiscord<Elegantbeef> Oh you're just doing some silly wrappings
19:56:56FromDiscord<threefour> Well it gets more complex in the main codebase, but I really just need to get the fundamentals.
19:58:19FromDiscord<Elegantbeef> Ah you also have a silly behaviour here
19:58:22FromDiscord<Elegantbeef> Will fix
19:58:34FromDiscord<threefour> I'm trying to port a project I wrote in Go to improve performance. But I do want to keep the use of interfaces from the original project.
19:59:27FromDiscord<leorize> so you have chosen pain I see
19:59:33FromDiscord<threefour> Indeed
20:03:46FromDiscord<Robyn [She/Her]> ah
20:03:53FromDiscord<threefour> Perhaps it'd be better to avoid trying to take a core function of Go and recreate it in Nim (interfaces). Is there any straightforward way to port something from using interfaces to some other more Nim-idiomatic approach that I'm not aware of?
20:04:19FromDiscord<Robyn [She/Her]> Concepts exist but those are compile time↵(@threefour)
20:04:38FromDiscord<Robyn [She/Her]> You could do type-based dispatch at runtime via methods tho
20:04:49FromDiscord<Robyn [She/Her]> Iirc ref objects only tho (bc otherwise you'd lose data)
20:05:27FromDiscord<Robyn [She/Her]> Tho Traitor looks pretty slick, no reason not to use it \:p
20:08:26FromDiscord<amadaluzia> sent a code paste, see https://play.nim-lang.org/#pasty=LUccHJBJ
20:08:30FromDiscord<amadaluzia> turns out writing an irc thing is a bit hard
20:08:38FromDiscord<amadaluzia> turns out writing an irc parser is a bit hard
20:09:05FromDiscord<amadaluzia> it would have been a bit easier if tags didn't exists, since now i have to deal with another thing using " \:"
20:09:53FromDiscord<amadaluzia> sent a code paste, see https://play.nim-lang.org/#pasty=VDjfsJLW
20:17:13FromDiscord<Elegantbeef> Heh @threefour you have mad me make a compiler crash!
20:17:14FromDiscord<Elegantbeef> made\
20:20:40*ntat quit (Quit: leaving)
20:28:44FromDiscord<threefour> Yeah I seem to have that effect lately
20:29:42FromDiscord<Elegantbeef> God damn my issue seemed to have been that new grand binding for generics
20:29:46FromDiscord<threefour> In reply to @Robyn "Concepts exist but those": Has someone written a comprehensive demonstration of concepts? It's not the best term for search engines lol. I only know of https://nim-lang.org/docs/manual_experimental.html#concepts
20:29:51FromDiscord<Elegantbeef> https://play.nim-lang.org/#pasty=jrbFsndN
20:30:25FromDiscord<Elegantbeef> https://www.jasonbeetham.ca/writeups/codereuse.html it's mentioned here briefly
20:30:33FromDiscord<Elegantbeef> But you want runtime polymorphism which they don't do
20:31:01FromDiscord<threefour> Right, but it's something I've been interested in learning more about as an aside, but only found minimal docs.
20:31:22FromDiscord<Elegantbeef> Anyway the playground link is what traitor does automatically
20:32:54FromDiscord<Elegantbeef> Notice how we have value types now and use `var T` so we don't force the user to use `ref`s
20:35:27*syl quit (Ping timeout: 252 seconds)
20:36:47FromDiscord<threefour> This is great. I'll read up and play around with it. Much appreciated.
20:37:54FromDiscord<Elegantbeef> No problem, do still atleast suggest trying traitor since it solves these issue and helps in some places like serialization
20:38:26FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=UIKafyRp
20:39:55FromDiscord<Elegantbeef> Try doing that with Nim's OOP and you'll pull your hair out 😄
20:40:24FromDiscord<threefour> I probably will end up using Traitor, I just wanted to understand what was going on under the hood before I sell my soul to a library lol
20:40:44FromDiscord<Elegantbeef> Well that's what `expandMacros` is for
20:41:25FromDiscord<Elegantbeef> Also how dare you call traitor the devil, it even has passable error messages
20:42:25FromDiscord<threefour> Well okay, I meant to understand the fundamentals of what's going on under the hood, not the direct code gen. I find it easier to see where pitfalls are by attempting your own implementation first.
20:42:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=WeBSpzwX
20:43:10FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=ILQgtRwU
20:44:18FromDiscord<Elegantbeef> I also don't recall how far it works but there is also a `traitorNiceNames` for debugging purposes
20:44:53FromDiscord<Elegantbeef> So instead of `:anonymous` you get like `Trait_ProcName_AtomType` or similar
20:45:03FromDiscord<Elegantbeef> Not really top support by me to hide that away but it also doesn't work 100%
20:45:12FromDiscord<threefour> Good to know
21:05:26*przmk quit (Remote host closed the connection)
21:06:01*przmk joined #nim
21:36:38*amadaluzia quit (Remote host closed the connection)
22:11:45*disso-peach joined #nim
22:13:13*disso-peach quit (Client Quit)
22:40:17*beholders_eye quit (Ping timeout: 248 seconds)
22:40:31FromDiscord<seyfeddine43010> "A group of dwarf cats wearing construction helmets and builder outfits, working together to build a small house using red bricks and cement. The scene is cartoon-style but realistic, with cats holding tools like trowels and shovels. Background includes construction materials, scaffolding, and some trees. Fun and detailed atmosphere."
22:43:14*xet7 joined #nim
22:56:18FromDiscord<aintea> Imagine if Nim had a new kind of macros (Rust like macros) where we can do absolutely whatever we want with the syntax whether the syntax is Nim valid or not
22:56:39FromDiscord<aintea> It would be a niche usecase but just imagine the possibilities
23:00:24FromDiscord<.bobbbob> In reply to @aintea "Imagine if Nim had": I've been thinking about something like that, it would basically be a string input into a function that you parse and do whatever you want with, but have sugar to not have to put the quotes
23:00:48FromDiscord<aintea> I have no idea how they do it in Rust
23:01:03FromDiscord<aintea> But that would mean we could have incredible everything
23:01:46FromDiscord<aintea> Writing raw SQL, HTML, CSS, extending Nim to have proper pattern matching (we will have it soon, there is a RFC), or even writing Malbolge
23:17:42FromDiscord<demotomohiro> In reply to @aintea "Imagine if Nim had": You can create such a macro if you put your custom programming language in string literal or const strings like `mymacro"my language"`.↵That macro parse input string and generates `NimNode`.
23:20:35FromDiscord<aintea> I mean without having quotes
23:20:42FromDiscord<aintea> Because that's ugly
23:20:57FromDiscord<aintea> But yeah that would work and I would only need to parse the string
23:25:20FromDiscord<demotomohiro> In reply to @aintea "I mean without having": I think if you put non-Nim language inside Nim code, you probably need to enclose these code so that Nim compiler and source code reader don't get confused.
23:26:56FromDiscord<demotomohiro> You can use triple quoted string to put multiple line text and I don't think it is ugly.
23:27:19*derpydoo joined #nim
23:32:54*Jjp137 quit (Quit: Leaving)
23:34:24*Jjp137 joined #nim
23:45:33*amadaluzia joined #nim
23:49:48*amadaluzia quit (Ping timeout: 252 seconds)
23:50:07*amadaluzia joined #nim