<< 26-10-2023 >>

00:00:11*antranigv quit (Quit: ZNC 1.8.2 - https://znc.in)
00:00:37*antranigv joined #nim
00:02:42FromDiscord<pcarrier> @typistx what do you mean by not supported? arm, arm64, risc32, riscv64 are in the list of platforms
00:03:37Amun-Rahe confused cpu arch with platform
00:03:55FromDiscord<typistx> https://media.discordapp.net/attachments/371759389889003532/1166889910117072896/image.png?ex=654c21ea&is=6539acea&hm=b685cc3fa31dc8d873a6f135fc360121721f3a8df1c669c74a846dee49faf822&
00:04:21Amun-Rathere are some third party projects for bare metal/embedded
00:05:11Amun-Rathese are tier 1
00:06:24FromDiscord<typistx> https://nim-lang.org/docs/packaging.html says only x86 amd64 are regularly tested, the rest is community based, or you're on your own
00:09:17FromDiscord<typistx> https://doc.rust-lang.org/beta/rustc/platform-support.html. this is how rust's tier scheme works, for embedded arm/arm64/risc-v boards I don't really need nim to run on the board, but they must be cross compiled and supported officially to get manager's approval to use nim in real products
00:10:23Amun-Rayou can generate C files with Nim and compile and link almost anywhere in the posix world, you can't do that in rust
00:11:32Amun-RaI wrote a program for AmigaOS 3.x (m68k cpu); neither the platform nor the cpu is listed anywhere
00:14:00Amun-Raso if it's a linux or something posix-alike there's almost 0% chance of compilation failure
00:14:19FromDiscord<typistx> well even c is not 100% architecture indepdentent, e.g. endianness and architecture specific features, nim still needs to be aware of different architectures before it generates the C code
00:14:34Amun-Raright
00:15:41Amun-RaAvailable options are: i386, m68k, alpha, powerpc, powerpc64, powerpc64el, sparc, vm, hppa, ia64, amd64, mips, mipsel, arm, arm64, js, nimvm, avr, msp430, sparc64, mips64, mips64el, riscv32, riscv64, esp, wasm32, e2k, loongarch64
00:17:12Amun-Rayou can compile for cpu not listed if endianness and data model matches
00:18:15Amun-Rawell, C standard is 100% architecture independent, the compiled code is not C standard exclusive
00:19:53FromDiscord<typistx> which C standard does nim use? ANSI C instead of posix C? which version is that
00:21:22Amun-Raby ansi c you mean c89 or the current one?
00:21:32Amun-Rathere's no such thing as posix c, there's c standard and there's posix
00:22:05Amun-RaI mean C posix library
00:22:31Amun-RaI don't remember but I guess it's c99 at least
00:26:31Amun-RaIIRC I had to implement only two posix functions for simple hello world in amigaos (with -d=usemalloc), flockfile and funlockfile
01:00:52NimEventerNew post on r/nim by wick3dr0se: We're writing an IRC server in Nim, see https://reddit.com/r/nim/comments/17gkev9/were_writing_an_irc_server_in_nim/
02:45:52NimEventerNew post on r/nim by NoidoDev: Error: undeclared identifier:'SDL_Init', see https://reddit.com/r/nim/comments/17gmi4u/error_undeclared_identifiersdl_init/
03:10:48*tiorock joined #nim
03:10:48*tiorock quit (Changing host)
03:10:48*tiorock joined #nim
03:10:48*rockcavera is now known as Guest9781
03:10:48*Guest9781 quit (Killed (copper.libera.chat (Nickname regained by services)))
03:10:48*tiorock is now known as rockcavera
03:11:31*rockcavera quit (Read error: Connection reset by peer)
03:12:04*rockcavera joined #nim
03:12:04*rockcavera quit (Changing host)
03:12:04*rockcavera joined #nim
03:12:51*tiorock joined #nim
03:12:51*tiorock quit (Changing host)
03:12:51*tiorock joined #nim
03:12:51*rockcavera is now known as Guest6784
03:12:51*tiorock is now known as rockcavera
03:16:31*Guest6784 quit (Ping timeout: 255 seconds)
03:19:08FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4JYo
03:19:24FromDiscord<user2m> (edit) "https://play.nim-lang.org/#ix=4JYo" => "https://play.nim-lang.org/#ix=4JYp"
03:19:56FromDiscord<Elegantbeef> `importJs: "cell"`
03:20:03FromDiscord<Elegantbeef> Whoops sorry `"_cell"`
03:43:34FromDiscord<user2m> had to do this
03:43:43FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4JYw
03:44:18FromDiscord<user2m> (edit) "https://play.nim-lang.org/#ix=4JYw" => "https://play.nim-lang.org/#ix=4JYx"
03:48:47*rockcavera quit (Remote host closed the connection)
04:28:01FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4JYD
04:31:03FromDiscord<Elegantbeef> `fieldPairs`
04:38:14FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4JYG
04:39:51FromDiscord<user2m> ahh this seems to work
04:39:59FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4JYH
04:40:43FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4JYI
04:45:10FromDiscord<demotomohiro> `fieldPairs` takes an object type variable but doesn't take object type itself.↵`item()` creates a temporary object.
05:16:50FromDiscord<xtrayambak> In reply to @NimEventer "New post on r/nim": why would you use ChatGPT for Nim of all things?
05:16:58FromDiscord<xtrayambak> last I heard, ChatGPT SUCKS at writing Nim
05:17:09FromDiscord<xtrayambak> It mixes up Python code with Nim code
05:17:16FromDiscord<Elegantbeef> Or my version of that sentence "Why would you use ChatGPT"
05:21:48FromDiscord<guzba8> In reply to @anuke "<@318284269908918273> Question about zippy:": i just had this linked to me now, i missed it i guess. i do know this works on my m1 mac `nim c --mm:arc --cpu:arm64 --passL:"-arch arm64" --passC:"-arch arm64" -r tests/bench_checksums.nim`
05:25:50FromDiscord<anuke> In reply to @guzba8 "i just had this": Thanks, I'll try that later. I was not passing the linker argument, maybve that's it.
05:25:56FromDiscord<anuke> (edit) "maybve" => "maybe"
05:28:31FromDiscord<gyatsoyt> I was searching nim's package library I didn't find anything related to chess like python has python chess js has chess.js it really made me sad cz I started learning nim for chess development and I can't find anything related to it. Does anyone have any idea what to do about it???
05:28:47FromDiscord<Elegantbeef> Write a chess engine
05:29:05FromDiscord<Elegantbeef> https://github.com/search?q=chess%20language%3Anim&type=repositories
05:37:16FromDiscord<gyatsoyt> In reply to @Elegantbeef "Write a chess engine": There aren't any chess libraries like other programing languages have
05:38:16FromDiscord<gyatsoyt> The ones that are labelled as chess libraries doesn't have the features that is going to get used
05:59:59*PMunch joined #nim
06:01:02PMunchDoes anyone know what's going on here? https://github.com/PMunch/ratel/issues/17#issuecomment-1770478186
06:01:36PMunchI have a suspicion that it is these microcontrollers being a 16-bit target which is messing with things
06:01:46PMunchBut I have no idea where the unicode module is even imported from..
06:09:54*advesperacit joined #nim
06:32:45FromDiscord<Chronos [She/Her]> So... Does anyone know how I'd store the `state` that I generate, to compare against the one GitHub gives me?
06:35:08PMunchWhat do you mean by "the one GitHub gives me"
06:40:18FromDiscord<Chronos [She/Her]> In the OAuth flow, I have to pass a state to GitHub (in the URL I redirect the user to), but the issue is that I don't have a way to store the state and then compare it with the state that GitHub gives when redirecting back to my site
06:40:29FromDiscord<Chronos [She/Her]> Maybe it'll be better if I actually just show the docs
06:41:19FromDiscord<Chronos [She/Her]> Here: https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#2-users-are-redirected-back-to-your-site-by-github
06:41:39FromDiscord<Chronos [She/Her]> They're redirected back to my site, and the `state` I originally provided is returned
06:42:04FromDiscord<Chronos [She/Her]> I don't have a way to store the state for a user though, because I have no identifying information I can use
06:45:35FromDiscord<Chronos [She/Her]> My idea of a solution is to store all of the `state`s in a list but that seems a tad unsafe :p
06:47:53PMunchThat "state" is only meant to be a random string though
06:49:08PMunchAh, you want to log in user X, but you generate a random string, pass it on to GitHub, then get that random string back but have no way to tell if that was the original random string you passed because you have no way of tying that to the original request?
06:50:43PMunchI guess you could use a bit of cryptography to solve it
06:51:29FromDiscord<Chronos [She/Her]> In reply to @PMunch "That "state" is only": It is a randomly generated string, yes
06:51:35FromDiscord<Chronos [She/Her]> In reply to @PMunch "Ah, you want to": Yeah exactly
06:51:55PMunchHave a secret key, then encrypt some known string along with a timestamp and pass that as the "state". Now when you get the state back you decrypt the state returned with your secret key and check that the decrypted state starts with your known text and that the timestamp isn't too old
06:51:56FromDiscord<Chronos [She/Her]> In reply to @PMunch "I guess you could": How would that solve my issue? I don't have any identifying information from the request
06:52:15FromDiscord<Chronos [She/Her]> Ah okay, that's doable
06:52:21FromDiscord<Chronos [She/Her]> Thanks PMunch!
06:52:40PMunchSo you wouldn't know that it was request X, but that doesn't seem like it's required anyways. You just need to check that the state was generated by you.
06:58:12PMunchOf course if you're worried that someone will break into your server and steal the list of client OAuth sessions in transit you should be equally worried they would steal your key
06:58:53advesperacityou could randomly generate the key each time the application starts
07:00:10PMunchIt really should be random per request though
07:00:49advesperacitYes, that would be best
07:19:43FromDiscord<Chronos [She/Her]> Fair
07:20:15FromDiscord<Chronos [She/Her]> I guess a list of all generated states should be fine then?
07:20:30FromDiscord<Chronos [She/Her]> Especially since they should all be completely random each time
07:27:34PMunchThe problem is that if you have a lot of request and you can't tie a request to a response then you technically have a slightly higher chance of guessing a valid one :P
07:31:50FromDiscord<Chronos [She/Her]> Yeaah-
07:58:22FromDiscord<Chronos [She/Her]> Legitimately wondering if there's a way to get around this... Sigh
08:00:28PMunchApart from the way I suggested?
08:03:14FromDiscord<Chronos [She/Her]> The way you suggested is definitely a way to do it, just wondering if there's a way to not need to do it tbh
08:05:00PMunchWell the state parameter is optional..
08:05:01FromDiscord<mratsim> In reply to @chronos.vitaqua "Maybe it'll be better": What problem are you trying to solve?
08:05:19FromDiscord<mratsim> if you want to do an `==`, use a hash of the state.
08:06:33FromDiscord<mratsim> or use a "session key", which is a fancy name for a CSPRNG, 32 bytes is likely enough.
08:07:44FromDiscord<mratsim> > state string An unguessable random string. It is used to protect against cross-site request forgery attacks.
08:07:57FromDiscord<Chronos [She/Her]> In reply to @PMunch "Well the state parameter": Optional, but more secure to have
08:08:21FromDiscord<Chronos [She/Her]> In reply to @mratsim "What problem are you": I need a way to ensure that the state I've generated and the one that's returned to me in the callback URL, are the same
08:08:31PMunchOh for sure, but you asked if there was a way to not need to do it
08:08:35FromDiscord<Chronos [She/Her]> But I don't have any identifying information, so I'm probably going with what PMunch suggested
08:08:57FromDiscord<mratsim> when you connect to Github, you have some "context" object to keep track of the connection, just put a "session_key" into that context, randomly generated, and when you receive data back from OAuth check that the state match
08:09:16FromDiscord<mratsim> it should NOT have identifying information
08:09:18FromDiscord<Chronos [She/Her]> In reply to @PMunch "Oh for sure, but": Ah, sorry my brain is just so scattered
08:09:31FromDiscord<mratsim> 32 bytes (256-bit) randomly generated data is enough
08:09:33FromDiscord<Chronos [She/Her]> In reply to @mratsim "it should NOT have": Unique information about the client, I mean
08:10:08FromDiscord<mratsim> doesn't the client establish a connection with you?
08:10:21FromDiscord<mratsim> don't you have metadata on the connection?
08:10:38FromDiscord<Chronos [She/Her]> It does, but I'm using Prologue and it's not really clear on how I'd get some unique information
08:10:44FromDiscord<mratsim> just add a github_session_key: array[32, byte] field
08:10:48FromDiscord<nnsee> In reply to @xtrayambak "last I heard, ChatGPT": it's okay, but don't go hoping it'll write your macros for you (although I've surprisingly have had quite a bit of success with that too, albeit on a pretty primitive level). What irks me is that it very regularly hallucinates packages that just don't exist, but I usually respond with "package [X] doesn't actually exist, please write the code you're importing yourself" and it does that
08:10:54FromDiscord<nnsee> but yeah, it's much stronger in other languages
08:10:58FromDiscord<mratsim> In reply to @chronos.vitaqua "It does, but I'm": a CSPRNG
08:11:11FromDiscord<Chronos [She/Her]> In reply to @mratsim "just add a github_session_key:": To the context?
08:11:22FromDiscord<mratsim> yes
08:11:56FromDiscord<nnsee> i've been doing front-end work recently (ew) for the first time in my life using React and it has been super, super helpful for writing an MVP and explaining concepts that are foreign to me
08:12:20FromDiscord<Chronos [She/Her]> I swear I tried using the `ctxData` field and it didn't let the information persist between two routes
08:12:22PMunchnnsee, I have a feeling it imports Python packages half the time :P
08:12:31FromDiscord<nnsee> yup
08:15:40FromDiscord<mratsim> In reply to @chronos.vitaqua "I swear I tried": I can't help you more without seeing the app, but basically, you need to generate random data using a CSPRNG, hold on to it, send the OAuth request. And check that the state returned is the same as the random data.
08:21:07FromDiscord<Chronos [She/Her]> I just used sysrand to generate some data but I'll look for a csprng library in Nim then
08:21:26FromDiscord<Chronos [She/Her]> In reply to @mratsim "I can't help you": The inability to check the state is my entire issue
08:21:51FromDiscord<Chronos [She/Her]> I'll just store it in a list shared between the entire application, it's the only solution I can see
08:53:24FromDiscord<mratsim> In reply to @chronos.vitaqua "I just used sysrand": The sysrand is OK, I did a review when implementing my own CSPRNG. The one in nimcrypto has been audited.↵↵And there is the one I wrote, though it's "Trust me bro I know what I'm doing" like Nim's: https://github.com/mratsim/constantine/blob/master/constantine/csprngs/sysrand.nim
08:56:38FromDiscord<Chronos [She/Her]> Fair, thanks!
09:04:22FromDiscord<Chronos [She/Her]> Oh actually I'm wondering now if ULIDs would be the perfect type of data to be used as a unique value
09:04:27FromDiscord<Chronos [She/Her]> Contains a timestamp + random data
09:13:24FromDiscord<Phil> Is there a way to make a proc for any range type?
09:13:39FromDiscord<Phil> Because `proc x(r: range)` is not a valid proc signature
09:14:26FromDiscord<Phil> (edit) "signature" => "signature, because range is not a valid parameter-type, not even for generics"
09:16:55FromDiscord<Phil> Aaaaand found the answer, `proc x[T: range](r: T)`
09:19:48FromDiscord<Phil> Aaaaaand that isn't a good solution because that causes ambiguous call errors again with `proc x(r: auto)`
09:20:02FromDiscord<Elegantbeef> `r: not range`
09:20:22FromDiscord<Phil> ... wait, when r: range doesn't work, why should r: not range work?
09:20:34FromDiscord<odexine> they mean instead of auto
09:21:08FromDiscord<Phil> My question was regarding that. If I can check for "not range", I should also be able to check for "range"
09:21:23FromDiscord<Phil> or rather if I can make generic over "not range", I should also be able to make sth generic over "range"
09:21:27FromDiscord<odexine> yes
09:21:31FromDiscord<odexine> and you can, i dont understand
09:21:34FromDiscord<Elegantbeef> I mean implicit generics are syntax sugar for generic parameters so if it didnt work ....
09:21:52FromDiscord<Elegantbeef> I honestly thought there was a range typeclass
09:21:54FromDiscord<Phil> The irony is that beef's example works
09:22:05FromDiscord<Phil> `proc isRange(r: range) = echo "is range"` this is invalid↵`proc isRange(r: not range) = echo "no range"` this is valid
09:22:12FromDiscord<Phil> 😕
09:22:47FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4JZo
09:23:18FromDiscord<Phil> There's https://nim-lang.org/docs/system.html#range I guess (?)
09:23:22FromDiscord<Elegantbeef> There is no range typeclass for parameters oddly
09:23:34*beholders_eye joined #nim
09:24:14FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4JZp
09:26:34FromDiscord<Phil> Hmm should I ask first in internals if a range parameter typeclass should be added or should I straight open a github issue I wonder
09:28:45FromDiscord<Elegantbeef> I think it exists it's just not as friendly
09:28:49FromDiscord<Elegantbeef> given `x is range` works
09:30:02FromDiscord<Phil> Yeah but I can't use that as generic parameter is my end-user perspective, and I'd want to in order to avoid clashes with `proc x(r: auto)`
09:30:27FromDiscord<Phil> Which I'd want as a fallback safety net
10:38:17*beholders_eye quit (Ping timeout: 258 seconds)
10:40:16*beholders_eye joined #nim
10:55:57FromDiscord<Phil> This is just me shooting for perfection here regarding form generation, but can you possible figure it (without macros) if a type is a distinct type and which type it originated from?
10:56:35FromDiscord<Phil> Basically can I, in a generic way in a proc or template, figure out that `type X = distinct string` can be equated to a string?
11:04:46PMunchPhil, distinctBase? https://nim-lang.org/docs/typetraits.html#distinctBase%2Ctypedesc%2Cstaticbool
11:05:56FromDiscord<gyatsoyt> Anyone interested in developing a nim package called chess like the package python chess available in python?
11:07:10FromDiscord<Phil> In reply to @gyatsoyt "Anyone interested in developing": I'm not personally interested as I'm busy contributing to owlkettle, but have you considered just using the python package with nimpy?
11:08:31FromDiscord<Phil> In reply to @PMunch "<@180601887916163073>, distinctBase? https://nim-la": That may just be perfect
11:08:54FromDiscord<Phil> Holy shit `x is distinct` also works
11:09:00PMunchOf course
11:11:01FromDiscord<JJ> In reply to @isofruit "I'm not personally interested": heard owlkettle 3.0 is on the horizon 👀
11:11:14FromDiscord<Phil> ~~Depends on how much I delay it~~
11:14:57FromDiscord<nnsee> @jviega thought you might be interested, posted on the day after we had our discussion:↵https://salt.security/blog/oh-auth-abusing-oauth-to-take-over-millions-of-accounts↵↵if companies nearing $100M revenue can't get it right, how does everyone else even stand a chance?
11:17:22FromDiscord<gyatsoyt> In reply to @isofruit "I'm not personally interested": Can I 💀
11:17:30FromDiscord<gyatsoyt> I didn't knew i can do that
11:18:17FromDiscord<Phil> In reply to @gyatsoyt "Can I 💀": Nim basically can use anything python can.↵Note that the python code is not pulled into the binary, so if you were to distribute the binary to somebody they'd also need to have the necessary python libs installed, or you provide it in a format where you include the python libs somehow
11:19:05FromDiscord<Zoom> Hey everyone. Is there an easy way to extend varargs when they are of different types? I'd like to write a few shorthands for calling `styledWrite`, wrapping the input in the appropriate styling before it and additional text after it. `styledWrite` is itself a macro taking varargs.
11:21:05FromDiscord<Zoom> I want a `log` proc which expands to something like `stderr.styledWriteLine(fgGreen, varargsGoHere, "✔")`
11:21:22FromDiscord<gyatsoyt> In reply to @isofruit "Nim basically can use": Ohk where can I find documentation of nimpy
11:21:44FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4JZM
11:21:48FromDiscord<Phil> https://github.com/yglukhov/nimpy
11:22:16FromDiscord<Chronos [She/Her]> It's how `echo` can print most objects too, it'll return it as a varargs of strings
11:22:28PMunchChronos_[She/Her], I believe Zoom wants to pass the varargs on though
11:22:41FromDiscord<Chronos [She/Her]> Ah
11:23:51FromDiscord<Chronos [She/Her]> In reply to @Zoom "I want a `log`": You may find `unpackVarargs` from `std/macros` useful then
11:25:07PMunchI think Nim just deals with this on its own: https://play.nim-lang.org/#ix=4JZO
11:26:14FromDiscord<Chronos [She/Her]> Ah
11:28:12FromDiscord<Phil> Pmunch , it worked out just as I'd hoped.↵We now have basically a mechanism for fully generic automated form generation for owlkettle.↵I might want to figure out a way for the user to fully customize which widgets get created for a given type, but that's basically all done.↵God this is cool.
11:28:32FromDiscord<Phil> Also circular types will likely kill this construct, but circular types are heresy anyway
11:28:41PMunchHmm, if this is what I think it is it sounds awesome. Do you have a sample?
11:32:44FromDiscord<Phil> sent a long message, see http://ix.io/4JZQ
11:33:09FromDiscord<Phil> The code for the entire mechanism is in `playground.nim`
11:34:31FromDiscord<Phil> What made me kind of go baseball-eyed was that you can just change the type hidden behind a ptr
11:34:40FromDiscord<Phil> That's what your distinctBase comment helped fix
11:34:57FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4JZR
11:35:04FromDiscord<Chronos [She/Her]> I should probably add a lock on my ULID generation library hm... Also should remove the async stuff bc that's useless and unimportant for threading
11:35:51FromDiscord<Phil> The pointer in `baseField` points to the same addr is the same as the pointer in `field`, they just both assume different types behind it all.↵And afaik those distinct types are just for the compiler anyway, so that is perfectly valid
11:36:20FromDiscord<Phil> sent a code paste, see https://paste.rs/ki6SX
11:41:42FromDiscord<_nenc> Does anybody know why is `end` a keyword?
11:41:51FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4JZU
11:41:58*advesperacit quit ()
11:42:11FromDiscord<Phil> https://media.discordapp.net/attachments/371759389889003532/1167065637248565368/image.png?ex=654cc592&is=653a5092&hm=2fce512f4d90df6799c0af4dd05edafc05c1e96bc03573ebc0eca89875016f14&
11:44:17PMunchHmm, interesting
11:44:49PMunchNot entirely sure I understand what the various parts do, but looks promising!
11:45:23FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4JZX
11:45:37FromDiscord<Phil> For me the most important bit is that the mechanism is there.↵How the widgets etc. look like exactly I'm pretty sure you can customize
11:46:05*FromDiscord quit (Remote host closed the connection)
11:46:18*FromDiscord joined #nim
11:48:32FromDiscord<Phil> sent a long message, see http://ix.io/4JZY
11:50:03FromDiscord<Phil> The mechanism as is I may just put into its own package and think about how to customize which Widget each `toFormField` proc creates somehow.↵Though that's far of into the future, I think the next couple weeks will solely be getting the PRs merged and stabilized
11:50:22FromDiscord<Phil> (edit) "The mechanism as is I may just put into its own package and think about how ... to" added "I can allow users"
11:51:17FromDiscord<Chronos [She/Her]> If I raise an exception in a body with `withLock` does that cause a deadlock?
11:52:30FromDiscord<Phil> depends on if withLock uses "finally" or not
11:52:37FromDiscord<Chronos [She/Her]> Uhhh let me see
11:52:47FromDiscord<Chronos [She/Her]> It does, nice
11:53:03FromDiscord<Phil> In that case the lock is always released.↵The only way to not release it is to crash the application
11:54:40FromDiscord<Chronos [She/Her]> Also is it safe to cast the bodies of locks to `gcsafe`? :p
11:55:03FromDiscord<Chronos [She/Her]> Compiler claims it isn't gcsafe because `withLock` calls `release`
11:55:55FromDiscord<Phil> I mean, you're not casting the body gc-safe, you're casting the entire template gc-safe if release is the problem
11:56:27FromDiscord<Chronos [She/Her]> Yeah, that-
11:56:37FromDiscord<Chronos [She/Her]> My brain is, as always, mush :p
11:57:23FromDiscord<Chronos [She/Her]> But yeah would it be safe to cast it as gcsafe? Purely because of the `release` statement
11:58:05FromDiscord<Phil> I can not speak authoritatively here, I'd say it should be fine but I can't say for sure.
11:58:20FromDiscord<Chronos [She/Her]> Fair
12:23:04FromDiscord<Chronos [She/Her]> Uhhh should I rename all instances of `NULID` in my types to `ULID`? Hm...
12:23:25FromDiscord<Chronos [She/Her]> Probably will because that's been irritating me for a while, and this is a major version bump anyway sooo
12:56:36*marcus quit (Remote host closed the connection)
13:01:27FromDiscord<leorize> it's for the embedded nim templating language↵(@_nenc)
13:06:25*marcus joined #nim
13:10:18*marcus quit (Remote host closed the connection)
13:13:31FromDiscord<_nenc> oh, I see.
13:13:52FromDiscord<_nenc> thanks \@leorize
13:21:29*marcus joined #nim
13:53:35*beholders_eye quit (Ping timeout: 255 seconds)
13:57:50*CO2 quit (Quit: WeeChat 4.1.0)
13:59:54*beholders_eye joined #nim
14:00:05*rockcavera joined #nim
14:09:01arkanoidjust out of curiosity, have you ever used drnim? https://nim-lang.org/docs/drnim.html
15:01:15FromDiscord<.aingel.> Why are people making more languages in nim
15:01:18FromDiscord<Chronos [She/Her]> Hm... Wondering if it'd be useful to contribute something for testing Nim code on arm and various other platforms (for the compiler)
15:03:30FromDiscord<leorize> I already did something about it so you can try reviving the effort
15:03:57FromDiscord<Chronos [She/Her]> Oh? Where's that work?
15:05:28FromDiscord<Phil> I just realized, can't you basically enforce an "interface" of sorts onto a module by just... defining a forward declaration, putting that into a template you call `implements<ModuleName>` and that one you call at the start of your module ?
15:05:45FromDiscord<Chronos [She/Her]> How would that work?
15:05:54FromDiscord<leorize> https://github.com/nim-lang/Nim/pull/16396
15:05:55FromDiscord<Phil> One sec, trying it out
15:06:46FromDiscord<Chronos [She/Her]> In reply to @leorize "https://github.com/nim-lang/Nim/pull/16396": Ooh epic
15:08:37FromDiscord<Phil> Actually the template approach doesn't work, but I just found my first usecase for an include
15:08:51FromDiscord<Chronos [She/Her]> Oof
15:08:57FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K0P
15:09:26FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K0Q
15:09:44FromDiscord<Phil> Now the important question is whether this actually works for swapping out modules, I'll need a bit longer for that
15:10:17FromDiscord<Phil> Though what I'm doing feels like it's an ancient mechanism that has been in use before by tons of people and like leorize is about to come around the corner and tell me "well duh, that's what this is for"
15:11:02FromDiscord<Chronos [She/Her]> Can't you just swap it out with a define flag?
15:11:10*CO2 joined #nim
15:11:16FromDiscord<leorize> we typically use that pattern for building modules with different code per platform
15:11:37FromDiscord<leorize> not for interfaces most of the time
15:11:49FromDiscord<Phil> I mean, that is kind of an interface no?
15:12:34FromDiscord<typistx> hi BOT you're pretty smart, are you using chatgpt or something?
15:12:47FromDiscord<Phil> In reply to @typistx "hi BOT you're pretty": matrix bridge, not a bot
15:12:59FromDiscord<leorize> that's what they want you to believe
15:13:00FromDiscord<typistx> oh, thanks. I was very impressed
15:13:40FromDiscord<Phil> In reply to @leorize "we typically use that": You just bundled the platform dependent code into one box and defined the operations it needs to perform via the forward declarations and the platform dependent boxes then implement that behaviour.↵That's an interface, or am I missing an important nuance here (pretty likely) ?
15:14:38FromDiscord<leorize> forward declarations are actually staged for removal
15:14:44FromDiscord<Phil> In nim?
15:14:50FromDiscord<Phil> Or in C?
15:14:58FromDiscord<leorize> yes↵(@Phil)
15:15:04FromDiscord<Phil> ... but why though?
15:15:38FromDiscord<jviega> Ideally if they're no longer needed 😉
15:15:47FromDiscord<leorize> once we manage to get rid of the need for function ordering then there's no reason to keep forward declarations around
15:16:10FromDiscord<Chronos [She/Her]> Aren't 'interfaces' a reason to keep them around?
15:16:15FromDiscord<leorize> that's one of supposed feature enabled by IC
15:16:31FromDiscord<Chronos [She/Her]> Interfaces with IC? Huh? How?
15:17:02FromDiscord<leorize> my messages go through the bridge so it'll come in a lil out of sync
15:17:13FromDiscord<Chronos [She/Her]> Ah
15:17:20FromDiscord<Chronos [She/Her]> So IC enables code reordering?
15:17:23FromDiscord<Phil> I'd need to ask can.l but in owlkettle he defines a forward declaration of a proc to later connect that to a proc the user can define.↵Like, I'm not sure if that might not just break event listeners in owlkettle.↵↵@can.l I'm not deep enough in the sauce, how important are forward declarations for us in owlkettle (ignoring that I just introduced useage of forward declarations within playground) ?
15:18:00FromDiscord<leorize> these days it's gonna be NIR↵(@Chronos [She/Her])
15:18:08FromDiscord<Chronos [She/Her]> Gucci
15:18:37FromDiscord<leorize> but that's only if it's done, been some years since that idea floated around
15:19:40FromDiscord<Phil> Sidenote, forward declarations seem like it could be the thing that C uses to declare "interfaces" or the like
15:19:44FromDiscord<Phil> Would that be a correct assessment?
15:20:01FromDiscord<leorize> no one uses it for that
15:20:04FromDiscord<Phil> Basically a tool to decouple implementations
15:20:07FromDiscord<Phil> Huh
15:20:38FromDiscord<leorize> forward declarations has always been there to solve the ordering problem
15:21:11FromDiscord<Phil> Does C have a decoupling tool then?
15:21:28FromDiscord<Phil> Wait what am I talking, of course it has, I've seen it in the gtk docs
15:21:35FromDiscord<Chronos [She/Her]> Wonder if a macro could be made for interfaces then :p
15:21:58FromDiscord<leorize> in C they do double duties as library interface list, but if you don't implement a prototype it's just treated as if a library will provide it at link time
15:22:16FromDiscord<gyatsoyt> Does anyone have documentation of nimpy not there GitHub page it's not explained properly there or I should say I don't understand it
15:22:27FromDiscord<Phil> I can't claim to say I understand C interfaces, but I can say it has them
15:22:38FromDiscord<leorize> many had↵(@Chronos [She/Her])
15:22:42FromDiscord<leorize> none got enough traction
15:22:47FromDiscord<Chronos [She/Her]> Ah fair
15:23:38FromDiscord<Phil> In reply to @gyatsoyt "Does anyone have documentation": What's the issue?↵I mean I used it at a time to use pythons openssl lib and it was pretty unproblematic
15:24:32FromDiscord<gyatsoyt> In reply to @isofruit "What's the issue? I": How do I use nimpy to import python modules?
15:24:58FromDiscord<gyatsoyt> Like can I use pip to download the python module and then nim for nimpy
15:25:10FromDiscord<leorize> the way it's done in C is the same as nim↵(@Phil)
15:25:18FromDiscord<leorize> just an object with function pointers
15:25:31FromDiscord<Phil> ... but nim doesn't have interfaces, so the answer is "they don't" ?
15:25:34FromDiscord<gyatsoyt> I think anything downloaded from pip is installed in the pc itself and also replit doesn't let you use pip and nimble at the same time
15:25:49FromDiscord<leorize> yep
15:26:01FromDiscord<gyatsoyt> So how can I do that
15:26:31FromDiscord<Phil> In reply to @gyatsoyt "How do I use": Does `pyImport("<libname>")` not do it?↵Let me check if I can get a pretty print example going
15:27:03FromDiscord<gyatsoyt> In reply to @isofruit "Does `pyImport("<libname>")` not do": Can you import the chess library from python
15:29:36FromDiscord<Phil> I don't even know the chess library
15:44:59NimEventerNew post on r/nim by Robert_Bobbinson: Need help with generics, see https://reddit.com/r/nim/comments/17gzfel/need_help_with_generics/
15:46:44FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K11
15:47:40FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4K11" => "https://play.nim-lang.org/#ix=4K12"
15:47:57FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4K12" => "https://play.nim-lang.org/#ix=4K13"
15:53:10FromDiscord<gyatsoyt> Ohkk
15:53:29FromDiscord<gyatsoyt> Understood
15:59:52FromDiscord<Phil> (For those confused: I deleted the Nimeventer message because the OP of that reddit thread deleted it)
16:02:41*junaid_ joined #nim
16:06:59*junaid_ quit (Remote host closed the connection)
16:23:27*beholders_eye quit (Ping timeout: 240 seconds)
16:25:30*beholders_eye joined #nim
16:47:26FromDiscord<wick3dr0se> @Phil Thanks for sharing all that.. I'm going to hop on adding some test. So the ## doc comments literally generate docs?
16:48:42FromDiscord<Phil> In reply to @wick3dr0se "<@180601887916163073> Thanks for sharing": If you run nim doc then yeah.↵Prologue uses them for example, as does Snorlogue:↵https://philippmdoerner.github.io/Snorlogue/snorlogue.html↵https://philippmdoerner.github.io/Snorlogue/snorlogue.html
16:48:54FromDiscord<Phil> (edit) "Snorlogue:↵https://philippmdoerner.github.io/Snorlogue/snorlogue.html↵https://philippmdoerner.github.io/Snorlogue/snorlogue.html" => "Snorlogue:↵https://philippmdoerner.github.io/Snorlogue/snorlogue.html↵https://planety.github.io/prologue/coreapi/application.html"
16:49:12FromDiscord<Phil> (Snorlogue is a prologue extension, I am not the best at naming)
16:49:46FromDiscord<wick3dr0se> Naming is the hardest part
16:50:03FromDiscord<wick3dr0se> Thats sick. I have much to read
16:51:40FromDiscord<wick3dr0se> I was mainly concerned I should be passing pointers or handling things different. I know everything works from manual test as it sits but I just don't want to rewrite it again
16:53:22FromDiscord<Phil> sent a long message, see http://ix.io/4K1i
16:54:10FromDiscord<Chronos [She/Her]> ~~Sadly Debby doesn't support value types~~
16:56:19FromDiscord<Phil> In reply to @wick3dr0se "I was mainly concerned": I can say so far that using ref-types seems consistent with what I've seen generally used, e.g. in prologue
16:57:19FromDiscord<Phil> For general advice regarding servers you could ask guzba since he's writing an http server (mummy) and thus architectural concerns there may carry over to IRC servers (maybe?)
17:10:32*krux02 joined #nim
17:11:08*krux02 quit (Remote host closed the connection)
17:13:03FromDiscord<gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=4K1p
17:13:30FromDiscord<wick3dr0se> Well thanks for all your help! It's all been trial and error for me so far. Like I made Client and ChatChannel ref objects just because that's the only way it worked 🤣. Now that you say it that way it makes sense..
17:14:10FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K1q
17:14:31FromDiscord<Chronos [She/Her]> `{key: value}` is just a shortcut for an array of tuples, and they have to be actual types
17:14:45FromDiscord<Chronos [She/Her]> So `{"PAWN": 100}` will do what you want
17:14:52FromDiscord<Chronos [She/Her]> Though an enum may do it better, tbh
17:15:31FromDiscord<gyatsoyt> Btw there isn't a reversed function
17:15:35FromDiscord<gyatsoyt> Like python has
17:16:58FromDiscord<Phil> You mean this reverse function:↵https://nim-lang.org/docs/algorithm.html#reverse%2CopenArray%5BT%5D↵😛
17:17:03FromDiscord<Phil> (edit) "function:↵https://nim-lang.org/docs/algorithm.html#reverse%2CopenArray%5BT%5D↵😛" => "function?↵https://nim-lang.org/docs/algorithm.html#reverse%2CopenArray%5BT%5D↵😛"
17:18:02FromDiscord<Phil> In reply to @gyatsoyt "Btw there isn't a": Generally btw I recommend if you're looking for a proc and have a keyword or so in mind, use the search bar on the left-hand side in the nim docs, it's helped me out pretty often! https://media.discordapp.net/attachments/371759389889003532/1167150154718118100/image.png?ex=654d1449&is=653a9f49&hm=c4eee6b0b3a59f5125dfb9123c2f44bed870c649aa58ef3655498fcc97823b5b&
17:20:11FromDiscord<gyatsoyt> In reply to @isofruit "Generally btw I recommend": Thanks for the info
17:21:52FromDiscord<gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=4K1t
17:23:40FromDiscord<Phil> Could you post also your imports? Those may be important here
17:25:47FromDiscord<gyatsoyt> In reply to @isofruit "Could you post also": Sure
17:26:11FromDiscord<gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=4K1v
17:26:22FromDiscord<gyatsoyt> There they are
17:27:31FromDiscord<Chronos [She/Her]> Honestly I'd recommend rolling your own thing rather than borrowing from Python
17:27:40FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K1w
17:27:53FromDiscord<Chronos [She/Her]> For two main reasons:↵1. Learning experience↵2. Cleaner interaction with Nim code
17:28:05FromDiscord<Phil> If you use a python thing and then want to call a nim-proc on whatever python spit out to you, you need to use `to(<nimType>)`
17:28:14FromDiscord<Chronos [She/Her]> Nimpy does a great job, don't get me wrong, it's just... It's not native Nim :p
17:28:18FromDiscord<gyatsoyt> In reply to @chronos.vitaqua "Honestly I'd recommend rolling": The Library is too big for me to make it in nim
17:28:41FromDiscord<Phil> In reply to @chronos.vitaqua "For two main reasons:": You're missing the context here that he wants to use a chess lib that we just don't have 😉
17:28:46FromDiscord<Chronos [She/Her]> Why don't you port only what's needed? Surely it isn't too hard?
17:29:01FromDiscord<gyatsoyt> In reply to @isofruit "Hmmm do you assign": I didn't assign reversed variable anywhere
17:29:12FromDiscord<gyatsoyt> In reply to @isofruit "You're missing the context": Yes
17:29:20FromDiscord<gyatsoyt> In reply to @chronos.vitaqua "Why don't you port": I need the whole thing
17:29:26FromDiscord<Chronos [She/Her]> Ah
17:29:30FromDiscord<gyatsoyt> I am using most of the functions offered by the lib
17:29:35FromDiscord<gyatsoyt> That's why
17:29:40FromDiscord<Chronos [She/Her]> Fair enough
17:29:47FromDiscord<Phil> Okay, next question then, could you post the entire file then?
17:29:54FromDiscord<gyatsoyt> In reply to @isofruit "Okay, next question then,": Sure
17:29:59FromDiscord<Chronos [She/Her]> Keep in mind this means you have to have a Python runtime :p
17:30:08FromDiscord<Chronos [She/Her]> Wherever this runs
17:30:11FromDiscord<Phil> I already elaborated on that bit 😛
17:30:14FromDiscord<Chronos [She/Her]> Where ever?
17:30:15FromDiscord<Chronos [She/Her]> Ah
17:30:22FromDiscord<gyatsoyt> Yes Ik that
17:30:32FromDiscord<gyatsoyt> Can't post it directly
17:30:37FromDiscord<gyatsoyt> Should I use sourcebin
17:30:39FromDiscord<Phil> Anyway there's something going on here.↵The snippets you posted don't hint at you using a python object anywhere
17:30:55FromDiscord<Phil> That or just https://play.nim-lang.org/
17:30:59FromDiscord<Phil> It has a share button
17:32:02FromDiscord<gyatsoyt> In reply to @isofruit "That or just https://play.nim-lang.org/": Can't paste there idk why it happens
17:32:08FromDiscord<gyatsoyt> https://srcb.in/WXAb4SHc7p
17:32:19FromDiscord<gyatsoyt> That's the sourcebin link of the whole file
17:34:58FromDiscord<Phil> I can't seem to replicate.↵Could you replace line 26: ` pawnEvalBlack: seq[int] = pawnEvalWhite.reversed()`↵and import `import std/algorithm`↵Run again and copy paste the text ideally of the entire stacktrace?
17:35:32FromDiscord<gyatsoyt> It seems to work when I do the above changes
17:35:49FromDiscord<gyatsoyt> It goes to the next reverse which I haven't changed till now btw
17:36:04FromDiscord<Chronos [She/Her]> Hm, in Debby, `createIndex` has this doc comment, but running the app says the table doesn't exist `Creates a table, errors out if it already exists.`
17:36:08FromDiscord<Phil> Aye.↵Your issue here is that `reverse` doesn't spit out the same type you put in, it always spits out an array
17:36:13FromDiscord<Chronos [She/Her]> I assumed they were mutually exclusive
17:36:26FromDiscord<gyatsoyt> In reply to @isofruit "Aye. Your issue here": Hmm
17:36:39FromDiscord<Chronos [She/Her]> In reply to @gyatsoyt "Hmm": Solved with `toSeq`
17:36:58FromDiscord<Chronos [She/Her]> It's a function from `sequtils` that turns any array/iterator into a sequence
17:37:31FromDiscord<gyatsoyt> So after .reversed().toSeq
17:37:33FromDiscord<gyatsoyt> Right
17:37:35FromDiscord<Chronos [She/Her]> Yep
17:38:27FromDiscord<gyatsoyt> Ohk
17:38:30FromDiscord<Phil> Wait why? reversed already spits out a seq no?
17:38:41FromDiscord<Phil> toSeq should be unnecessary
17:39:28FromDiscord<Phil> In reply to @gyatsoyt "Ohk": Is it important for you that it's array[64, int], like is that a performance optimization or something python needs or the like?
17:39:35FromDiscord<Chronos [She/Her]> 🤷‍♀️
17:42:56FromDiscord<gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=4K1A
17:43:36FromDiscord<Phil> I mean, generally it means the compiler doesn't know the type of something.↵To know what that something is you'll have to post what line 96 is 😛
17:44:08FromDiscord<gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=4K1B
17:44:08FromDiscord<gyatsoyt> This is line 96
17:46:12FromDiscord<Phil> Ahhh python doesn't do types, I missed that when I skimmed over the code
17:46:15FromDiscord<Chronos [She/Her]> Anyone know if Debby's `filter` raises an error if it can't find a query?
17:46:22FromDiscord<Phil> You can't use a python type for a nim type declaration
17:46:37FromDiscord<gyatsoyt> In reply to @isofruit "You can't use a": So what should I do
17:46:37FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K1E
17:46:51FromDiscord<Phil> Under the hood it's all `PyObject`
17:47:33FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K1F
17:47:45FromDiscord<Chronos [She/Her]> In reply to @chronos.vitaqua "Anyone know if Debby's": Source doesn't reveal much, really
17:48:06FromDiscord<Phil> Therefore:↵`proc moveValue(board: PyObject, move: PyObject, endgame: bool): float`
17:48:07FromDiscord<Chronos [She/Her]> Oh prolly returns an empty seq
17:48:09FromDiscord<Phil> HOWEVER
17:48:41FromDiscord<gyatsoyt> ?
17:50:29FromDiscord<gyatsoyt> ?
17:50:46FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K1H
17:51:08FromDiscord<Phil> Basically you'd double the code as you'd represent the Python types in your nim code via `distinct` types and define procs for them based on that
17:51:21FromDiscord<gyatsoyt> Hm
17:51:37FromDiscord<Phil> That gives you the type safety that you'd otherwise loose, however it means more code
17:51:58FromDiscord<Phil> The alternative is you just make everything a PyObject and you yourself need to keep in mind to only pass in the correct PyObject
17:52:11FromDiscord<gyatsoyt> When I important the library can't I just simply do that everything from the lib is PyObject
17:52:33FromDiscord<Phil> You can, the `discint PyObject` approach is just an option
17:52:48FromDiscord<Phil> It grants you more type-safety which python doesn't have, but in exchange means more code
17:53:14FromDiscord<Phil> Just wanted you to be aware of your options 😄
17:53:23FromDiscord<gyatsoyt> Ohk
17:53:24FromDiscord<gyatsoyt> Well
17:53:41FromDiscord<Phil> The benefit of the distinct PyObject approach is that you get the compiler guaranteeing you that you're using the correct PyObject for a given proc every time
17:53:51FromDiscord<Phil> The drawback as stated is it's tedious as fuck to write
17:53:54FromDiscord<Phil> (edit) "The drawback as stated is it's tedious as fuck to write ... " added "initially"
17:54:14FromDiscord<gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=4K1J
18:00:47FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K1M
18:01:05FromDiscord<Phil> Same for BLACK, there is no inherent constant like BLACK↵Depending on which python module that is from, you'll need to import it in a similar fashion
18:01:47FromDiscord<gyatsoyt> BLACK is just colour
18:02:00FromDiscord<gyatsoyt> For the players either white or black
18:02:02FromDiscord<Phil> Which python module is that?
18:02:08FromDiscord<Phil> Or is that from chess?
18:02:56FromDiscord<gyatsoyt> Its. From chess
18:03:13FromDiscord<Phil> In that case that likely needs to be chess.BLACK (if that's what the constant is called there)
18:04:07FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K1O
18:06:30FromDiscord<gyatsoyt> Too much coding for today
18:06:32FromDiscord<gyatsoyt> 💀
18:06:37FromDiscord<gyatsoyt> Lemme go to sleep
18:06:47FromDiscord<gyatsoyt> I'll do the bug hunting Tommorow
18:06:51Amun-Raimport std/times first
18:07:12FromDiscord<gyatsoyt> In reply to @Amun-Ra "import std/times first": Why?
18:07:47Amun-Ragyatsoyt: ah, sleep is in std/os, sorry ;)
18:10:25FromDiscord<Phil> In reply to @gyatsoyt "Too much coding for": Have a good time 😉
18:21:11FromDiscord<Chronos [She/Her]> Odd
18:21:50FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K1Q
18:22:01FromDiscord<Chronos [She/Her]> I'm not sure how I'm supposed to do this now :p
18:22:24FromDiscord<Chronos [She/Her]> `Error: unhandled exception: /home/chronos/.nimble/pkgs2/debby-0.1.0-8c1f026929658b00c692f86b7d3c6086221fa3ef/debby/common.nim(283, 7) `false` nnkCall not supported: Call` Debby gives that error during compilation
18:23:41FromDiscord<griffith1deadly> In reply to @chronos.vitaqua "`Error: unhandled exception: /home/chronos/.nimble/": you can't use in filter advanced values as call
18:24:04FromDiscord<griffith1deadly> as i recall only static values or need place it in variable
18:24:08FromDiscord<Chronos [She/Her]> Ah, removing the templates showed the error
18:24:15FromDiscord<Chronos [She/Her]> Yeah that sucks oof
18:25:37FromDiscord<Chronos [She/Her]> That still doesn't work... Mega oof
18:25:37FromDiscord<griffith1deadly> In reply to @griffith1deadly "as i recall only": because this template/macro only translate given value in sql and no magic
18:25:48FromDiscord<Chronos [She/Her]> In reply to @griffith1deadly "because this template/macro only": That sucks rip
18:27:10FromDiscord<Chronos [She/Her]> Putting it in a variable didn't work... I think it only works with static variables?
18:27:20FromDiscord<user2m> is there a way to set all fields of an object o be exported?
18:27:27FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K1R
18:27:49FromDiscord<griffith1deadly> In reply to @isofruit "My guy, filterIt, not": filter it proc from debby, filter from db
18:27:59FromDiscord<Chronos [She/Her]> In reply to @isofruit "My guy, filterIt, not": My guy, this is Debby 😛
18:28:15FromDiscord<Phil> I sue for inconsistent API with sequtils!
18:28:34FromDiscord<Chronos [She/Her]> In reply to @chronos.vitaqua "Putting it in a": Figured it out, it's bc of how the macro works, doesn't like the afct I'm doing `app.db` instead of `db`
18:29:34FromDiscord<griffith1deadly> In reply to @chronos.vitaqua "Figured it out, it's": and it's odd at some points, why the author chose to use this particular one
18:30:06FromDiscord<Chronos [She/Her]> Could likely be fixed by passing `db` to the macro tbh
18:30:36FromDiscord<Chronos [She/Her]> May do a fork and see if I can modify a few things tbh :p
18:30:49FromDiscord<Chronos [She/Her]> Then ✨ pr ✨
18:31:16FromDiscord<griffith1deadly> then also add @onetomany and @manytoone functionality 😛
18:32:03FromDiscord<Chronos [She/Her]> Explain? :p
18:32:39*CO2 quit (Quit: WeeChat 4.1.0)
18:32:46FromDiscord<Phil> Does debby not have ways to auto-fetch one-to-many relationships on an object?
18:33:39FromDiscord<griffith1deadly> In reply to @isofruit "Does debby not have": debby doesn't have this
18:33:57FromDiscord<Phil> ...erm... I'm surprised is all I can say to that
18:34:06FromDiscord<griffith1deadly> In reply to @chronos.vitaqua "Explain? :p": https://www.baeldung.com/hibernate-one-to-many
18:34:08FromDiscord<Phil> I mean, not that norm has that solved that much better but we got at least a proc I guess
18:34:12*CO2 joined #nim
18:41:57FromDiscord<Chronos [She/Her]> Seems complicated-
18:42:05FromDiscord<Phil> Ehhhhhhhh depends
18:42:14FromDiscord<Phil> I mean, treeform already provided a pretty slick DSL
18:42:26FromDiscord<Phil> Solving many-to-one isn't necessarily harder than that
18:43:34FromDiscord<Chronos [She/Her]> You mean `filter`?
18:43:37FromDiscord<Chronos [She/Her]> Or
18:47:14FromDiscord<Chronos [She/Her]> My first change to Debby worked :p
18:47:47FromDiscord<Phil> Providing a many-to-one feature ultimately is about allowing a field on your object that is a `seq[ManyType]` on the type that is the "OneType".↵And then based on that instructing debby how to generate the corresponding SQL
18:48:04FromDiscord<Phil> (edit) "Providing a many-to-one feature ultimately is about allowing a field on your object that is a `seq[ManyType]` on the type that is the "OneType".↵And then based on that instructing debby how to generate the corresponding SQL ... " added "to fetch that"
18:48:24FromDiscord<Phil> If you want to be fully featured, then it's also about allowing you to define "eager" or "lazy" loading of the seq[ManyType] field
18:48:39FromDiscord<Chronos [She/Her]> I understand none of that~
18:49:28FromDiscord<Chronos [She/Her]> Though rn I'm wondering if it's possible for me to execute the expression for stuff like `state.get()` to make it a bit nicer hm... Probably too much of a pain tbh
18:49:31FromDiscord<Phil> Hmmm I may have expressed that none too great
18:49:52FromDiscord<griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=4K1W
18:50:02FromDiscord<Chronos [She/Her]> Ah, does that not already work?
18:50:11FromDiscord<Phil> Beats me, never used debby
18:50:32FromDiscord<griffith1deadly> In reply to @chronos.vitaqua "Ah, does that not": already it just can mapped to json 😛
18:51:06FromDiscord<Phil> That was not a sentence I can parse
18:51:55FromDiscord<griffith1deadly> (edit) "In reply to @chronos.vitaqua "Ah, does that not": already it just can ... mapped" added "be"
18:52:26FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4K1Y
18:53:30FromDiscord<Phil> Sadly that'll net you in object variant territory
18:53:42FromDiscord<Phil> Which is basically nim's version of a union type.
18:55:17FromDiscord<user2m> ok tthawt's hat I was thinking
18:55:31FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K20
18:55:47FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4K20" => "https://play.nim-lang.org/#ix=4K21"
18:56:33FromDiscord<user2m> perfect thank you @Phil!
18:56:35FromDiscord<user2m> @Phil
18:56:50FromDiscord<Phil> Happy to help 😄
18:57:57FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4K22
18:58:16FromDiscord<user2m> I can create a proc for this but it's just annoying
18:58:48FromDiscord<griffith1deadly> variant field's cant be named same
18:59:14FromDiscord<user2m> lol I see that
19:00:16FromDiscord<Chronos [She/Her]> Okay yeah I really wanna make Debby a bit nicer in terms of filters and such, just... Need a way to parse them nicely :p
19:00:53FromDiscord<Phil> In reply to @user2m "the only issue now": I can relate, but also I don't think it's that big of a deal.↵note that you're kinda lucky with your API.↵You could've had both of them return values and if it were async it'd be type A and not async type B, that'd be a whole load of fun
19:02:37FromDiscord<Chronos [She/Her]> Is it possible to have a macro generate a node that's executed at runtime, but still can pass that value back? :p
19:02:53FromDiscord<Phil> Nimnode doesn't exist at runtime I don't think
19:02:59FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K26
19:03:04FromDiscord<Phil> NimNode afterall generates code
19:03:14FromDiscord<Phil> And code must exist at compiletime to be compiled
19:03:18FromDiscord<Phil> There is no aftercompiling
19:03:19FromDiscord<Chronos [She/Her]> So I want to figure out how to get that to be executed... Since rn Debby just gives the literals
19:03:27FromDiscord<Chronos [She/Her]> In reply to @isofruit "Nimnode doesn't exist at": Ah
19:03:42FromDiscord<Chronos [She/Her]> Maybe it's time for me to try a smaaall tweaking of Debby's code-
19:03:58FromDiscord<Phil> ~~Immediately gets hammered by treeform~~
19:04:05FromDiscord<Chronos [She/Her]> Lmao probably will tbf
19:04:20FromDiscord<Phil> Nah, treeform is swell, he'll welcome contributions I think
19:04:48FromDiscord<Chronos [She/Her]> @treeform actually, if you're around: Would you accept a PR that allows for Debby `filter` statements to allow for calls and similar to be executed?
19:05:05FromDiscord<Chronos [She/Her]> Imo it makes code cleaner, even if it's just a small thing
19:05:36FromDiscord<Phil> You may need to define what you mean by "calls"
19:05:42FromDiscord<Chronos [She/Her]> I can definitely see some small issues popping up but I'll try and squash them
19:06:09FromDiscord<Chronos [She/Her]> Literally `nnkCall` aha, for example: `app.db.filter(State, it.val == state.get())`
19:06:46FromDiscord<griffith1deadly> i wonder if anyone has tried using kotlin libraries through jnim
19:08:57FromDiscord<Chronos [She/Her]> Making this robust will probably be a bit of a pain... oof
19:09:01FromDiscord<treeform> In reply to @chronos.vitaqua "<@107140179025735680> actually, if you're": Yes, if it has tests.
19:09:11FromDiscord<Chronos [She/Her]> Alright!
19:20:31*deadmarshal_ quit (Ping timeout: 260 seconds)
19:24:08FromDiscord<Chronos [She/Her]> I just added the call to the params list and added the query character to the list (idk the actual name) and it seems to work perfectly, I'll add a test for this now
19:24:20FromDiscord<Chronos [She/Her]> But just wondering... Am I missing something?
19:29:03*deadmarshal_ joined #nim
19:34:36*deadmarshal_ quit (Ping timeout: 272 seconds)
19:43:59*alice is now known as Guest7591
19:44:01*alice joined #nim
19:44:08*Guest7591 quit (Read error: Connection reset by peer)
19:49:39FromDiscord<Chronos [She/Her]> In reply to @chronos.vitaqua "But just wondering... Am": The answer was yes ✨
19:53:22NimEventerNew post on r/nim by user89443: Types: Wrapping the SketchUp c library, see https://reddit.com/r/nim/comments/17h4zr7/types_wrapping_the_sketchup_c_library/
19:59:47FromDiscord<can.l> In reply to @isofruit "I'd need to ask": The event listener implementation does not use forward declarations afaik, however their syntax is used for defining events. So if they were to be removed entirely, we would have to find a new syntax for event definitions.
20:00:14FromDiscord<Phil> In reply to @can.l "The event listener implementation": Ah, I conflated the two, my bad
20:00:50FromDiscord<Phil> My head just went "Wait, the syntax for defining how a proc must look like for us looks like forward declarations"
20:01:04FromDiscord<Phil> (edit) "us" => "us,"
20:01:46FromDiscord<Phil> Though I guess we could manage with just lambda's if push comes to shove?
20:02:06*deadmarshal_ joined #nim
20:02:40FromDiscord<Phil> Like, have a field `activate: proc(text: string) = proc(text: string) = discard`
20:02:50FromDiscord<Phil> (edit) "Like, have a field ... `activate:" added "on state"
20:03:34FromDiscord<can.l> I dont see why you have two `proc(text: string)` s, but generally yes.
20:04:13FromDiscord<can.l> All owlkettle code would have to be updated to use this new syntax though, so it might be slightly annoying to deal with.
20:04:53FromDiscord<Phil> In reply to @can.l "I dont see why": Default implementation, though that could also be nil I guess
20:05:09FromDiscord<Phil> Since it's just a pointer in the end
20:13:26FromDiscord<user2m> Does anyone know how to convert a JsObject to a regular nim object?
20:14:14FromDiscord<Elegantbeef> Don't use JsObject and use a normal Nim object
20:14:59FromDiscord<Phil> I mean Jsobject is sorta kinda a normal nim object, distantly
20:15:05FromDiscord<Phil> It inherits from RootObj
20:16:40FromDiscord<Elegantbeef> Right but my point is do not use JsObject and just declare your Nim object
20:16:55FromDiscord<Elegantbeef> JsObject is explicitly a typeless object and only to be used for dirty code
20:18:02FromDiscord<Chronos [She/Her]> I'm getting sorta close hmmm
20:18:19FromDiscord<nasuray> In reply to @user2m "Does anyone know how": https://nim-lang.org/docs/jsffi.html#to%2CJsObject%2Ctypedesc may be helpful
20:21:53FromDiscord<Chronos [She/Her]> Maybe it'd be fine to only allow calls with no params hm...
20:22:09FromDiscord<Chronos [She/Her]> Or as long as it doesn't have `it` in the params?
20:25:51FromDiscord<Chronos [She/Her]> Okay, this just isn't doable :p
20:25:59FromDiscord<Chronos [She/Her]> Well, probably is but not with my knowledge
20:26:45FromDiscord<Chronos [She/Her]> I did fix a minor thing tho
20:33:09FromDiscord<Chronos [She/Her]> I'm trying to figure out a way to support at least very simple calls hm...
20:33:32FromDiscord<Chronos [She/Her]> Like, there's no reason you shouldn't be able to do `myOption.get()` imo
20:38:46FromDiscord<Chronos [She/Her]> Honestly, main roadblock is figuring out a way to pass `it` to anything actually making use of the filtering stuff
20:41:24FromDiscord<Chronos [She/Her]> This would require more complex filtering though and would likely add some more time to the code since it'd have to evaluate every object that's fetched from the query so it can decide if it needs to be returned
20:41:29FromDiscord<Chronos [She/Her]> Hm...
20:53:57FromDiscord<Chronos [She/Her]> Hey Beef, do you think it'd be somewhat easy to reconstruct an AST from a macro to not have any call nodes? :p
20:54:41FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K2D
20:56:25FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K2E
20:57:13FromDiscord<ElegantBeouf> If you can describe it in words you can describe it in macro
20:57:24FromDiscord<Chronos [She/Her]> Sweet :D
20:57:31FromDiscord<Chronos [She/Her]> Now to figure out the logic for that-
20:59:11FromDiscord<Chronos [She/Her]> And then to also separate all calls into a separate list too-
21:02:31FromDiscord<Chronos [She/Her]> This is a pain to do, I can't pass around `NimNode`s like I would with a variable
21:02:38FromDiscord<Chronos [She/Her]> `var NimNode` is obviously invalid
21:02:46FromDiscord<Chronos [She/Her]> Ig two separate macros?
21:02:57FromDiscord<ElegantBeouf> `var NimNode` is not invalid
21:03:59FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K2H
21:04:08FromDiscord<ElegantBeouf> `proc callStripper(a, b: var NimNode)`
21:04:46FromDiscord<Chronos [She/Her]> Huh? But then that'd be at runtime, no?
21:04:51FromDiscord<Chronos [She/Her]> Idek how that'd work
21:04:56FromDiscord<ElegantBeouf> macros call procs
21:05:03FromDiscord<ElegantBeouf> They run at compile time
21:05:11FromDiscord<Chronos [She/Her]> Ah
21:05:22FromDiscord<Chronos [She/Her]> Eh, either way doing this differently is probably better
21:10:18*deadmarshal_ quit (Ping timeout: 260 seconds)
21:12:14FromDiscord<Chronos [She/Her]> Macros can't be recursive? :/
21:13:29FromDiscord<ElegantBeouf> Of course not
21:13:31FromDiscord<Chronos [She/Her]> Says 'recursive dependency'
21:13:43FromDiscord<Phil> I am mildly confused as to why you'd use recursive macros
21:13:45FromDiscord<Chronos [She/Her]> Tbf actually I can just use a loop
21:13:48FromDiscord<ElegantBeouf> Mutate this ast by mutating this ast by mutating an ast
21:13:55FromDiscord<ElegantBeouf> Just recurse down the NimNodes
21:13:58FromDiscord<Phil> Like, macros should be the entry point after which you only use procs to manipulate NimNodes
21:14:02FromDiscord<Chronos [She/Her]> Gucci
21:14:30FromDiscord<Phil> At least that's the coding style I've adopted with them and I haven't hit any limitations with that yet
21:14:53FromDiscord<Phil> Though I can't claim to have written a DSL in nim yet either
21:15:03FromDiscord<Phil> (edit) "either" => "either, which seems like a ton of work"
21:15:16FromDiscord<Chronos [She/Her]> Fair aha
21:18:06*deadmarshal_ joined #nim
21:23:29FromDiscord<leorize> I see that you're machoistic enough to use typed macros
21:23:29FromDiscord<leorize> they'll show every call but modifying those trees is a terrible experience
21:24:24FromDiscord<Phil> In reply to @leorize "I see that you're": Enlighten me again on what makes typed macros so much different from untyped ones
21:24:36FromDiscord<Chronos [She/Her]> The fact it all gets expanded :p
21:24:42FromDiscord<Elegantbeef> They're semantically checked
21:24:42FromDiscord<Phil> The main difference I was aware that with one I can follow the type definition node, with the other I can't
21:24:44FromDiscord<Chronos [She/Her]> I'm assuming that, at least
21:24:59FromDiscord<Phil> But... isn't that good?
21:25:10FromDiscord<Elegantbeef> This means the entire AST contains a bunch of junk and the typed AST is much worst for having a "spec"
21:25:19FromDiscord<Chronos [She/Her]> Ye
21:25:27FromDiscord<Chronos [She/Her]> Bunch of empty nodes is an example
21:25:46FromDiscord<Chronos [She/Her]> Like obviously needed, but yeah
21:25:59FromDiscord<Elegantbeef> `echo 10` -\> `nnkCall(sym"echo", nnkBracket(nnkHiddenConv(intLit 10)))`
21:28:33FromDiscord<Phil> Maybe I need to write a couple hundred more lines of macros to see the problem
21:28:50FromDiscord<Elegantbeef> It has "junk" that you need to traverse
21:28:51FromDiscord<Elegantbeef> That's pretty much it
21:29:41FromDiscord<Phil> I mean, chances are non-zero that I also simply haven't experienced the "less painful way" and so I can't contrast my experience
21:29:53FromDiscord<Phil> So far my view was just "it is what it is"
21:30:04*deadmarshal_ quit (Ping timeout: 245 seconds)
21:30:45FromDiscord<Phil> "Thing about the syntax you want to emulate, look at the pattern via dumpTree/dumpAstGen, replicate the NimNode pattern based on a given typed NimNode, done.
21:30:46FromDiscord<Phil> (edit) "done." => "done.""
21:30:49FromDiscord<Phil> (edit) ""Thing" => ""Think"
21:30:56FromDiscord<Phil> (edit) "emulate," => "have in the end,"
21:31:15FromDiscord<Phil> (edit) "based on" => "starting from"
21:31:33FromDiscord<Phil> Which has been extended to "Maybe use one of those fancy tools Beef sometimes tells me to"
21:31:41FromDiscord<Phil> (edit) "to"" => "to to generate that NimNode""
21:33:56FromDiscord<Chronos [She/Her]> Unsure how I'm supposed to kill off the parent and the call child-
21:34:03FromDiscord<Chronos [She/Her]> Yes that intentionally sounds horrid
21:34:28FromDiscord<Phil> "Yes officer, I have the murderer you're looking for here"
21:34:36FromDiscord<Chronos [She/Her]> Are there any edgecases where there's two child nodes underneath a parent, where I don't want to kill the parent?
21:35:02FromDiscord<Phil> Are you talking NimNodes?
21:35:17FromDiscord<Phil> If so, 1) How do you even "kill" a NimNode 2) why would you ever want to?
21:36:27FromDiscord<Chronos [She/Her]> Yep NimNodes
21:36:39FromDiscord<Chronos [She/Her]> Kill by just replacing the parent with a child
21:38:42FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K2W
21:39:17FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K2X
21:39:35FromDiscord<takemichihanagaki3129> What is the pragmatic difference of using Nimble to NimScript for binary projects?
21:40:32FromDiscord<takemichihanagaki3129> Let's say that my project does not use any external dependence and I don't want to publish it...
21:44:21FromDiscord<Chronos [She/Her]> Ah, if my `StmtList` only had one statement, will the compiler expand it? Or does my macro need to handle that?
21:44:57FromDiscord<Elegantbeef> Expand it how?
21:45:48FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K2Z
21:45:48FromDiscord<Phil> In reply to @chronos.vitaqua "Kill by just replacing": How is that kill, isn't that just a swapping out?
21:45:56FromDiscord<Chronos [She/Her]> (edit) "https://play.nim-lang.org/#ix=4K2Z" => "https://play.nim-lang.org/#ix=4K30"
21:46:08FromDiscord<Chronos [She/Her]> In reply to @isofruit "How is that kill,": Hey, I wanted to be edgy 😛
21:46:54FromDiscord<Phil> ...
21:46:57FromDiscord<Phil> I have been looking
21:46:59FromDiscord<Phil> Through the macros docs
21:47:03FromDiscord<Phil> for like 10 minutes
21:47:20FromDiscord<Chronos [She/Her]> I shouldn't laugh
21:47:30FromDiscord<Chronos [She/Her]> But oh my fucking god I'm sorry-
21:47:40FromDiscord<Phil> For anything that could be considered "kill" syntax to get an idea of what the heck you could be meaning! wag fingers accusatorily
21:48:01FromDiscord<Chronos [She/Her]> If it makes it any better- Killing the parent means just removing it and having the child take it's place!
21:48:35FromDiscord<Phil> I mean, I still don't get that one. That's basically making a macro that does `return parentNode[0]`
21:48:48FromDiscord<Chronos [She/Her]> It'd have to kill it's sibling too
21:48:56FromDiscord<Chronos [She/Her]> In reply to @chronos.vitaqua "My usecase is making": See here
21:49:42FromDiscord<Phil> I'd honestly, instead of bothering to manipulate that AST, extract the info I want and construct entirely new nimnodes
21:50:04FromDiscord<Chronos [She/Her]> I'm not too sure how I'd go about doing that tbh
21:50:14FromDiscord<Phil> I think that's why I'm so confused because I build the Nodes always de-novo
21:50:18FromDiscord<Chronos [She/Her]> I need to collect any calls anyway
21:50:22FromDiscord<Phil> (edit) "Nodes" => "Node-construct I want"
21:50:32FromDiscord<Chronos [She/Her]> Tho that doesn't stop me from doing it ig
21:50:59FromDiscord<Chronos [She/Her]> Yeah alright that'll probably be easier, actually
21:51:06FromDiscord<Chronos [She/Her]> Just got to hack the calls together :p
21:51:36*xet7 quit (Remote host closed the connection)
21:51:54FromDiscord<Phil> Like for reference, in mapster for example, I take in a NimNode and pump out another NimNode.↵Sure some of the NimNodes inside of that new NimNode were stolen from the input NimNode, but the general NimNode that gets returned is new
21:52:16FromDiscord<Phil> I regard macros fundamentally as `map` operations
21:52:31FromDiscord<Chronos [She/Her]> Makes sense
21:52:49FromDiscord<Chronos [She/Her]> Though I'm still struggling with mapping this out mentally tbh
21:52:52FromDiscord<Elegantbeef> Depends what you're doing
21:52:57FromDiscord<leorize> you get compiler junk, you get nodes that are syntactically incorrect and /is/ incorrect if you just copy them, you get weird compiler crashes after modifying a typed tree, and so on↵(@Phil)
21:53:01FromDiscord<Elegantbeef> A lot of the times copying the nodes and operating on them are easy enough
21:53:51FromDiscord<Phil> In reply to @leorize "you get compiler junk,": I think I just haven't had that experience yet, but I've only dealt lightly with macros.↵Basically inserted a couple statements in a proc as the extent I went, never made a DSL
21:54:11FromDiscord<leorize> you almost never need typed macros to build DSLs
21:54:24FromDiscord<leorize> in fact it's often that you need untyped for the DSL to even work
21:54:44FromDiscord<Phil> I mean I needed them for mapster because I needed information about the typedef-nodes of the types of some parameters
21:55:22FromDiscord<Chronos [She/Her]> In reply to @leorize "you almost never need": Unfortunately I'm not making a DSL here-
21:55:40FromDiscord<Phil> I didn't feel like a special case to me because it seemed normal to me that you'd often need to pull in type-information for a DSL, e.g. by having fields annotated with pragmas for extra information that is important for the DSL
21:56:15FromDiscord<leorize> I'll just refer you to this if you're writing anything complicated\: https://github.com/nim-works/cps/blob/d1bf2bf91101701c9019a9f405423da012e27518/cps/rewrites.nim#L117↵(@Chronos [She/Her])
21:57:00FromDiscord<leorize> if you're just working with definitions, then it's fine, the trouble is when you work with actual code↵(@Phil)
21:57:02FromDiscord<Phil> Though now that I think about it, I guess you don't normally have to analyse 2 types of 2 idents to see how you can connect them
21:58:13FromDiscord<Chronos [She/Her]> Thanks Leorize!
21:58:16FromDiscord<leorize> when you start modifying statements, you get weird things like `could not find an overload for foo(10): parameter 10 is of type void`
21:58:40FromDiscord<leorize> because the compiler forgot to typecheck the parameters
21:58:56FromDiscord<Chronos [She/Her]> Are `NimNode`s ref objects in the compiler? :p
21:59:18FromDiscord<Chronos [She/Her]> In reply to @leorize "when you start modifying": I'm not modifying them mostly, just culling the ones that are ignored
22:00:06FromDiscord<leorize> yes they are↵(@Chronos [She/Her])
22:00:15FromDiscord<leorize> and so is every object at compile-time
22:00:19FromDiscord<Chronos [She/Her]> Ah epic
22:04:44FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K34
22:14:33FromDiscord<wick3dr0se> In reply to @isofruit "Ah <@772217344680001556> I": Oh I didnt even see that part!! Thats so cool lol
22:14:42FromDiscord<wick3dr0se> Although tbh this part is a bit confusing
22:15:10FromDiscord<wick3dr0se> Ohhh the variable is the entire block
22:15:17FromDiscord<Phil> Hmm it may not appear to me as such from the time I dabbled in Rust which kinda made me grock expression based syntax
22:15:45FromDiscord<wick3dr0se> Wtf Nim can do some crazy shit
22:15:47FromDiscord<Phil> And yeah, basically you can treat the entire `block` block as one "proc" that gets executed and the last expression is the "result" that gets returned
22:16:39FromDiscord<wick3dr0se> Thats really cool. I could see a few areas it could possibly be useful for in the server as I dont need seperate procs for evrry little thing
22:16:43FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K38
22:17:14FromDiscord<Phil> That is unless you use `return` or `result`
22:17:38FromDiscord<wick3dr0se> I didnt know return was implicit at all
22:17:49FromDiscord<Elegantbeef> Unless you use result\
22:17:56FromDiscord<wick3dr0se> Yea thats sick
22:17:56FromDiscord<Phil> Yeh, nim basically has 3 ways to return
22:17:58FromDiscord<System64 ~ Flandre Scarlet> Is there a Nim language server for Geany please?
22:18:10FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/Bhox8
22:18:18FromDiscord<Phil> I mean that's early returning
22:18:18FromDiscord<wick3dr0se> But is it preferred to use return anyway?
22:18:21FromDiscord<wick3dr0se> Or result?
22:19:00FromDiscord<Phil> Status prefers result because it is less... buggy or sth?↵I can't say I've ever run into any problems.↵I personally use all three in different situations
22:19:27FromDiscord<Phil> `result` when I need to build up a value over several lines of code.↵`return` for guard clauses or by default in general↵`expression` for one-liner procs
22:19:42FromDiscord<Phil> (edit) "procs" => "procs, e.g. `proc double(x: int): int = 2x`"
22:20:00FromDiscord<Phil> (In that one 2x is strictly speaking using the expression syntax to return)
22:20:00FromDiscord<wick3dr0se> That makes sense to me
22:20:24FromDiscord<wick3dr0se> I'm really wanting to learn the magic of macros.. I just started learning templates and that blew my mind 🤣
22:20:38FromDiscord<wick3dr0se> Gotta start reading more
22:21:11FromDiscord<Chronos [She/Her]> https://play.nim-lang.org/#ix=4K3a this is what I have so far... Now I need a way to go through recursively, but that means I need to scan the parent again... :/
22:21:12FromDiscord<Phil> In reply to @wick3dr0se "I'm really wanting to": Honestly I have only found like one to two valid uses for template↵And yeah, macros are a large field, ideally you have a solid footing in the language in general before tackling, it allows you to focus more solely on the macro aspect of it all ^^
22:21:35FromDiscord<Chronos [She/Her]> In reply to @chronos.vitaqua "https://play.nim-lang.org/#ix=4K3a this is what": Since I modify the parent
22:22:03FromDiscord<Phil> Usecase 1 for template:↵Context-Managers like in python.↵Usecase 2 for templates:↵... like being able to apply `fieldPiars` iterator to ref-types and normal-types and not having to care for the difference between them.
22:22:27FromDiscord<Phil> Beyond that I can't say I ever needed them rather than generic procs or macros
22:23:03FromDiscord<Elegantbeef> Sure but it's still an expressio
22:23:47FromDiscord<Phil> Man the bridge delayed that
22:24:02FromDiscord<ElegantBeouf> Yea I figured with the lack of response 😄
22:24:47FromDiscord<Chronos [She/Her]> Struggle™️
22:25:05FromDiscord<ElegantBeouf> In reply to @isofruit "**Status** prefers result because": They prefer expression -> return -> result as it's more explicit and less likely to have unmanaged branches
22:25:11FromDiscord<Phil> I have a valid reason for not supporting you Chronos: I'm too tired and what you're doing is too complicated xP
22:25:37FromDiscord<wick3dr0se> sent a code paste, see https://play.nim-lang.org/#ix=4K3d
22:25:46FromDiscord<Chronos [She/Her]> In reply to @isofruit "I have a valid": It's alright, dw aha
22:25:51FromDiscord<Chronos [She/Her]> I just love complaining :p
22:26:04FromDiscord<ElegantBeouf> In reply to @wick3dr0se "What do you think": It's "fine", one might argue a normal proc is more sensible there
22:26:50FromDiscord<Phil> In reply to @wick3dr0se "What do you think": I'd not name it `hasArgs` because `hasArgs` the name promises me that this is something that returns me a boolean that is true/false, which this doesn't do
22:26:59FromDiscord<ElegantBeouf> sent a code paste, see https://play.nim-lang.org/#ix=4K3e
22:27:25FromDiscord<wick3dr0se> Oh shit i didnt know we could do that either
22:27:30FromDiscord<wick3dr0se> Im learning a fuck ton today
22:27:35FromDiscord<Phil> Name it after the context it is supposed to provide, like `withArgs`
22:28:14FromDiscord<wick3dr0se> Alright that makes sense.. Naming is so hard lol
22:28:18FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K3g
22:28:37FromDiscord<Phil> Or I guess `client.withArgs(minArgs = 3)`
22:29:03FromDiscord<wick3dr0se> Wait so I can specify a procedure or do()?
22:29:06FromDiscord<Phil> (At least I think you can do the parameter assignment like this in templates as well)
22:29:10FromDiscord<ElegantBeouf> In reply to @wick3dr0se "Wait so I can": Yes
22:29:22FromDiscord<ElegantBeouf> `do(...) -> T` is syntax sugar for an anonymous procedure
22:29:48FromDiscord<wick3dr0se> Damn thats majestic
22:30:40FromDiscord<Chronos [She/Her]> My macro does jackshit to the AST oof
22:31:11FromDiscord<Phil> Well maybe have it do nice things to the AST then 😛
22:32:17FromDiscord<Phil> I believe in you bridge. One of these days you can actually catch up with what has been posted in discord like 5 minutes ago
22:32:29FromDiscord<Elegantbeef> One day I'll write a matrix bridge, I swear it 😄
22:32:41FromDiscord<Phil> Let me jot that down real quick so I can hold you to it xP
22:34:54FromDiscord<Phil> ... well the bridge dropped a couple messages from chronos but... it's caught up I guess, yay?
22:36:07FromDiscord<Chronos [She/Her]> I am still pain-
22:37:24FromDiscord<Chronos [She/Her]> https://play.nim-lang.org/#ix=4K3n
22:37:31FromDiscord<Chronos [She/Her]> This does nothing
22:37:51FromDiscord<Chronos [She/Her]> Maybe... I'll try a new node from scratch
22:38:30FromDiscord<ElegantBeouf> Just make a proc that recurses down the tree replacing nodes
22:38:57FromDiscord<Chronos [She/Her]> That's what I tried to do :p
22:39:08FromDiscord<Elegantbeef> No you wrote a proc that .... does something
22:39:28FromDiscord<Chronos [She/Her]> Lol
22:39:35FromDiscord<Chronos [She/Her]> What does it do Beef
22:39:40FromDiscord<Elegantbeef> No clue
22:39:42FromDiscord<Chronos [She/Her]> Because for the love of god I am lost
22:40:48FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4K3p
22:41:07FromDiscord<Chronos [She/Her]> Huh?
22:41:37FromDiscord<Chronos [She/Her]> Ah
22:41:51FromDiscord<Elegantbeef> I don't know what you `stripCall` was doing, so I approximated what it should do
22:41:56FromDiscord<Chronos [She/Her]> But I need to remove the `Infix`-
22:42:09FromDiscord<Chronos [She/Her]> Fair enough aha
22:42:15FromDiscord<Chronos [She/Her]> Hm...
22:42:43FromDiscord<Chronos [She/Her]> I think I can work with this-
22:46:05FromDiscord<Chronos [She/Her]> I need to set `parent` to a completely different node oof
22:50:32*deadmarshal_ joined #nim
22:50:54FromDiscord<Chronos [She/Her]> Maybe I'm going about this wrong
22:51:34FromDiscord<Chronos [She/Her]> Sigh
22:51:56FromDiscord<Phil> I mean of course, your procs for example aren't first validating that the Nodes they're getting are of specific kinds that you allow and don't throw errors if the kinds don't match what you allow!
22:52:32FromDiscord<Phil> (edit) "I mean of course, your procs for example aren't first validating that the Nodes they're getting are of specific kinds that you allow and don't throw errors if the kinds don't match what you allow! ... " added "😄"
22:52:49FromDiscord<Chronos [She/Her]> Yeah-
22:52:55FromDiscord<Chronos [She/Her]> I don't like ASTs :p
23:00:13FromDiscord<Phil> Eh, I like the flexibility they provide
23:00:25FromDiscord<Phil> It's there when I need it, I like that kind of tooling
23:00:51FromDiscord<Phil> I mean, after all it allows for owlkettle's DSL which I like in temrs of useage
23:00:55FromDiscord<Phil> (edit) "temrs" => "terms"
23:01:08FromDiscord<Phil> ~~Not that I understand the implementation, but I like using it!~~
23:11:09FromDiscord<Chronos [She/Her]> I'll do more of this stuff tomorrow :p
23:33:55FromDiscord<user2m> how do you convert a cstring to a string? I'm in nim 2.0.0 and I feel like abkc in 1.6.12 I could do $myCstring but that dowesn't ork anymore
23:37:04FromDiscord<.elcritch> In reply to @user2m "how do you convert": As far as I know $my string should work. Maybe you need a parenthesis?
23:37:13FromDiscord<Elegantbeef> It still should
23:38:24FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4K3x
23:38:58FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4K3y
23:39:28FromDiscord<user2m> `innerText` is cstring
23:40:09FromDiscord<user2m> ok I think this did it `let last_inv_num = parseInt($(inv_num_field.innerText))`
23:40:10FromDiscord<Elegantbeef> That's a unary operator that binds on the entire expression
23:40:14FromDiscord<Elegantbeef> you want ($inv\_num\_field.innerText).parseint
23:40:14FromDiscord<Elegantbeef> or `parseInt ...`