00:00:11 | * | antranigv quit (Quit: ZNC 1.8.2 - https://znc.in) |
00:00:37 | * | antranigv joined #nim |
00:02:42 | FromDiscord | <pcarrier> @typistx what do you mean by not supported? arm, arm64, risc32, riscv64 are in the list of platforms |
00:03:37 | Amun-Ra | he confused cpu arch with platform |
00:03:55 | FromDiscord | <typistx> https://media.discordapp.net/attachments/371759389889003532/1166889910117072896/image.png?ex=654c21ea&is=6539acea&hm=b685cc3fa31dc8d873a6f135fc360121721f3a8df1c669c74a846dee49faf822& |
00:04:21 | Amun-Ra | there are some third party projects for bare metal/embedded |
00:05:11 | Amun-Ra | these are tier 1 |
00:06:24 | FromDiscord | <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:17 | FromDiscord | <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:23 | Amun-Ra | you 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:32 | Amun-Ra | I wrote a program for AmigaOS 3.x (m68k cpu); neither the platform nor the cpu is listed anywhere |
00:14:00 | Amun-Ra | so if it's a linux or something posix-alike there's almost 0% chance of compilation failure |
00:14:19 | FromDiscord | <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:34 | Amun-Ra | right |
00:15:41 | Amun-Ra | Available 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:12 | Amun-Ra | you can compile for cpu not listed if endianness and data model matches |
00:18:15 | Amun-Ra | well, C standard is 100% architecture independent, the compiled code is not C standard exclusive |
00:19:53 | FromDiscord | <typistx> which C standard does nim use? ANSI C instead of posix C? which version is that |
00:21:22 | Amun-Ra | by ansi c you mean c89 or the current one? |
00:21:32 | Amun-Ra | there's no such thing as posix c, there's c standard and there's posix |
00:22:05 | Amun-Ra | I mean C posix library |
00:22:31 | Amun-Ra | I don't remember but I guess it's c99 at least |
00:26:31 | Amun-Ra | IIRC I had to implement only two posix functions for simple hello world in amigaos (with -d=usemalloc), flockfile and funlockfile |
01:00:52 | NimEventer | New 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:52 | NimEventer | New 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:08 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4JYo |
03:19:24 | FromDiscord | <user2m> (edit) "https://play.nim-lang.org/#ix=4JYo" => "https://play.nim-lang.org/#ix=4JYp" |
03:19:56 | FromDiscord | <Elegantbeef> `importJs: "cell"` |
03:20:03 | FromDiscord | <Elegantbeef> Whoops sorry `"_cell"` |
03:43:34 | FromDiscord | <user2m> had to do this |
03:43:43 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4JYw |
03:44:18 | FromDiscord | <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:01 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4JYD |
04:31:03 | FromDiscord | <Elegantbeef> `fieldPairs` |
04:38:14 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4JYG |
04:39:51 | FromDiscord | <user2m> ahh this seems to work |
04:39:59 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4JYH |
04:40:43 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4JYI |
04:45:10 | FromDiscord | <demotomohiro> `fieldPairs` takes an object type variable but doesn't take object type itself.↵`item()` creates a temporary object. |
05:16:50 | FromDiscord | <xtrayambak> In reply to @NimEventer "New post on r/nim": why would you use ChatGPT for Nim of all things? |
05:16:58 | FromDiscord | <xtrayambak> last I heard, ChatGPT SUCKS at writing Nim |
05:17:09 | FromDiscord | <xtrayambak> It mixes up Python code with Nim code |
05:17:16 | FromDiscord | <Elegantbeef> Or my version of that sentence "Why would you use ChatGPT" |
05:21:48 | FromDiscord | <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:50 | FromDiscord | <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:56 | FromDiscord | <anuke> (edit) "maybve" => "maybe" |
05:28:31 | FromDiscord | <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:47 | FromDiscord | <Elegantbeef> Write a chess engine |
05:29:05 | FromDiscord | <Elegantbeef> https://github.com/search?q=chess%20language%3Anim&type=repositories |
05:37:16 | FromDiscord | <gyatsoyt> In reply to @Elegantbeef "Write a chess engine": There aren't any chess libraries like other programing languages have |
05:38:16 | FromDiscord | <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:02 | PMunch | Does anyone know what's going on here? https://github.com/PMunch/ratel/issues/17#issuecomment-1770478186 |
06:01:36 | PMunch | I have a suspicion that it is these microcontrollers being a 16-bit target which is messing with things |
06:01:46 | PMunch | But I have no idea where the unicode module is even imported from.. |
06:09:54 | * | advesperacit joined #nim |
06:32:45 | FromDiscord | <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:08 | PMunch | What do you mean by "the one GitHub gives me" |
06:40:18 | FromDiscord | <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:29 | FromDiscord | <Chronos [She/Her]> Maybe it'll be better if I actually just show the docs |
06:41:19 | FromDiscord | <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:39 | FromDiscord | <Chronos [She/Her]> They're redirected back to my site, and the `state` I originally provided is returned |
06:42:04 | FromDiscord | <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:35 | FromDiscord | <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:53 | PMunch | That "state" is only meant to be a random string though |
06:49:08 | PMunch | Ah, 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:43 | PMunch | I guess you could use a bit of cryptography to solve it |
06:51:29 | FromDiscord | <Chronos [She/Her]> In reply to @PMunch "That "state" is only": It is a randomly generated string, yes |
06:51:35 | FromDiscord | <Chronos [She/Her]> In reply to @PMunch "Ah, you want to": Yeah exactly |
06:51:55 | PMunch | Have 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:56 | FromDiscord | <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:15 | FromDiscord | <Chronos [She/Her]> Ah okay, that's doable |
06:52:21 | FromDiscord | <Chronos [She/Her]> Thanks PMunch! |
06:52:40 | PMunch | So 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:12 | PMunch | Of 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:53 | advesperacit | you could randomly generate the key each time the application starts |
07:00:10 | PMunch | It really should be random per request though |
07:00:49 | advesperacit | Yes, that would be best |
07:19:43 | FromDiscord | <Chronos [She/Her]> Fair |
07:20:15 | FromDiscord | <Chronos [She/Her]> I guess a list of all generated states should be fine then? |
07:20:30 | FromDiscord | <Chronos [She/Her]> Especially since they should all be completely random each time |
07:27:34 | PMunch | The 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:50 | FromDiscord | <Chronos [She/Her]> Yeaah- |
07:58:22 | FromDiscord | <Chronos [She/Her]> Legitimately wondering if there's a way to get around this... Sigh |
08:00:28 | PMunch | Apart from the way I suggested? |
08:03:14 | FromDiscord | <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:00 | PMunch | Well the state parameter is optional.. |
08:05:01 | FromDiscord | <mratsim> In reply to @chronos.vitaqua "Maybe it'll be better": What problem are you trying to solve? |
08:05:19 | FromDiscord | <mratsim> if you want to do an `==`, use a hash of the state. |
08:06:33 | FromDiscord | <mratsim> or use a "session key", which is a fancy name for a CSPRNG, 32 bytes is likely enough. |
08:07:44 | FromDiscord | <mratsim> > state string An unguessable random string. It is used to protect against cross-site request forgery attacks. |
08:07:57 | FromDiscord | <Chronos [She/Her]> In reply to @PMunch "Well the state parameter": Optional, but more secure to have |
08:08:21 | FromDiscord | <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:31 | PMunch | Oh for sure, but you asked if there was a way to not need to do it |
08:08:35 | FromDiscord | <Chronos [She/Her]> But I don't have any identifying information, so I'm probably going with what PMunch suggested |
08:08:57 | FromDiscord | <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:16 | FromDiscord | <mratsim> it should NOT have identifying information |
08:09:18 | FromDiscord | <Chronos [She/Her]> In reply to @PMunch "Oh for sure, but": Ah, sorry my brain is just so scattered |
08:09:31 | FromDiscord | <mratsim> 32 bytes (256-bit) randomly generated data is enough |
08:09:33 | FromDiscord | <Chronos [She/Her]> In reply to @mratsim "it should NOT have": Unique information about the client, I mean |
08:10:08 | FromDiscord | <mratsim> doesn't the client establish a connection with you? |
08:10:21 | FromDiscord | <mratsim> don't you have metadata on the connection? |
08:10:38 | FromDiscord | <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:44 | FromDiscord | <mratsim> just add a github_session_key: array[32, byte] field |
08:10:48 | FromDiscord | <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:54 | FromDiscord | <nnsee> but yeah, it's much stronger in other languages |
08:10:58 | FromDiscord | <mratsim> In reply to @chronos.vitaqua "It does, but I'm": a CSPRNG |
08:11:11 | FromDiscord | <Chronos [She/Her]> In reply to @mratsim "just add a github_session_key:": To the context? |
08:11:22 | FromDiscord | <mratsim> yes |
08:11:56 | FromDiscord | <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:20 | FromDiscord | <Chronos [She/Her]> I swear I tried using the `ctxData` field and it didn't let the information persist between two routes |
08:12:22 | PMunch | nnsee, I have a feeling it imports Python packages half the time :P |
08:12:31 | FromDiscord | <nnsee> yup |
08:15:40 | FromDiscord | <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:07 | FromDiscord | <Chronos [She/Her]> I just used sysrand to generate some data but I'll look for a csprng library in Nim then |
08:21:26 | FromDiscord | <Chronos [She/Her]> In reply to @mratsim "I can't help you": The inability to check the state is my entire issue |
08:21:51 | FromDiscord | <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:24 | FromDiscord | <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:38 | FromDiscord | <Chronos [She/Her]> Fair, thanks! |
09:04:22 | FromDiscord | <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:27 | FromDiscord | <Chronos [She/Her]> Contains a timestamp + random data |
09:13:24 | FromDiscord | <Phil> Is there a way to make a proc for any range type? |
09:13:39 | FromDiscord | <Phil> Because `proc x(r: range)` is not a valid proc signature |
09:14:26 | FromDiscord | <Phil> (edit) "signature" => "signature, because range is not a valid parameter-type, not even for generics" |
09:16:55 | FromDiscord | <Phil> Aaaaand found the answer, `proc x[T: range](r: T)` |
09:19:48 | FromDiscord | <Phil> Aaaaaand that isn't a good solution because that causes ambiguous call errors again with `proc x(r: auto)` |
09:20:02 | FromDiscord | <Elegantbeef> `r: not range` |
09:20:22 | FromDiscord | <Phil> ... wait, when r: range doesn't work, why should r: not range work? |
09:20:34 | FromDiscord | <odexine> they mean instead of auto |
09:21:08 | FromDiscord | <Phil> My question was regarding that. If I can check for "not range", I should also be able to check for "range" |
09:21:23 | FromDiscord | <Phil> or rather if I can make generic over "not range", I should also be able to make sth generic over "range" |
09:21:27 | FromDiscord | <odexine> yes |
09:21:31 | FromDiscord | <odexine> and you can, i dont understand |
09:21:34 | FromDiscord | <Elegantbeef> I mean implicit generics are syntax sugar for generic parameters so if it didnt work .... |
09:21:52 | FromDiscord | <Elegantbeef> I honestly thought there was a range typeclass |
09:21:54 | FromDiscord | <Phil> The irony is that beef's example works |
09:22:05 | FromDiscord | <Phil> `proc isRange(r: range) = echo "is range"` this is invalid↵`proc isRange(r: not range) = echo "no range"` this is valid |
09:22:12 | FromDiscord | <Phil> 😕 |
09:22:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4JZo |
09:23:18 | FromDiscord | <Phil> There's https://nim-lang.org/docs/system.html#range I guess (?) |
09:23:22 | FromDiscord | <Elegantbeef> There is no range typeclass for parameters oddly |
09:23:34 | * | beholders_eye joined #nim |
09:24:14 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4JZp |
09:26:34 | FromDiscord | <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:45 | FromDiscord | <Elegantbeef> I think it exists it's just not as friendly |
09:28:49 | FromDiscord | <Elegantbeef> given `x is range` works |
09:30:02 | FromDiscord | <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:27 | FromDiscord | <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:57 | FromDiscord | <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:35 | FromDiscord | <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:46 | PMunch | Phil, distinctBase? https://nim-lang.org/docs/typetraits.html#distinctBase%2Ctypedesc%2Cstaticbool |
11:05:56 | FromDiscord | <gyatsoyt> Anyone interested in developing a nim package called chess like the package python chess available in python? |
11:07:10 | FromDiscord | <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:31 | FromDiscord | <Phil> In reply to @PMunch "<@180601887916163073>, distinctBase? https://nim-la": That may just be perfect |
11:08:54 | FromDiscord | <Phil> Holy shit `x is distinct` also works |
11:09:00 | PMunch | Of course |
11:11:01 | FromDiscord | <JJ> In reply to @isofruit "I'm not personally interested": heard owlkettle 3.0 is on the horizon 👀 |
11:11:14 | FromDiscord | <Phil> ~~Depends on how much I delay it~~ |
11:14:57 | FromDiscord | <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:22 | FromDiscord | <gyatsoyt> In reply to @isofruit "I'm not personally interested": Can I 💀 |
11:17:30 | FromDiscord | <gyatsoyt> I didn't knew i can do that |
11:18:17 | FromDiscord | <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:05 | FromDiscord | <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:05 | FromDiscord | <Zoom> I want a `log` proc which expands to something like `stderr.styledWriteLine(fgGreen, varargsGoHere, "✔")` |
11:21:22 | FromDiscord | <gyatsoyt> In reply to @isofruit "Nim basically can use": Ohk where can I find documentation of nimpy |
11:21:44 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4JZM |
11:21:48 | FromDiscord | <Phil> https://github.com/yglukhov/nimpy |
11:22:16 | FromDiscord | <Chronos [She/Her]> It's how `echo` can print most objects too, it'll return it as a varargs of strings |
11:22:28 | PMunch | Chronos_[She/Her], I believe Zoom wants to pass the varargs on though |
11:22:41 | FromDiscord | <Chronos [She/Her]> Ah |
11:23:51 | FromDiscord | <Chronos [She/Her]> In reply to @Zoom "I want a `log`": You may find `unpackVarargs` from `std/macros` useful then |
11:25:07 | PMunch | I think Nim just deals with this on its own: https://play.nim-lang.org/#ix=4JZO |
11:26:14 | FromDiscord | <Chronos [She/Her]> Ah |
11:28:12 | FromDiscord | <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:32 | FromDiscord | <Phil> Also circular types will likely kill this construct, but circular types are heresy anyway |
11:28:41 | PMunch | Hmm, if this is what I think it is it sounds awesome. Do you have a sample? |
11:32:44 | FromDiscord | <Phil> sent a long message, see http://ix.io/4JZQ |
11:33:09 | FromDiscord | <Phil> The code for the entire mechanism is in `playground.nim` |
11:34:31 | FromDiscord | <Phil> What made me kind of go baseball-eyed was that you can just change the type hidden behind a ptr |
11:34:40 | FromDiscord | <Phil> That's what your distinctBase comment helped fix |
11:34:57 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4JZR |
11:35:04 | FromDiscord | <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:51 | FromDiscord | <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:20 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/ki6SX |
11:41:42 | FromDiscord | <_nenc> Does anybody know why is `end` a keyword? |
11:41:51 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4JZU |
11:41:58 | * | advesperacit quit () |
11:42:11 | FromDiscord | <Phil> https://media.discordapp.net/attachments/371759389889003532/1167065637248565368/image.png?ex=654cc592&is=653a5092&hm=2fce512f4d90df6799c0af4dd05edafc05c1e96bc03573ebc0eca89875016f14& |
11:44:17 | PMunch | Hmm, interesting |
11:44:49 | PMunch | Not entirely sure I understand what the various parts do, but looks promising! |
11:45:23 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4JZX |
11:45:37 | FromDiscord | <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:32 | FromDiscord | <Phil> sent a long message, see http://ix.io/4JZY |
11:50:03 | FromDiscord | <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:22 | FromDiscord | <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:17 | FromDiscord | <Chronos [She/Her]> If I raise an exception in a body with `withLock` does that cause a deadlock? |
11:52:30 | FromDiscord | <Phil> depends on if withLock uses "finally" or not |
11:52:37 | FromDiscord | <Chronos [She/Her]> Uhhh let me see |
11:52:47 | FromDiscord | <Chronos [She/Her]> It does, nice |
11:53:03 | FromDiscord | <Phil> In that case the lock is always released.↵The only way to not release it is to crash the application |
11:54:40 | FromDiscord | <Chronos [She/Her]> Also is it safe to cast the bodies of locks to `gcsafe`? :p |
11:55:03 | FromDiscord | <Chronos [She/Her]> Compiler claims it isn't gcsafe because `withLock` calls `release` |
11:55:55 | FromDiscord | <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:27 | FromDiscord | <Chronos [She/Her]> Yeah, that- |
11:56:37 | FromDiscord | <Chronos [She/Her]> My brain is, as always, mush :p |
11:57:23 | FromDiscord | <Chronos [She/Her]> But yeah would it be safe to cast it as gcsafe? Purely because of the `release` statement |
11:58:05 | FromDiscord | <Phil> I can not speak authoritatively here, I'd say it should be fine but I can't say for sure. |
11:58:20 | FromDiscord | <Chronos [She/Her]> Fair |
12:23:04 | FromDiscord | <Chronos [She/Her]> Uhhh should I rename all instances of `NULID` in my types to `ULID`? Hm... |
12:23:25 | FromDiscord | <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:27 | FromDiscord | <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:31 | FromDiscord | <_nenc> oh, I see. |
13:13:52 | FromDiscord | <_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:01 | arkanoid | just out of curiosity, have you ever used drnim? https://nim-lang.org/docs/drnim.html |
15:01:15 | FromDiscord | <.aingel.> Why are people making more languages in nim |
15:01:18 | FromDiscord | <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:30 | FromDiscord | <leorize> I already did something about it so you can try reviving the effort |
15:03:57 | FromDiscord | <Chronos [She/Her]> Oh? Where's that work? |
15:05:28 | FromDiscord | <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:45 | FromDiscord | <Chronos [She/Her]> How would that work? |
15:05:54 | FromDiscord | <leorize> https://github.com/nim-lang/Nim/pull/16396 |
15:05:55 | FromDiscord | <Phil> One sec, trying it out |
15:06:46 | FromDiscord | <Chronos [She/Her]> In reply to @leorize "https://github.com/nim-lang/Nim/pull/16396": Ooh epic |
15:08:37 | FromDiscord | <Phil> Actually the template approach doesn't work, but I just found my first usecase for an include |
15:08:51 | FromDiscord | <Chronos [She/Her]> Oof |
15:08:57 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K0P |
15:09:26 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K0Q |
15:09:44 | FromDiscord | <Phil> Now the important question is whether this actually works for swapping out modules, I'll need a bit longer for that |
15:10:17 | FromDiscord | <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:02 | FromDiscord | <Chronos [She/Her]> Can't you just swap it out with a define flag? |
15:11:10 | * | CO2 joined #nim |
15:11:16 | FromDiscord | <leorize> we typically use that pattern for building modules with different code per platform |
15:11:37 | FromDiscord | <leorize> not for interfaces most of the time |
15:11:49 | FromDiscord | <Phil> I mean, that is kind of an interface no? |
15:12:34 | FromDiscord | <typistx> hi BOT you're pretty smart, are you using chatgpt or something? |
15:12:47 | FromDiscord | <Phil> In reply to @typistx "hi BOT you're pretty": matrix bridge, not a bot |
15:12:59 | FromDiscord | <leorize> that's what they want you to believe |
15:13:00 | FromDiscord | <typistx> oh, thanks. I was very impressed |
15:13:40 | FromDiscord | <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:38 | FromDiscord | <leorize> forward declarations are actually staged for removal |
15:14:44 | FromDiscord | <Phil> In nim? |
15:14:50 | FromDiscord | <Phil> Or in C? |
15:14:58 | FromDiscord | <leorize> yes↵(@Phil) |
15:15:04 | FromDiscord | <Phil> ... but why though? |
15:15:38 | FromDiscord | <jviega> Ideally if they're no longer needed 😉 |
15:15:47 | FromDiscord | <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:10 | FromDiscord | <Chronos [She/Her]> Aren't 'interfaces' a reason to keep them around? |
15:16:15 | FromDiscord | <leorize> that's one of supposed feature enabled by IC |
15:16:31 | FromDiscord | <Chronos [She/Her]> Interfaces with IC? Huh? How? |
15:17:02 | FromDiscord | <leorize> my messages go through the bridge so it'll come in a lil out of sync |
15:17:13 | FromDiscord | <Chronos [She/Her]> Ah |
15:17:20 | FromDiscord | <Chronos [She/Her]> So IC enables code reordering? |
15:17:23 | FromDiscord | <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:00 | FromDiscord | <leorize> these days it's gonna be NIR↵(@Chronos [She/Her]) |
15:18:08 | FromDiscord | <Chronos [She/Her]> Gucci |
15:18:37 | FromDiscord | <leorize> but that's only if it's done, been some years since that idea floated around |
15:19:40 | FromDiscord | <Phil> Sidenote, forward declarations seem like it could be the thing that C uses to declare "interfaces" or the like |
15:19:44 | FromDiscord | <Phil> Would that be a correct assessment? |
15:20:01 | FromDiscord | <leorize> no one uses it for that |
15:20:04 | FromDiscord | <Phil> Basically a tool to decouple implementations |
15:20:07 | FromDiscord | <Phil> Huh |
15:20:38 | FromDiscord | <leorize> forward declarations has always been there to solve the ordering problem |
15:21:11 | FromDiscord | <Phil> Does C have a decoupling tool then? |
15:21:28 | FromDiscord | <Phil> Wait what am I talking, of course it has, I've seen it in the gtk docs |
15:21:35 | FromDiscord | <Chronos [She/Her]> Wonder if a macro could be made for interfaces then :p |
15:21:58 | FromDiscord | <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:16 | FromDiscord | <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:27 | FromDiscord | <Phil> I can't claim to say I understand C interfaces, but I can say it has them |
15:22:38 | FromDiscord | <leorize> many had↵(@Chronos [She/Her]) |
15:22:42 | FromDiscord | <leorize> none got enough traction |
15:22:47 | FromDiscord | <Chronos [She/Her]> Ah fair |
15:23:38 | FromDiscord | <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:32 | FromDiscord | <gyatsoyt> In reply to @isofruit "What's the issue? I": How do I use nimpy to import python modules? |
15:24:58 | FromDiscord | <gyatsoyt> Like can I use pip to download the python module and then nim for nimpy |
15:25:10 | FromDiscord | <leorize> the way it's done in C is the same as nim↵(@Phil) |
15:25:18 | FromDiscord | <leorize> just an object with function pointers |
15:25:31 | FromDiscord | <Phil> ... but nim doesn't have interfaces, so the answer is "they don't" ? |
15:25:34 | FromDiscord | <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:49 | FromDiscord | <leorize> yep |
15:26:01 | FromDiscord | <gyatsoyt> So how can I do that |
15:26:31 | FromDiscord | <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:03 | FromDiscord | <gyatsoyt> In reply to @isofruit "Does `pyImport("<libname>")` not do": Can you import the chess library from python |
15:29:36 | FromDiscord | <Phil> I don't even know the chess library |
15:44:59 | NimEventer | New 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:44 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K11 |
15:47:40 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4K11" => "https://play.nim-lang.org/#ix=4K12" |
15:47:57 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4K12" => "https://play.nim-lang.org/#ix=4K13" |
15:53:10 | FromDiscord | <gyatsoyt> Ohkk |
15:53:29 | FromDiscord | <gyatsoyt> Understood |
15:59:52 | FromDiscord | <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:26 | FromDiscord | <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:42 | FromDiscord | <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:54 | FromDiscord | <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:12 | FromDiscord | <Phil> (Snorlogue is a prologue extension, I am not the best at naming) |
16:49:46 | FromDiscord | <wick3dr0se> Naming is the hardest part |
16:50:03 | FromDiscord | <wick3dr0se> Thats sick. I have much to read |
16:51:40 | FromDiscord | <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:22 | FromDiscord | <Phil> sent a long message, see http://ix.io/4K1i |
16:54:10 | FromDiscord | <Chronos [She/Her]> ~~Sadly Debby doesn't support value types~~ |
16:56:19 | FromDiscord | <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:19 | FromDiscord | <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:03 | FromDiscord | <gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=4K1p |
17:13:30 | FromDiscord | <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:10 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K1q |
17:14:31 | FromDiscord | <Chronos [She/Her]> `{key: value}` is just a shortcut for an array of tuples, and they have to be actual types |
17:14:45 | FromDiscord | <Chronos [She/Her]> So `{"PAWN": 100}` will do what you want |
17:14:52 | FromDiscord | <Chronos [She/Her]> Though an enum may do it better, tbh |
17:15:31 | FromDiscord | <gyatsoyt> Btw there isn't a reversed function |
17:15:35 | FromDiscord | <gyatsoyt> Like python has |
17:16:58 | FromDiscord | <Phil> You mean this reverse function:↵https://nim-lang.org/docs/algorithm.html#reverse%2CopenArray%5BT%5D↵😛 |
17:17:03 | FromDiscord | <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:02 | FromDiscord | <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:11 | FromDiscord | <gyatsoyt> In reply to @isofruit "Generally btw I recommend": Thanks for the info |
17:21:52 | FromDiscord | <gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=4K1t |
17:23:40 | FromDiscord | <Phil> Could you post also your imports? Those may be important here |
17:25:47 | FromDiscord | <gyatsoyt> In reply to @isofruit "Could you post also": Sure |
17:26:11 | FromDiscord | <gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=4K1v |
17:26:22 | FromDiscord | <gyatsoyt> There they are |
17:27:31 | FromDiscord | <Chronos [She/Her]> Honestly I'd recommend rolling your own thing rather than borrowing from Python |
17:27:40 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K1w |
17:27:53 | FromDiscord | <Chronos [She/Her]> For two main reasons:↵1. Learning experience↵2. Cleaner interaction with Nim code |
17:28:05 | FromDiscord | <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:14 | FromDiscord | <Chronos [She/Her]> Nimpy does a great job, don't get me wrong, it's just... It's not native Nim :p |
17:28:18 | FromDiscord | <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:41 | FromDiscord | <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:46 | FromDiscord | <Chronos [She/Her]> Why don't you port only what's needed? Surely it isn't too hard? |
17:29:01 | FromDiscord | <gyatsoyt> In reply to @isofruit "Hmmm do you assign": I didn't assign reversed variable anywhere |
17:29:12 | FromDiscord | <gyatsoyt> In reply to @isofruit "You're missing the context": Yes |
17:29:20 | FromDiscord | <gyatsoyt> In reply to @chronos.vitaqua "Why don't you port": I need the whole thing |
17:29:26 | FromDiscord | <Chronos [She/Her]> Ah |
17:29:30 | FromDiscord | <gyatsoyt> I am using most of the functions offered by the lib |
17:29:35 | FromDiscord | <gyatsoyt> That's why |
17:29:40 | FromDiscord | <Chronos [She/Her]> Fair enough |
17:29:47 | FromDiscord | <Phil> Okay, next question then, could you post the entire file then? |
17:29:54 | FromDiscord | <gyatsoyt> In reply to @isofruit "Okay, next question then,": Sure |
17:29:59 | FromDiscord | <Chronos [She/Her]> Keep in mind this means you have to have a Python runtime :p |
17:30:08 | FromDiscord | <Chronos [She/Her]> Wherever this runs |
17:30:11 | FromDiscord | <Phil> I already elaborated on that bit 😛 |
17:30:14 | FromDiscord | <Chronos [She/Her]> Where ever? |
17:30:15 | FromDiscord | <Chronos [She/Her]> Ah |
17:30:22 | FromDiscord | <gyatsoyt> Yes Ik that |
17:30:32 | FromDiscord | <gyatsoyt> Can't post it directly |
17:30:37 | FromDiscord | <gyatsoyt> Should I use sourcebin |
17:30:39 | FromDiscord | <Phil> Anyway there's something going on here.↵The snippets you posted don't hint at you using a python object anywhere |
17:30:55 | FromDiscord | <Phil> That or just https://play.nim-lang.org/ |
17:30:59 | FromDiscord | <Phil> It has a share button |
17:32:02 | FromDiscord | <gyatsoyt> In reply to @isofruit "That or just https://play.nim-lang.org/": Can't paste there idk why it happens |
17:32:08 | FromDiscord | <gyatsoyt> https://srcb.in/WXAb4SHc7p |
17:32:19 | FromDiscord | <gyatsoyt> That's the sourcebin link of the whole file |
17:34:58 | FromDiscord | <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:32 | FromDiscord | <gyatsoyt> It seems to work when I do the above changes |
17:35:49 | FromDiscord | <gyatsoyt> It goes to the next reverse which I haven't changed till now btw |
17:36:04 | FromDiscord | <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:08 | FromDiscord | <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:13 | FromDiscord | <Chronos [She/Her]> I assumed they were mutually exclusive |
17:36:26 | FromDiscord | <gyatsoyt> In reply to @isofruit "Aye. Your issue here": Hmm |
17:36:39 | FromDiscord | <Chronos [She/Her]> In reply to @gyatsoyt "Hmm": Solved with `toSeq` |
17:36:58 | FromDiscord | <Chronos [She/Her]> It's a function from `sequtils` that turns any array/iterator into a sequence |
17:37:31 | FromDiscord | <gyatsoyt> So after .reversed().toSeq |
17:37:33 | FromDiscord | <gyatsoyt> Right |
17:37:35 | FromDiscord | <Chronos [She/Her]> Yep |
17:38:27 | FromDiscord | <gyatsoyt> Ohk |
17:38:30 | FromDiscord | <Phil> Wait why? reversed already spits out a seq no? |
17:38:41 | FromDiscord | <Phil> toSeq should be unnecessary |
17:39:28 | FromDiscord | <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:35 | FromDiscord | <Chronos [She/Her]> 🤷♀️ |
17:42:56 | FromDiscord | <gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=4K1A |
17:43:36 | FromDiscord | <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:08 | FromDiscord | <gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=4K1B |
17:44:08 | FromDiscord | <gyatsoyt> This is line 96 |
17:46:12 | FromDiscord | <Phil> Ahhh python doesn't do types, I missed that when I skimmed over the code |
17:46:15 | FromDiscord | <Chronos [She/Her]> Anyone know if Debby's `filter` raises an error if it can't find a query? |
17:46:22 | FromDiscord | <Phil> You can't use a python type for a nim type declaration |
17:46:37 | FromDiscord | <gyatsoyt> In reply to @isofruit "You can't use a": So what should I do |
17:46:37 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K1E |
17:46:51 | FromDiscord | <Phil> Under the hood it's all `PyObject` |
17:47:33 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K1F |
17:47:45 | FromDiscord | <Chronos [She/Her]> In reply to @chronos.vitaqua "Anyone know if Debby's": Source doesn't reveal much, really |
17:48:06 | FromDiscord | <Phil> Therefore:↵`proc moveValue(board: PyObject, move: PyObject, endgame: bool): float` |
17:48:07 | FromDiscord | <Chronos [She/Her]> Oh prolly returns an empty seq |
17:48:09 | FromDiscord | <Phil> HOWEVER |
17:48:41 | FromDiscord | <gyatsoyt> ? |
17:50:29 | FromDiscord | <gyatsoyt> ? |
17:50:46 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K1H |
17:51:08 | FromDiscord | <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:21 | FromDiscord | <gyatsoyt> Hm |
17:51:37 | FromDiscord | <Phil> That gives you the type safety that you'd otherwise loose, however it means more code |
17:51:58 | FromDiscord | <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:11 | FromDiscord | <gyatsoyt> When I important the library can't I just simply do that everything from the lib is PyObject |
17:52:33 | FromDiscord | <Phil> You can, the `discint PyObject` approach is just an option |
17:52:48 | FromDiscord | <Phil> It grants you more type-safety which python doesn't have, but in exchange means more code |
17:53:14 | FromDiscord | <Phil> Just wanted you to be aware of your options 😄 |
17:53:23 | FromDiscord | <gyatsoyt> Ohk |
17:53:24 | FromDiscord | <gyatsoyt> Well |
17:53:41 | FromDiscord | <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:51 | FromDiscord | <Phil> The drawback as stated is it's tedious as fuck to write |
17:53:54 | FromDiscord | <Phil> (edit) "The drawback as stated is it's tedious as fuck to write ... " added "initially" |
17:54:14 | FromDiscord | <gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=4K1J |
18:00:47 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K1M |
18:01:05 | FromDiscord | <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:47 | FromDiscord | <gyatsoyt> BLACK is just colour |
18:02:00 | FromDiscord | <gyatsoyt> For the players either white or black |
18:02:02 | FromDiscord | <Phil> Which python module is that? |
18:02:08 | FromDiscord | <Phil> Or is that from chess? |
18:02:56 | FromDiscord | <gyatsoyt> Its. From chess |
18:03:13 | FromDiscord | <Phil> In that case that likely needs to be chess.BLACK (if that's what the constant is called there) |
18:04:07 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K1O |
18:06:30 | FromDiscord | <gyatsoyt> Too much coding for today |
18:06:32 | FromDiscord | <gyatsoyt> 💀 |
18:06:37 | FromDiscord | <gyatsoyt> Lemme go to sleep |
18:06:47 | FromDiscord | <gyatsoyt> I'll do the bug hunting Tommorow |
18:06:51 | Amun-Ra | import std/times first |
18:07:12 | FromDiscord | <gyatsoyt> In reply to @Amun-Ra "import std/times first": Why? |
18:07:47 | Amun-Ra | gyatsoyt: ah, sleep is in std/os, sorry ;) |
18:10:25 | FromDiscord | <Phil> In reply to @gyatsoyt "Too much coding for": Have a good time 😉 |
18:21:11 | FromDiscord | <Chronos [She/Her]> Odd |
18:21:50 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K1Q |
18:22:01 | FromDiscord | <Chronos [She/Her]> I'm not sure how I'm supposed to do this now :p |
18:22:24 | FromDiscord | <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:41 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "`Error: unhandled exception: /home/chronos/.nimble/": you can't use in filter advanced values as call |
18:24:04 | FromDiscord | <griffith1deadly> as i recall only static values or need place it in variable |
18:24:08 | FromDiscord | <Chronos [She/Her]> Ah, removing the templates showed the error |
18:24:15 | FromDiscord | <Chronos [She/Her]> Yeah that sucks oof |
18:25:37 | FromDiscord | <Chronos [She/Her]> That still doesn't work... Mega oof |
18:25:37 | FromDiscord | <griffith1deadly> In reply to @griffith1deadly "as i recall only": because this template/macro only translate given value in sql and no magic |
18:25:48 | FromDiscord | <Chronos [She/Her]> In reply to @griffith1deadly "because this template/macro only": That sucks rip |
18:27:10 | FromDiscord | <Chronos [She/Her]> Putting it in a variable didn't work... I think it only works with static variables? |
18:27:20 | FromDiscord | <user2m> is there a way to set all fields of an object o be exported? |
18:27:27 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K1R |
18:27:49 | FromDiscord | <griffith1deadly> In reply to @isofruit "My guy, filterIt, not": filter it proc from debby, filter from db |
18:27:59 | FromDiscord | <Chronos [She/Her]> In reply to @isofruit "My guy, filterIt, not": My guy, this is Debby 😛 |
18:28:15 | FromDiscord | <Phil> I sue for inconsistent API with sequtils! |
18:28:34 | FromDiscord | <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:34 | FromDiscord | <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:06 | FromDiscord | <Chronos [She/Her]> Could likely be fixed by passing `db` to the macro tbh |
18:30:36 | FromDiscord | <Chronos [She/Her]> May do a fork and see if I can modify a few things tbh :p |
18:30:49 | FromDiscord | <Chronos [She/Her]> Then ✨ pr ✨ |
18:31:16 | FromDiscord | <griffith1deadly> then also add @onetomany and @manytoone functionality 😛 |
18:32:03 | FromDiscord | <Chronos [She/Her]> Explain? :p |
18:32:39 | * | CO2 quit (Quit: WeeChat 4.1.0) |
18:32:46 | FromDiscord | <Phil> Does debby not have ways to auto-fetch one-to-many relationships on an object? |
18:33:39 | FromDiscord | <griffith1deadly> In reply to @isofruit "Does debby not have": debby doesn't have this |
18:33:57 | FromDiscord | <Phil> ...erm... I'm surprised is all I can say to that |
18:34:06 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "Explain? :p": https://www.baeldung.com/hibernate-one-to-many |
18:34:08 | FromDiscord | <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:57 | FromDiscord | <Chronos [She/Her]> Seems complicated- |
18:42:05 | FromDiscord | <Phil> Ehhhhhhhh depends |
18:42:14 | FromDiscord | <Phil> I mean, treeform already provided a pretty slick DSL |
18:42:26 | FromDiscord | <Phil> Solving many-to-one isn't necessarily harder than that |
18:43:34 | FromDiscord | <Chronos [She/Her]> You mean `filter`? |
18:43:37 | FromDiscord | <Chronos [She/Her]> Or |
18:47:14 | FromDiscord | <Chronos [She/Her]> My first change to Debby worked :p |
18:47:47 | FromDiscord | <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:04 | FromDiscord | <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:24 | FromDiscord | <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:39 | FromDiscord | <Chronos [She/Her]> I understand none of that~ |
18:49:28 | FromDiscord | <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:31 | FromDiscord | <Phil> Hmmm I may have expressed that none too great |
18:49:52 | FromDiscord | <griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=4K1W |
18:50:02 | FromDiscord | <Chronos [She/Her]> Ah, does that not already work? |
18:50:11 | FromDiscord | <Phil> Beats me, never used debby |
18:50:32 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "Ah, does that not": already it just can mapped to json 😛 |
18:51:06 | FromDiscord | <Phil> That was not a sentence I can parse |
18:51:55 | FromDiscord | <griffith1deadly> (edit) "In reply to @chronos.vitaqua "Ah, does that not": already it just can ... mapped" added "be" |
18:52:26 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4K1Y |
18:53:30 | FromDiscord | <Phil> Sadly that'll net you in object variant territory |
18:53:42 | FromDiscord | <Phil> Which is basically nim's version of a union type. |
18:55:17 | FromDiscord | <user2m> ok tthawt's hat I was thinking |
18:55:31 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K20 |
18:55:47 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4K20" => "https://play.nim-lang.org/#ix=4K21" |
18:56:33 | FromDiscord | <user2m> perfect thank you @Phil! |
18:56:35 | FromDiscord | <user2m> @Phil |
18:56:50 | FromDiscord | <Phil> Happy to help 😄 |
18:57:57 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4K22 |
18:58:16 | FromDiscord | <user2m> I can create a proc for this but it's just annoying |
18:58:48 | FromDiscord | <griffith1deadly> variant field's cant be named same |
18:59:14 | FromDiscord | <user2m> lol I see that |
19:00:16 | FromDiscord | <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:53 | FromDiscord | <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:37 | FromDiscord | <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:53 | FromDiscord | <Phil> Nimnode doesn't exist at runtime I don't think |
19:02:59 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K26 |
19:03:04 | FromDiscord | <Phil> NimNode afterall generates code |
19:03:14 | FromDiscord | <Phil> And code must exist at compiletime to be compiled |
19:03:18 | FromDiscord | <Phil> There is no aftercompiling |
19:03:19 | FromDiscord | <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:27 | FromDiscord | <Chronos [She/Her]> In reply to @isofruit "Nimnode doesn't exist at": Ah |
19:03:42 | FromDiscord | <Chronos [She/Her]> Maybe it's time for me to try a smaaall tweaking of Debby's code- |
19:03:58 | FromDiscord | <Phil> ~~Immediately gets hammered by treeform~~ |
19:04:05 | FromDiscord | <Chronos [She/Her]> Lmao probably will tbf |
19:04:20 | FromDiscord | <Phil> Nah, treeform is swell, he'll welcome contributions I think |
19:04:48 | FromDiscord | <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:05 | FromDiscord | <Chronos [She/Her]> Imo it makes code cleaner, even if it's just a small thing |
19:05:36 | FromDiscord | <Phil> You may need to define what you mean by "calls" |
19:05:42 | FromDiscord | <Chronos [She/Her]> I can definitely see some small issues popping up but I'll try and squash them |
19:06:09 | FromDiscord | <Chronos [She/Her]> Literally `nnkCall` aha, for example: `app.db.filter(State, it.val == state.get())` |
19:06:46 | FromDiscord | <griffith1deadly> i wonder if anyone has tried using kotlin libraries through jnim |
19:08:57 | FromDiscord | <Chronos [She/Her]> Making this robust will probably be a bit of a pain... oof |
19:09:01 | FromDiscord | <treeform> In reply to @chronos.vitaqua "<@107140179025735680> actually, if you're": Yes, if it has tests. |
19:09:11 | FromDiscord | <Chronos [She/Her]> Alright! |
19:20:31 | * | deadmarshal_ quit (Ping timeout: 260 seconds) |
19:24:08 | FromDiscord | <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:20 | FromDiscord | <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:39 | FromDiscord | <Chronos [She/Her]> In reply to @chronos.vitaqua "But just wondering... Am": The answer was yes ✨ |
19:53:22 | NimEventer | New 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:47 | FromDiscord | <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:14 | FromDiscord | <Phil> In reply to @can.l "The event listener implementation": Ah, I conflated the two, my bad |
20:00:50 | FromDiscord | <Phil> My head just went "Wait, the syntax for defining how a proc must look like for us looks like forward declarations" |
20:01:04 | FromDiscord | <Phil> (edit) "us" => "us," |
20:01:46 | FromDiscord | <Phil> Though I guess we could manage with just lambda's if push comes to shove? |
20:02:06 | * | deadmarshal_ joined #nim |
20:02:40 | FromDiscord | <Phil> Like, have a field `activate: proc(text: string) = proc(text: string) = discard` |
20:02:50 | FromDiscord | <Phil> (edit) "Like, have a field ... `activate:" added "on state" |
20:03:34 | FromDiscord | <can.l> I dont see why you have two `proc(text: string)` s, but generally yes. |
20:04:13 | FromDiscord | <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:53 | FromDiscord | <Phil> In reply to @can.l "I dont see why": Default implementation, though that could also be nil I guess |
20:05:09 | FromDiscord | <Phil> Since it's just a pointer in the end |
20:13:26 | FromDiscord | <user2m> Does anyone know how to convert a JsObject to a regular nim object? |
20:14:14 | FromDiscord | <Elegantbeef> Don't use JsObject and use a normal Nim object |
20:14:59 | FromDiscord | <Phil> I mean Jsobject is sorta kinda a normal nim object, distantly |
20:15:05 | FromDiscord | <Phil> It inherits from RootObj |
20:16:40 | FromDiscord | <Elegantbeef> Right but my point is do not use JsObject and just declare your Nim object |
20:16:55 | FromDiscord | <Elegantbeef> JsObject is explicitly a typeless object and only to be used for dirty code |
20:18:02 | FromDiscord | <Chronos [She/Her]> I'm getting sorta close hmmm |
20:18:19 | FromDiscord | <nasuray> In reply to @user2m "Does anyone know how": https://nim-lang.org/docs/jsffi.html#to%2CJsObject%2Ctypedesc may be helpful |
20:21:53 | FromDiscord | <Chronos [She/Her]> Maybe it'd be fine to only allow calls with no params hm... |
20:22:09 | FromDiscord | <Chronos [She/Her]> Or as long as it doesn't have `it` in the params? |
20:25:51 | FromDiscord | <Chronos [She/Her]> Okay, this just isn't doable :p |
20:25:59 | FromDiscord | <Chronos [She/Her]> Well, probably is but not with my knowledge |
20:26:45 | FromDiscord | <Chronos [She/Her]> I did fix a minor thing tho |
20:33:09 | FromDiscord | <Chronos [She/Her]> I'm trying to figure out a way to support at least very simple calls hm... |
20:33:32 | FromDiscord | <Chronos [She/Her]> Like, there's no reason you shouldn't be able to do `myOption.get()` imo |
20:38:46 | FromDiscord | <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:24 | FromDiscord | <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:29 | FromDiscord | <Chronos [She/Her]> Hm... |
20:53:57 | FromDiscord | <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:41 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K2D |
20:56:25 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K2E |
20:57:13 | FromDiscord | <ElegantBeouf> If you can describe it in words you can describe it in macro |
20:57:24 | FromDiscord | <Chronos [She/Her]> Sweet :D |
20:57:31 | FromDiscord | <Chronos [She/Her]> Now to figure out the logic for that- |
20:59:11 | FromDiscord | <Chronos [She/Her]> And then to also separate all calls into a separate list too- |
21:02:31 | FromDiscord | <Chronos [She/Her]> This is a pain to do, I can't pass around `NimNode`s like I would with a variable |
21:02:38 | FromDiscord | <Chronos [She/Her]> `var NimNode` is obviously invalid |
21:02:46 | FromDiscord | <Chronos [She/Her]> Ig two separate macros? |
21:02:57 | FromDiscord | <ElegantBeouf> `var NimNode` is not invalid |
21:03:59 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K2H |
21:04:08 | FromDiscord | <ElegantBeouf> `proc callStripper(a, b: var NimNode)` |
21:04:46 | FromDiscord | <Chronos [She/Her]> Huh? But then that'd be at runtime, no? |
21:04:51 | FromDiscord | <Chronos [She/Her]> Idek how that'd work |
21:04:56 | FromDiscord | <ElegantBeouf> macros call procs |
21:05:03 | FromDiscord | <ElegantBeouf> They run at compile time |
21:05:11 | FromDiscord | <Chronos [She/Her]> Ah |
21:05:22 | FromDiscord | <Chronos [She/Her]> Eh, either way doing this differently is probably better |
21:10:18 | * | deadmarshal_ quit (Ping timeout: 260 seconds) |
21:12:14 | FromDiscord | <Chronos [She/Her]> Macros can't be recursive? :/ |
21:13:29 | FromDiscord | <ElegantBeouf> Of course not |
21:13:31 | FromDiscord | <Chronos [She/Her]> Says 'recursive dependency' |
21:13:43 | FromDiscord | <Phil> I am mildly confused as to why you'd use recursive macros |
21:13:45 | FromDiscord | <Chronos [She/Her]> Tbf actually I can just use a loop |
21:13:48 | FromDiscord | <ElegantBeouf> Mutate this ast by mutating this ast by mutating an ast |
21:13:55 | FromDiscord | <ElegantBeouf> Just recurse down the NimNodes |
21:13:58 | FromDiscord | <Phil> Like, macros should be the entry point after which you only use procs to manipulate NimNodes |
21:14:02 | FromDiscord | <Chronos [She/Her]> Gucci |
21:14:30 | FromDiscord | <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:53 | FromDiscord | <Phil> Though I can't claim to have written a DSL in nim yet either |
21:15:03 | FromDiscord | <Phil> (edit) "either" => "either, which seems like a ton of work" |
21:15:16 | FromDiscord | <Chronos [She/Her]> Fair aha |
21:18:06 | * | deadmarshal_ joined #nim |
21:23:29 | FromDiscord | <leorize> I see that you're machoistic enough to use typed macros |
21:23:29 | FromDiscord | <leorize> they'll show every call but modifying those trees is a terrible experience |
21:24:24 | FromDiscord | <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:36 | FromDiscord | <Chronos [She/Her]> The fact it all gets expanded :p |
21:24:42 | FromDiscord | <Elegantbeef> They're semantically checked |
21:24:42 | FromDiscord | <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:44 | FromDiscord | <Chronos [She/Her]> I'm assuming that, at least |
21:24:59 | FromDiscord | <Phil> But... isn't that good? |
21:25:10 | FromDiscord | <Elegantbeef> This means the entire AST contains a bunch of junk and the typed AST is much worst for having a "spec" |
21:25:19 | FromDiscord | <Chronos [She/Her]> Ye |
21:25:27 | FromDiscord | <Chronos [She/Her]> Bunch of empty nodes is an example |
21:25:46 | FromDiscord | <Chronos [She/Her]> Like obviously needed, but yeah |
21:25:59 | FromDiscord | <Elegantbeef> `echo 10` -\> `nnkCall(sym"echo", nnkBracket(nnkHiddenConv(intLit 10)))` |
21:28:33 | FromDiscord | <Phil> Maybe I need to write a couple hundred more lines of macros to see the problem |
21:28:50 | FromDiscord | <Elegantbeef> It has "junk" that you need to traverse |
21:28:51 | FromDiscord | <Elegantbeef> That's pretty much it |
21:29:41 | FromDiscord | <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:53 | FromDiscord | <Phil> So far my view was just "it is what it is" |
21:30:04 | * | deadmarshal_ quit (Ping timeout: 245 seconds) |
21:30:45 | FromDiscord | <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:46 | FromDiscord | <Phil> (edit) "done." => "done."" |
21:30:49 | FromDiscord | <Phil> (edit) ""Thing" => ""Think" |
21:30:56 | FromDiscord | <Phil> (edit) "emulate," => "have in the end," |
21:31:15 | FromDiscord | <Phil> (edit) "based on" => "starting from" |
21:31:33 | FromDiscord | <Phil> Which has been extended to "Maybe use one of those fancy tools Beef sometimes tells me to" |
21:31:41 | FromDiscord | <Phil> (edit) "to"" => "to to generate that NimNode"" |
21:33:56 | FromDiscord | <Chronos [She/Her]> Unsure how I'm supposed to kill off the parent and the call child- |
21:34:03 | FromDiscord | <Chronos [She/Her]> Yes that intentionally sounds horrid |
21:34:28 | FromDiscord | <Phil> "Yes officer, I have the murderer you're looking for here" |
21:34:36 | FromDiscord | <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:02 | FromDiscord | <Phil> Are you talking NimNodes? |
21:35:17 | FromDiscord | <Phil> If so, 1) How do you even "kill" a NimNode 2) why would you ever want to? |
21:36:27 | FromDiscord | <Chronos [She/Her]> Yep NimNodes |
21:36:39 | FromDiscord | <Chronos [She/Her]> Kill by just replacing the parent with a child |
21:38:42 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K2W |
21:39:17 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K2X |
21:39:35 | FromDiscord | <takemichihanagaki3129> What is the pragmatic difference of using Nimble to NimScript for binary projects? |
21:40:32 | FromDiscord | <takemichihanagaki3129> Let's say that my project does not use any external dependence and I don't want to publish it... |
21:44:21 | FromDiscord | <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:57 | FromDiscord | <Elegantbeef> Expand it how? |
21:45:48 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4K2Z |
21:45:48 | FromDiscord | <Phil> In reply to @chronos.vitaqua "Kill by just replacing": How is that kill, isn't that just a swapping out? |
21:45:56 | FromDiscord | <Chronos [She/Her]> (edit) "https://play.nim-lang.org/#ix=4K2Z" => "https://play.nim-lang.org/#ix=4K30" |
21:46:08 | FromDiscord | <Chronos [She/Her]> In reply to @isofruit "How is that kill,": Hey, I wanted to be edgy 😛 |
21:46:54 | FromDiscord | <Phil> ... |
21:46:57 | FromDiscord | <Phil> I have been looking |
21:46:59 | FromDiscord | <Phil> Through the macros docs |
21:47:03 | FromDiscord | <Phil> for like 10 minutes |
21:47:20 | FromDiscord | <Chronos [She/Her]> I shouldn't laugh |
21:47:30 | FromDiscord | <Chronos [She/Her]> But oh my fucking god I'm sorry- |
21:47:40 | FromDiscord | <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:01 | FromDiscord | <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:35 | FromDiscord | <Phil> I mean, I still don't get that one. That's basically making a macro that does `return parentNode[0]` |
21:48:48 | FromDiscord | <Chronos [She/Her]> It'd have to kill it's sibling too |
21:48:56 | FromDiscord | <Chronos [She/Her]> In reply to @chronos.vitaqua "My usecase is making": See here |
21:49:42 | FromDiscord | <Phil> I'd honestly, instead of bothering to manipulate that AST, extract the info I want and construct entirely new nimnodes |
21:50:04 | FromDiscord | <Chronos [She/Her]> I'm not too sure how I'd go about doing that tbh |
21:50:14 | FromDiscord | <Phil> I think that's why I'm so confused because I build the Nodes always de-novo |
21:50:18 | FromDiscord | <Chronos [She/Her]> I need to collect any calls anyway |
21:50:22 | FromDiscord | <Phil> (edit) "Nodes" => "Node-construct I want" |
21:50:32 | FromDiscord | <Chronos [She/Her]> Tho that doesn't stop me from doing it ig |
21:50:59 | FromDiscord | <Chronos [She/Her]> Yeah alright that'll probably be easier, actually |
21:51:06 | FromDiscord | <Chronos [She/Her]> Just got to hack the calls together :p |
21:51:36 | * | xet7 quit (Remote host closed the connection) |
21:51:54 | FromDiscord | <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:16 | FromDiscord | <Phil> I regard macros fundamentally as `map` operations |
21:52:31 | FromDiscord | <Chronos [She/Her]> Makes sense |
21:52:49 | FromDiscord | <Chronos [She/Her]> Though I'm still struggling with mapping this out mentally tbh |
21:52:52 | FromDiscord | <Elegantbeef> Depends what you're doing |
21:52:57 | FromDiscord | <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:01 | FromDiscord | <Elegantbeef> A lot of the times copying the nodes and operating on them are easy enough |
21:53:51 | FromDiscord | <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:11 | FromDiscord | <leorize> you almost never need typed macros to build DSLs |
21:54:24 | FromDiscord | <leorize> in fact it's often that you need untyped for the DSL to even work |
21:54:44 | FromDiscord | <Phil> I mean I needed them for mapster because I needed information about the typedef-nodes of the types of some parameters |
21:55:22 | FromDiscord | <Chronos [She/Her]> In reply to @leorize "you almost never need": Unfortunately I'm not making a DSL here- |
21:55:40 | FromDiscord | <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:15 | FromDiscord | <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:00 | FromDiscord | <leorize> if you're just working with definitions, then it's fine, the trouble is when you work with actual code↵(@Phil) |
21:57:02 | FromDiscord | <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:13 | FromDiscord | <Chronos [She/Her]> Thanks Leorize! |
21:58:16 | FromDiscord | <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:40 | FromDiscord | <leorize> because the compiler forgot to typecheck the parameters |
21:58:56 | FromDiscord | <Chronos [She/Her]> Are `NimNode`s ref objects in the compiler? :p |
21:59:18 | FromDiscord | <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:06 | FromDiscord | <leorize> yes they are↵(@Chronos [She/Her]) |
22:00:15 | FromDiscord | <leorize> and so is every object at compile-time |
22:00:19 | FromDiscord | <Chronos [She/Her]> Ah epic |
22:04:44 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K34 |
22:14:33 | FromDiscord | <wick3dr0se> In reply to @isofruit "Ah <@772217344680001556> I": Oh I didnt even see that part!! Thats so cool lol |
22:14:42 | FromDiscord | <wick3dr0se> Although tbh this part is a bit confusing |
22:15:10 | FromDiscord | <wick3dr0se> Ohhh the variable is the entire block |
22:15:17 | FromDiscord | <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:45 | FromDiscord | <wick3dr0se> Wtf Nim can do some crazy shit |
22:15:47 | FromDiscord | <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:39 | FromDiscord | <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:43 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K38 |
22:17:14 | FromDiscord | <Phil> That is unless you use `return` or `result` |
22:17:38 | FromDiscord | <wick3dr0se> I didnt know return was implicit at all |
22:17:49 | FromDiscord | <Elegantbeef> Unless you use result\ |
22:17:56 | FromDiscord | <wick3dr0se> Yea thats sick |
22:17:56 | FromDiscord | <Phil> Yeh, nim basically has 3 ways to return |
22:17:58 | FromDiscord | <System64 ~ Flandre Scarlet> Is there a Nim language server for Geany please? |
22:18:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/Bhox8 |
22:18:18 | FromDiscord | <Phil> I mean that's early returning |
22:18:18 | FromDiscord | <wick3dr0se> But is it preferred to use return anyway? |
22:18:21 | FromDiscord | <wick3dr0se> Or result? |
22:19:00 | FromDiscord | <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:27 | FromDiscord | <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:42 | FromDiscord | <Phil> (edit) "procs" => "procs, e.g. `proc double(x: int): int = 2x`" |
22:20:00 | FromDiscord | <Phil> (In that one 2x is strictly speaking using the expression syntax to return) |
22:20:00 | FromDiscord | <wick3dr0se> That makes sense to me |
22:20:24 | FromDiscord | <wick3dr0se> I'm really wanting to learn the magic of macros.. I just started learning templates and that blew my mind 🤣 |
22:20:38 | FromDiscord | <wick3dr0se> Gotta start reading more |
22:21:11 | FromDiscord | <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:12 | FromDiscord | <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:35 | FromDiscord | <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:03 | FromDiscord | <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:27 | FromDiscord | <Phil> Beyond that I can't say I ever needed them rather than generic procs or macros |
22:23:03 | FromDiscord | <Elegantbeef> Sure but it's still an expressio |
22:23:47 | FromDiscord | <Phil> Man the bridge delayed that |
22:24:02 | FromDiscord | <ElegantBeouf> Yea I figured with the lack of response 😄 |
22:24:47 | FromDiscord | <Chronos [She/Her]> Struggle™️ |
22:25:05 | FromDiscord | <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:11 | FromDiscord | <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:37 | FromDiscord | <wick3dr0se> sent a code paste, see https://play.nim-lang.org/#ix=4K3d |
22:25:46 | FromDiscord | <Chronos [She/Her]> In reply to @isofruit "I have a valid": It's alright, dw aha |
22:25:51 | FromDiscord | <Chronos [She/Her]> I just love complaining :p |
22:26:04 | FromDiscord | <ElegantBeouf> In reply to @wick3dr0se "What do you think": It's "fine", one might argue a normal proc is more sensible there |
22:26:50 | FromDiscord | <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:59 | FromDiscord | <ElegantBeouf> sent a code paste, see https://play.nim-lang.org/#ix=4K3e |
22:27:25 | FromDiscord | <wick3dr0se> Oh shit i didnt know we could do that either |
22:27:30 | FromDiscord | <wick3dr0se> Im learning a fuck ton today |
22:27:35 | FromDiscord | <Phil> Name it after the context it is supposed to provide, like `withArgs` |
22:28:14 | FromDiscord | <wick3dr0se> Alright that makes sense.. Naming is so hard lol |
22:28:18 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K3g |
22:28:37 | FromDiscord | <Phil> Or I guess `client.withArgs(minArgs = 3)` |
22:29:03 | FromDiscord | <wick3dr0se> Wait so I can specify a procedure or do()? |
22:29:06 | FromDiscord | <Phil> (At least I think you can do the parameter assignment like this in templates as well) |
22:29:10 | FromDiscord | <ElegantBeouf> In reply to @wick3dr0se "Wait so I can": Yes |
22:29:22 | FromDiscord | <ElegantBeouf> `do(...) -> T` is syntax sugar for an anonymous procedure |
22:29:48 | FromDiscord | <wick3dr0se> Damn thats majestic |
22:30:40 | FromDiscord | <Chronos [She/Her]> My macro does jackshit to the AST oof |
22:31:11 | FromDiscord | <Phil> Well maybe have it do nice things to the AST then 😛 |
22:32:17 | FromDiscord | <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:29 | FromDiscord | <Elegantbeef> One day I'll write a matrix bridge, I swear it 😄 |
22:32:41 | FromDiscord | <Phil> Let me jot that down real quick so I can hold you to it xP |
22:34:54 | FromDiscord | <Phil> ... well the bridge dropped a couple messages from chronos but... it's caught up I guess, yay? |
22:36:07 | FromDiscord | <Chronos [She/Her]> I am still pain- |
22:37:24 | FromDiscord | <Chronos [She/Her]> https://play.nim-lang.org/#ix=4K3n |
22:37:31 | FromDiscord | <Chronos [She/Her]> This does nothing |
22:37:51 | FromDiscord | <Chronos [She/Her]> Maybe... I'll try a new node from scratch |
22:38:30 | FromDiscord | <ElegantBeouf> Just make a proc that recurses down the tree replacing nodes |
22:38:57 | FromDiscord | <Chronos [She/Her]> That's what I tried to do :p |
22:39:08 | FromDiscord | <Elegantbeef> No you wrote a proc that .... does something |
22:39:28 | FromDiscord | <Chronos [She/Her]> Lol |
22:39:35 | FromDiscord | <Chronos [She/Her]> What does it do Beef |
22:39:40 | FromDiscord | <Elegantbeef> No clue |
22:39:42 | FromDiscord | <Chronos [She/Her]> Because for the love of god I am lost |
22:40:48 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4K3p |
22:41:07 | FromDiscord | <Chronos [She/Her]> Huh? |
22:41:37 | FromDiscord | <Chronos [She/Her]> Ah |
22:41:51 | FromDiscord | <Elegantbeef> I don't know what you `stripCall` was doing, so I approximated what it should do |
22:41:56 | FromDiscord | <Chronos [She/Her]> But I need to remove the `Infix`- |
22:42:09 | FromDiscord | <Chronos [She/Her]> Fair enough aha |
22:42:15 | FromDiscord | <Chronos [She/Her]> Hm... |
22:42:43 | FromDiscord | <Chronos [She/Her]> I think I can work with this- |
22:46:05 | FromDiscord | <Chronos [She/Her]> I need to set `parent` to a completely different node oof |
22:50:32 | * | deadmarshal_ joined #nim |
22:50:54 | FromDiscord | <Chronos [She/Her]> Maybe I'm going about this wrong |
22:51:34 | FromDiscord | <Chronos [She/Her]> Sigh |
22:51:56 | FromDiscord | <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:32 | FromDiscord | <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:49 | FromDiscord | <Chronos [She/Her]> Yeah- |
22:52:55 | FromDiscord | <Chronos [She/Her]> I don't like ASTs :p |
23:00:13 | FromDiscord | <Phil> Eh, I like the flexibility they provide |
23:00:25 | FromDiscord | <Phil> It's there when I need it, I like that kind of tooling |
23:00:51 | FromDiscord | <Phil> I mean, after all it allows for owlkettle's DSL which I like in temrs of useage |
23:00:55 | FromDiscord | <Phil> (edit) "temrs" => "terms" |
23:01:08 | FromDiscord | <Phil> ~~Not that I understand the implementation, but I like using it!~~ |
23:11:09 | FromDiscord | <Chronos [She/Her]> I'll do more of this stuff tomorrow :p |
23:33:55 | FromDiscord | <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:04 | FromDiscord | <.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:13 | FromDiscord | <Elegantbeef> It still should |
23:38:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4K3x |
23:38:58 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4K3y |
23:39:28 | FromDiscord | <user2m> `innerText` is cstring |
23:40:09 | FromDiscord | <user2m> ok I think this did it `let last_inv_num = parseInt($(inv_num_field.innerText))` |
23:40:10 | FromDiscord | <Elegantbeef> That's a unary operator that binds on the entire expression |
23:40:14 | FromDiscord | <Elegantbeef> you want ($inv\_num\_field.innerText).parseint |
23:40:14 | FromDiscord | <Elegantbeef> or `parseInt ...` |