00:00:21 | * | azimut quit (Ping timeout: 252 seconds) |
00:11:51 | * | azimut joined #nim |
00:36:43 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4HaH |
00:45:57 | FromDiscord | <leorize_alt> do it the same way as JS, make it take an object |
00:46:45 | * | Mister_Magister quit (Ping timeout: 252 seconds) |
00:49:57 | * | rockcavera quit (Remote host closed the connection) |
00:56:33 | * | Mister_Magister joined #nim |
01:07:05 | * | thomasross joined #nim |
01:16:12 | FromDiscord | <millymox> In reply to @leorize_alt "do it the same": Can you give an example please? |
01:22:19 | * | jmdaemon joined #nim |
01:28:41 | * | jkl joined #nim |
01:55:07 | * | azimut quit (Ping timeout: 252 seconds) |
02:03:15 | * | edr quit (Quit: Leaving) |
02:24:53 | NimEventer | New thread by mig: [help] Nim JIT + REPL with clang backend + -emit-llvm + LLVM's ORCv2, see https://forum.nim-lang.org/t/10511 |
03:07:54 | FromDiscord | <grumblygibson> In reply to @millymox "Anyone know how i": In the Nim proc or the imports Pragma? |
03:08:05 | FromDiscord | <grumblygibson> (edit) "imports" => "importjs" |
03:15:59 | FromDiscord | <millymox> In reply to @grumblygibson "In the Nim proc": Both honestly |
03:26:21 | * | disso-peach quit (Quit: Leaving) |
03:28:35 | * | pbsds quit (Ping timeout: 240 seconds) |
03:36:37 | * | pbsds joined #nim |
04:54:01 | * | nyeaa4928423010 quit (Read error: Connection reset by peer) |
04:54:28 | * | nyeaa4928423010 joined #nim |
05:10:51 | * | def- quit (Quit: -) |
05:12:10 | * | def- joined #nim |
05:32:20 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4Hbr |
05:35:15 | FromDiscord | <sOkam! 🫐> When you have a LOT of paramenters, that pattern becomes something like this↵https://github.com/heysokam/confy/blob/fb33377132eda19ab90f3099c05cebd4cd7d829b/src/confy/obj.nim#L17-L41↵Which is not the best, but.. waay better to mentally parse than single line or a couple of long lines |
05:35:28 | FromDiscord | <sOkam! 🫐> (edit) "paramenters," => "parameters," |
05:36:03 | FromDiscord | <huantian> just don't copy sokam's whitespace |
05:41:29 | * | derpydoo joined #nim |
05:45:27 | * | thomasross quit (Ping timeout: 240 seconds) |
06:04:23 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4HbA |
06:04:30 | FromDiscord | <millymox> Definitely a lot easier than a single line |
06:04:33 | FromDiscord | <millymox> Lmao |
06:04:42 | FromDiscord | <odexine> In reply to @huantian "just don't copy sokam's": xd |
06:05:20 | FromDiscord | <odexine> just you wait for my formatter :baqua: |
06:05:23 | * | ntat joined #nim |
06:06:09 | FromDiscord | <millymox> In reply to @huantian "just don't copy sokam's": 😭 |
06:06:46 | FromDiscord | <huantian> In reply to @odexine "just you wait for": wait are you actually making a nim formatter? |
06:06:50 | FromDiscord | <odexine> yes |
06:06:55 | FromDiscord | <huantian> I've been meming about that with beef for forever |
06:07:13 | FromDiscord | <odexine> im still in the "experimenting with things" phase |
06:07:30 | FromDiscord | <odexine> not sure what i'm gonna do about parsing the code, but i already have the formatting component on the way |
06:10:18 | FromDiscord | <huantian> custom Nim CST parser! |
06:10:56 | FromDiscord | <odexine> see i was thinking about that but that's fragile |
06:11:08 | FromDiscord | <odexine> i'd prolly need to adopt the nim test suite to test things had i done that |
06:11:13 | FromDiscord | <odexine> rather, if i do that |
06:12:09 | FromDiscord | <huantian> did you have any other ideas then? |
06:13:34 | FromDiscord | <odexine> not really |
06:14:14 | FromDiscord | <odexine> perhaps i will have to write the parser from scratch, and if ever maybe it could be used officially if it becomes good enough, but first i'd have to isolate which test cases test the parsing and lexing in nim |
06:14:30 | * | ensyde joined #nim |
06:15:04 | * | ensyde is now known as envy |
06:16:04 | FromDiscord | <millymox> In reply to @huantian "wait are you actually": Extension like for vscode? |
06:19:38 | FromDiscord | <odexine> no |
06:19:51 | FromDiscord | <millymox> Oh |
06:20:00 | FromDiscord | <millymox> https://tenor.com/view/crying-meme-black-guy-cries-sad-man-thank-god-for-my-reefer-hood-news-gif-24902056 |
06:39:17 | FromDiscord | <huantian> In reply to @odexine "perhaps i will have": one idea would be to aim toward an official cst in the compiler, which is used to make the current ast |
06:39:24 | FromDiscord | <huantian> but that feels quite farfetched of an idea |
07:15:32 | * | jmd_ joined #nim |
07:15:52 | * | jmdaemon quit (Read error: Connection reset by peer) |
07:42:23 | FromDiscord | <odexine> @huantian do you have any documentation on how CSTs should be designed |
07:46:51 | FromDiscord | <mrgaturus> sent a code paste, see https://play.nim-lang.org/#ix=4HbM |
07:47:10 | FromDiscord | <mrgaturus> (edit) "https://play.nim-lang.org/#ix=4HbM" => "https://play.nim-lang.org/#ix=4HbN" |
07:52:58 | FromDiscord | <JJ> oh @odexine have you considered binding to alaviss's grammar for parsing |
07:53:43 | FromDiscord | <JJ> i think it's like. correct (except for unicode) |
08:01:42 | FromDiscord | <odexine> i have |
08:01:59 | FromDiscord | <odexine> still worried about correctness nonetheless |
08:57:53 | * | envy quit (Quit: WeeChat 4.0.4) |
09:05:59 | * | def- quit (Quit: -) |
09:06:43 | * | def- joined #nim |
09:07:05 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4Hc8 |
09:08:59 | FromDiscord | <Elegantbeef> It doesnt make much sense as you've just recreated `ptr T` |
09:26:19 | * | def- quit (Quit: -) |
09:28:37 | * | def- joined #nim |
09:31:38 | * | def- quit (Client Quit) |
09:32:53 | * | def- joined #nim |
10:30:12 | * | derpydoo quit (Ping timeout: 240 seconds) |
11:13:08 | * | ntat quit (Quit: leaving) |
11:21:25 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4HcZ |
11:22:39 | FromDiscord | <System64 ~ Flandre Scarlet> If yes, it might kill performances |
11:27:07 | * | azimut joined #nim |
11:38:49 | * | lucasta_ joined #nim |
11:40:37 | * | lucasta_ quit (Client Quit) |
11:42:40 | FromDiscord | <demotomohiro> It probably isn't copied. You can read C source code to see if it is copied. |
11:49:22 | FromDiscord | <.aingel.> OOh what are you doing @System64 ~ Flandre Scarlet |
11:49:25 | FromDiscord | <.aingel.> Are you doing some audio stuff |
11:57:02 | * | ntat joined #nim |
11:58:17 | * | Mister_Magister quit (Read error: Connection reset by peer) |
12:01:03 | * | Mister_Magister joined #nim |
12:01:31 | * | junaid_ joined #nim |
12:12:40 | FromDiscord | <fowl.mouth> https://nim-lang.org/docs/destructors.html this is pretty cool, I need to get back into Nim |
12:14:29 | FromDiscord | <xtrayambak> sent a code paste, see https://play.nim-lang.org/#ix=4Hde |
12:19:17 | FromDiscord | <fowl.mouth> In reply to @xtrayambak "Why does this code": Are your trying to open a Unix socket or network socket |
12:19:37 | FromDiscord | <xtrayambak> A UNIX socket, I'm mostly copying somebody else's Python code here. |
12:19:54 | FromDiscord | <xtrayambak> I want to read some data off of a UNIX socket path |
12:21:54 | FromDiscord | <demotomohiro> Are you using windows? |
12:22:27 | FromDiscord | <fowl.mouth> The error says your system doesn’t support it. I would check the man pages for the underlying function for more info |
12:22:42 | FromDiscord | <xtrayambak> In reply to @demotomohiro "Are you using windows?": Nope, I use Linux. |
12:23:03 | FromDiscord | <xtrayambak> I'm pretty sure the documentation says you can't use AF_UNIX on a non-Unix compliant machine |
12:23:08 | FromDiscord | <xtrayambak> OS |
12:23:51 | FromDiscord | <odexine> use IPPROTO_IP instead of IPPROTO_TCP i assume would be the fix? |
12:24:12 | FromDiscord | <odexine> ~~technically linux is not unix compliant~~ |
12:24:50 | FromDiscord | <xtrayambak> Yeah, but Posix is mostly compatible with Unix afaik |
12:25:19 | FromDiscord | <xtrayambak> In reply to @odexine "use IPPROTO_IP instead of": Aaaah, this worked. |
12:25:20 | FromDiscord | <xtrayambak> Thanks! |
12:25:25 | FromDiscord | <xtrayambak> The manpages are pretty vague. |
12:25:35 | FromDiscord | <xtrayambak> Or perhaps I should download the full manpages |
12:26:59 | FromDiscord | <odexine> i'm not sure why it works |
12:27:04 | FromDiscord | <odexine> i just found it as a solution |
12:27:20 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @.aingel. "Are you doing some": Yeah, a modular wavetable synth |
12:27:36 | FromDiscord | <odexine> i mean i understadn that obviously unix domain sockets dont use tcp |
12:31:01 | FromDiscord | <odexine> https://github.com/nim-lang/Nim/issues/3320 |
12:31:07 | FromDiscord | <odexine> great xd |
12:33:40 | FromDiscord | <Hamid_Bluri> Is there a data serializer except `JSONY` that works both on `JS` and `C` backends? ↵↵I hate that JSON cannot store something other that `string` as key for Object |
12:34:52 | FromDiscord | <Hamid_Bluri> also JSONY does not work well on `JS` backend |
12:35:42 | FromDiscord | <Hamid_Bluri> I really appreciate `edn` format for Clojure |
12:35:48 | FromDiscord | <odexine> json object keys are standardised to only allow strings as keys |
12:36:33 | FromDiscord | <xtrayambak> In reply to @hamidb80 "Is there a data": There's a good reason as to why JSON can only store a key as string. It's generally faster and it's easier to traverse and manipulate the data like that, but if you really want objects, assign each one an ID, and use that ID as the key, and simultaneously keep a track of the objects. |
12:36:38 | FromDiscord | <xtrayambak> But that's just asking for trouble |
12:36:48 | FromDiscord | <xtrayambak> If you want something like that, you're better of using protobuf |
12:36:54 | FromDiscord | <xtrayambak> Or something along the lines of that |
12:38:38 | FromDiscord | <xtrayambak> Or, alternatively, use `std/marshal` if you want an easy way to represent objects as strings. |
12:38:59 | FromDiscord | <odexine> marshal i believe is somewhat unsafe for serialisation |
12:39:12 | FromDiscord | <odexine> be sure to trust the source, i think |
12:39:33 | FromDiscord | <xtrayambak> I think that was just Python's pickle and doesn't carry over to marshal. |
12:39:53 | FromDiscord | <xtrayambak> If it did, it'd be really irresponsible to not warn the programmer about that since there's no warning about RCE in the docs. |
12:40:01 | FromDiscord | <odexine> i believe python also has a marshal |
12:40:08 | FromDiscord | <odexine> yes |
12:40:11 | FromDiscord | <xtrayambak> Yeah, but Nim uses a different approach |
12:40:12 | FromDiscord | <odexine> it is a mixup |
12:40:13 | FromDiscord | <odexine> https://docs.python.org/3/library/marshal.html |
12:40:22 | FromDiscord | <xtrayambak> `std/marshal` represents objects as JSON |
12:40:34 | FromDiscord | <xtrayambak> Pickle and marshal use their own custom binary format afaik |
12:40:36 | FromDiscord | <odexine> i still think it is potentially dangerous as the type is not serialised |
12:41:35 | FromDiscord | <odexine> it may have some limitations as well, i am not sure if it can handle object variants |
12:43:06 | FromDiscord | <System64 ~ Flandre Scarlet> @.aingel. https://media.discordapp.net/attachments/371759389889003532/1155122165339922440/image.png |
12:43:11 | FromDiscord | <Hamid_Bluri> I looked at protobuf and I think JSONY is the best option 😕 |
12:43:27 | FromDiscord | <Hamid_Bluri> In reply to @sys64 "<@1152336447467163790>": wow |
12:43:59 | FromDiscord | <System64 ~ Flandre Scarlet> This tool is very powerful for sampling! |
12:44:16 | FromDiscord | <xtrayambak> Looks cool! |
12:44:22 | FromDiscord | <System64 ~ Flandre Scarlet> Thnkq! |
12:44:29 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "Thnkq!" => "Thanks!" |
12:44:49 | FromDiscord | <odexine> In reply to @hamidb80 "I looked at protobuf": why so? |
12:47:04 | FromDiscord | <xtrayambak> Protobuf is very complicated |
12:47:20 | FromDiscord | <xtrayambak> I had the displeasure of using it once. Never again. Never ever again. |
12:47:29 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @demotomohiro "It probably isn't copied.": > Arrays are value types, like any other Nim type. The assignment operator copies the whole array contents.↵So I think the array is copied |
12:47:57 | FromDiscord | <Hamid_Bluri> In reply to @xtrayambak "Protobuf is very complicated": yeah feel the same :/ |
12:49:08 | FromDiscord | <xtrayambak> I was really bored recently as some of my projects are showing vague gcc errors (apparently it's being fixed), and I'm writing a wrapper for the Hyprland IPC in Nim just for fun. |
12:49:20 | FromDiscord | <xtrayambak> I might add macros to make writing a config in Nim a breeze. |
12:49:34 | FromDiscord | <xtrayambak> (and hence the UNIX socket path tomfooleries) |
12:50:10 | FromDiscord | <odexine> In reply to @xtrayambak "I was really bored": oh hey i was considering that too |
12:50:14 | FromDiscord | <demotomohiro> In reply to @sys64 "> Arrays are value": When you do `x = y` and both x and y are value type, they are copied. But it doesn't mean value types are passed by copy to procedures. |
12:50:59 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @demotomohiro "When you do `x": Oh alright |
12:52:43 | FromDiscord | <System64 ~ Flandre Scarlet> ``calculatorModule.nim(81, 23) Error: 'moduleList' is of type <var array[0..255, SynthModule]> which cannot be captured as it would violate memory safety`` OOF |
12:53:31 | FromDiscord | <xtrayambak> When I try to compile said project, it gives some vague error about "target specific option mismatch" |
12:54:00 | FromDiscord | <xtrayambak> It seems to happen when compiling `parsexml` |
12:54:44 | FromDiscord | <xtrayambak> https://pastebin.com/mbicrNsd |
12:55:23 | FromDiscord | <odexine> In reply to @sys64 "``calculatorModule.nim(81, 23) Error: 'moduleList'": no var inside async |
12:55:32 | FromDiscord | <odexine> or thread functions |
12:55:47 | FromDiscord | <odexine> (not sure about the thread one but im sure of async) |
12:55:50 | FromDiscord | <odexine> not sure which you're using |
12:56:57 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @odexine "not sure which you're": Thread |
12:57:38 | FromDiscord | <odexine> if you want to modify things use channels to send updates across threads, or guard with locks |
13:00:02 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright, good to know |
13:00:29 | FromDiscord | <xtrayambak> Ayyy, I got some basic Hyprland IPC working |
13:00:35 | FromDiscord | <xtrayambak> I can send reload commands |
13:04:55 | FromDiscord | <xtrayambak> I'm still wondering if I should raise a defect when a command fails or just use a status+error tuple |
13:34:21 | * | junaid_ quit (Remote host closed the connection) |
13:47:47 | FromDiscord | <Chronos [She/Her]> How would an event system function across threads hm... |
13:48:38 | FromDiscord | <Chronos [She/Her]> Anyway |
13:49:03 | * | pbsds quit (Ping timeout: 240 seconds) |
13:49:06 | FromDiscord | <Chronos [She/Her]> Anyone experimented with async across threads by setting the dispatcher to the one in the original thread? |
13:56:33 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "How would an event": easy - handlers with {.gcsafe.} and store pointers to function, when post - cast to proc |
13:56:39 | FromDiscord | <griffith1deadly> but for async idk |
13:58:42 | * | pbsds joined #nim |
13:59:31 | FromDiscord | <amjadhd> sent a code paste, see https://paste.rs/ABhZG |
13:59:32 | FromDiscord | <Chronos [She/Her]> In reply to @griffith1deadly "easy - handlers with": But wouldn't that run a function registered from another thread, inside the main thread (where the event system is running)? Or by handler do you mean something that's checking for any new events any time it's ran? |
14:02:28 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "But wouldn't that run": actually, it will depend on where fire is called. the approach I described simply makes it possible to register from different threads and safely execute the code. ↵as for having the thread that registered the code execute it: will it be worth it at all? the cost of a local event loop, etc... |
14:06:00 | FromDiscord | <Chronos [She/Her]> Yeah probably not oof |
14:06:33 | FromDiscord | <Chronos [She/Her]> My event system does support async event firing too which is nice |
14:08:06 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "My event system does": maybe add option for non-blocking async? for just message passing |
14:09:30 | FromDiscord | <Chronos [She/Her]> My code already does that, doesn't wait for the response aha |
14:09:57 | FromDiscord | <Chronos [She/Her]> I think you've starred the repo actually, https://github.com/Nimberite-Development/Trigger-Nim |
14:10:05 | FromDiscord | <griffith1deadly> fire proc wait response, asyncFire - ye |
14:10:31 | FromDiscord | <Chronos [She/Her]> Yeah aha |
14:11:12 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "I think you've starred": aha ye https://media.discordapp.net/attachments/371759389889003532/1155144335487156244/image.png |
14:12:36 | FromDiscord | <Chronos [She/Her]> I really need an application where I actually use this ngl :p |
14:25:36 | NimEventer | New Nimble package! getprime - Generate random prime numbers, and do prime number tests. Note: don't support prime numbers larger than approximately 3037000499 (sqrt(int.high))., see https://github.com/xjzh123/getprime |
14:27:05 | FromDiscord | <Chronos [She/Her]> The primes are hardcoded? |
14:29:09 | FromDiscord | <.aingel.> In reply to @chronos.vitaqua "The primes are hardcoded?": I doubt it? |
14:38:21 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "I really need an": your modernnet repo is minecraft protocol? |
14:38:34 | FromDiscord | <griffith1deadly> if so, only one protocol supported? |
14:42:57 | * | ntat quit (Quit: leaving) |
14:49:59 | FromDiscord | <Chronos [She/Her]> In reply to @griffith1deadly "your modernnet repo is": Only for parsing the packet and sending your own data currently yeah |
14:50:23 | FromDiscord | <Chronos [She/Her]> In reply to @griffith1deadly "if so, only one": You can use it for multiple different MC versions actually, for all the modern MC versions |
14:54:26 | * | Mister_Magister quit (Read error: Connection reset by peer) |
14:55:42 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "You *can* use it": thanks. in fact, I've been looking in that direction for a long time, and was using the wrong approach, it turns out |
14:56:11 | * | Mister_Magister joined #nim |
14:56:39 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4He0 |
14:59:55 | FromDiscord | <Chronos [She/Her]> It's 1.14+, don't think earlier would work, and anything earlier than 1.12 definitely won't work tho |
15:00:13 | FromDiscord | <Chronos [She/Her]> In reply to @griffith1deadly "thanks. in fact, I've": It's fine aha, if you need any help I'm down for it |
15:00:29 | FromDiscord | <Chronos [She/Her]> Been wanting to make an MC thing but kept messing up tbh |
15:11:31 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "It's 1.14+, don't think": sounds sadly |
15:11:49 | FromDiscord | <griffith1deadly> because i want make implementation for 1.7.10 version |
15:13:15 | FromDiscord | <Chronos [She/Her]> In reply to @griffith1deadly "because i want make": I could see if I could implement the packet parsing for it if you want? I think a good part of the code should still work but some parts may not |
15:18:54 | FromDiscord | <huantian> In reply to @odexine "<@300050030923087872> do you have": Nah I don’t know of any off the top of my head |
15:19:10 | FromDiscord | <Chronos [She/Her]> Oh wait @griffith1deadly it looks like 1.7 also uses a similar packet format so you should be fine actually |
15:19:25 | FromDiscord | <Chronos [She/Her]> Just make sure you use wiki.vg to look for any differences more in-depth |
15:19:48 | FromDiscord | <odexine> In reply to @huantian "Nah I don’t know": seems like its prolly my best bet to use leorize's treesitter |
15:19:52 | FromDiscord | <odexine> (edit) "In reply to @huantian "Nah I don’t know": seems like its prolly my best bet to use leorize's treesitter ... " added "syntax" |
15:20:08 | FromDiscord | <odexine> in which case i do not need to design the CST because its already there |
15:25:44 | * | jmd_ quit (Ping timeout: 255 seconds) |
15:26:26 | FromDiscord | <huantian> Oh yeah the treesitter stuff exists |
15:27:18 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "Oh wait <@620135501201932300> it": i will check it |
15:27:37 | FromDiscord | <Chronos [She/Her]> Good luck! |
15:28:02 | FromDiscord | <huantian> Are you doing a code -> cst -> code kinda thing |
15:36:50 | FromDiscord | <odexine> In reply to @huantian "Are you doing a": me? or who |
15:37:47 | NimEventer | New thread by Millymox: Making function params optional when wrapping a JS library?, see https://forum.nim-lang.org/t/10512 |
15:40:13 | FromDiscord | <huantian> In reply to @odexine "me? or who": You |
15:40:32 | FromDiscord | <odexine> In reply to @huantian "Are you doing a": the formatter.. |
15:40:35 | FromDiscord | <odexine> didnt we just |
15:45:15 | * | azimut quit (Ping timeout: 252 seconds) |
15:49:08 | * | krux02 joined #nim |
15:55:29 | * | derpydoo joined #nim |
16:01:30 | FromDiscord | <huantian> Yeah |
16:01:46 | FromDiscord | <huantian> Just asking if that would be the general idea for it |
16:02:18 | FromDiscord | <odexine> yes |
16:28:27 | * | junaid_ joined #nim |
16:28:45 | * | ntat joined #nim |
16:31:44 | * | Mister_Magister quit (Read error: Connection reset by peer) |
16:32:14 | FromDiscord | <.aingel.> Is it sort of an alright practice to make your own local nimble library with a bunch of utility functions that you use and source it in all your projects? |
16:32:41 | FromDiscord | <.aingel.> Furthermore would it be alright to actually publish this library if you think that it could possibly be of benefit to other people? Idk |
16:33:34 | * | Mister_Magister joined #nim |
16:34:06 | FromDiscord | <odexine> status does that with `stew` no? |
16:36:44 | FromDiscord | <raynei486> In reply to @.aingel. "Is it sort of": writing general utility functions (rolling your own standard library) is a pretty common exercise (and a good one) |
16:37:23 | FromDiscord | <raynei486> learn API design and on whatever topic you're implementing |
16:41:56 | FromDiscord | <.aingel.> In reply to @raynei486 "writing general utility functions": Gotcha |
16:41:59 | FromDiscord | <.aingel.> `Option(seq[string])` |
16:42:03 | FromDiscord | <.aingel.> Is this not possible? |
16:42:12 | FromDiscord | <.aingel.> Do I have to make another type for seq[string] or something? |
16:58:58 | * | azimut joined #nim |
17:25:51 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4HeR |
17:26:06 | FromDiscord | <millymox> (edit) "https://play.nim-lang.org/#ix=4HeR" => "https://paste.rs/l67ri" |
17:35:34 | FromDiscord | <odexine> you dont use newJsObject like that |
17:36:05 | FromDiscord | <millymox> How do i use it? |
17:36:17 | FromDiscord | <Chronos [She/Her]> @griffith1deadly oh also if you do wrap the packets and such for 1.7, please submit a PR? 👀 |
17:36:37 | FromDiscord | <Chronos [She/Her]> It'd be nice to be able to have a collection of packets wrapped in Nim honestly |
17:38:15 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "<@620135501201932300> oh also if": sure |
17:38:22 | FromDiscord | <Chronos [She/Her]> :D |
17:38:35 | FromDiscord | <Chronos [She/Her]> I should really start wrapping the newer MC versions honestly |
17:39:14 | FromDiscord | <odexine> apparently? |
17:39:14 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "It'd be nice to": are you planning make object interitance event system in nim? (one event system for all types) |
17:39:15 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#ix=4HeW |
17:40:25 | FromDiscord | <juancarlospaco> sent a code paste, see https://play.nim-lang.org/#ix=4HeX |
17:40:39 | FromDiscord | <odexine> https://nim-lang.org/docs/jsffi.html#js we'd prolly be both right |
17:42:41 | FromDiscord | <Chronos [She/Her]> In reply to @griffith1deadly "are you planning make": I don't think I understand? |
17:43:28 | FromDiscord | <Chronos [She/Her]> Yeah I just don't understand aha |
17:44:05 | FromDiscord | <Chronos [She/Her]> Do you mean something kind of like how JS does it? |
17:45:05 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "I don't think I": like jvm MinecraftForge event system ↵event system just for Event type, but you can pass any object like MyEvent = object of Event↵i know, it harder todo in nim, but useful |
17:51:34 | FromDiscord | <Chronos [She/Her]> In reply to @griffith1deadly "like jvm MinecraftForge event": Ah that's actually totally possible |
17:51:56 | FromDiscord | <Chronos [She/Her]> I'd have to do a bit of generic abuse tho if I wanted to make it so people can register their own custom events |
17:52:05 | FromDiscord | <Chronos [She/Her]> It won't be something in trigger but |
17:52:27 | FromDiscord | <Chronos [She/Her]> In reply to @griffith1deadly "like jvm MinecraftForge event": Though I wonder what would this fill that Trigger doesn't? |
17:57:56 | * | Mister_Magister quit (Read error: Connection reset by peer) |
17:59:26 | FromDiscord | <Chronos [She/Her]> Actually I think this can be done with the current system |
17:59:40 | FromDiscord | <Chronos [She/Her]> You literally just need to make a custom type and stuff |
17:59:44 | * | Mister_Magister joined #nim |
18:00:10 | FromDiscord | <Chronos [She/Her]> I'll see if I can make a code example in a sec |
18:07:05 | FromDiscord | <griffith1deadly> sent a long message, see http://ix.io/4Hf7 |
18:31:12 | FromDiscord | <Chronos [She/Her]> In reply to @griffith1deadly "if it is possible,": Generics can get around this actually |
18:31:37 | FromDiscord | <Chronos [She/Her]> Tho after some thinking, Trigger would need slight modifications to do what you want |
18:34:08 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "Tho after some thinking,": if you're happy with everything in your library, i don't think you need to do it 🙂↵i just suggested a use case for this, for myself personally i have already written a system similar to Godot's signals (i could share in dm's if needed) |
18:34:30 | * | ntat quit (Quit: leaving) |
18:38:06 | FromDiscord | <Chronos [She/Her]> Eh it's actually no skin off my back, the modifications are just a when statement and removing `R: tuple` so that any type could be passed |
18:45:54 | FromDiscord | <Chronos [She/Her]> https://pastebin.com/N4pA1bWX this is... insane console spam |
18:47:40 | FromDiscord | <Chronos [She/Her]> Also wow I encountered something a bit odd |
18:55:49 | FromDiscord | <Chronos [She/Her]> I uh... apparently also made the playground kill my code despite it compiling for me...? |
18:55:50 | FromDiscord | <Chronos [She/Her]> https://play.nim-lang.org/#ix=4Hfe |
18:56:05 | FromDiscord | <Chronos [She/Her]> Don't know what I fucked up ip that badly |
18:58:56 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "I uh... apparently also": for picked version of nim 1.6.14 it work, if remove default values |
18:59:10 | FromDiscord | <griffith1deadly> (edit) "In reply to @chronos.vitaqua "I uh... apparently also": for picked version of nim 1.6.14 it work, if remove default values ... " added "(on playground)" |
18:59:44 | FromDiscord | <griffith1deadly> (edit) "playground)" => "playground)↵https://play.nim-lang.org/#ix=4Hfg" |
19:00:01 | FromDiscord | <Chronos [She/Her]> Okay well I ported the code to work in Nim 1.16.4 (removed the assignments in object declaration but) here's the actual issue |
19:00:04 | FromDiscord | <Chronos [She/Her]> Ah yeah lol |
19:00:15 | FromDiscord | <Chronos [She/Her]> But yeah it gives that issue |
19:01:03 | FromDiscord | <griffith1deadly> for me work good (?) https://media.discordapp.net/attachments/371759389889003532/1155217279689166931/image.png |
19:01:20 | FromDiscord | <Chronos [She/Her]> It shouldn't be giving an out of bounds message |
19:01:22 | FromDiscord | <Chronos [She/Her]> Hold on |
19:04:40 | FromDiscord | <Chronos [She/Her]> https://play.nim-lang.org/#ix=4Hfi this is what happened before |
19:05:08 | FromDiscord | <Chronos [She/Her]> The only differences between the encode is me removing `R: tuple` and making it just be `R`, as well as adding `when R is tuple` statements |
19:05:15 | * | thomasross joined #nim |
19:06:05 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "The only differences between": haha funny |
19:06:27 | FromDiscord | <Chronos [She/Her]> Yeah, I was trying to make the lib slightly more flexible :p |
19:09:44 | * | Mister_Magister quit (Ping timeout: 258 seconds) |
19:23:14 | FromDiscord | <Chronos [She/Her]> I uh, am so confused |
19:33:58 | * | junaid_ quit (Quit: leaving) |
19:35:20 | * | junaid_ joined #nim |
19:54:17 | * | junaid_ quit (Remote host closed the connection) |
19:54:43 | * | Mister_Magister joined #nim |
20:13:00 | FromDiscord | <griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=4Hfp |
20:13:20 | FromDiscord | <griffith1deadly> (edit) "https://play.nim-lang.org/#ix=4Hfp" => "https://play.nim-lang.org/#ix=4Hfq" |
20:15:38 | FromDiscord | <Chronos [She/Her]> Not sure tbh |
20:16:53 | FromDiscord | <Chronos [She/Her]> Okay I think I need to make a slightly different event system to do the events like how Forge does them oof |
20:17:07 | FromDiscord | <Chronos [She/Her]> Modifying the existing one just won't work as needed |
20:18:09 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "Modifying the existing one": yeah, that's what i was gonna say |
20:18:26 | FromDiscord | <Chronos [She/Her]> Though I'm not sure about how event firing would work |
20:18:45 | FromDiscord | <Chronos [She/Her]> It's doable but in a weird way? |
20:19:40 | FromDiscord | <Chronos [She/Her]> Hold on I'll make an example rn actually |
20:19:50 | FromDiscord | <griffith1deadly> in jvm it very easy, because you can storing types in runtime storages |
20:20:02 | FromDiscord | <Chronos [She/Her]> Yeah |
20:20:53 | FromDiscord | <Chronos [She/Her]> But here I mostly want to avoid runtime stuff because it can be done and would definitely work better for things like C interop (which is fairly important for me, if I make it so plugins can register events) |
20:22:46 | FromDiscord | <Chronos [She/Her]> Tho oof this would mean I couldn't do a queue for example |
20:23:01 | FromDiscord | <Chronos [She/Her]> Is it worth the trade-off... hm |
20:23:04 | FromDiscord | <Chronos [She/Her]> We'll see ig |
20:28:18 | * | Mister_Magister quit (Read error: Connection reset by peer) |
20:30:09 | * | Mister_Magister joined #nim |
20:48:11 | FromDiscord | <Chronos [She/Her]> Generics just compile down into multiple procs, right? |
20:50:13 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4HfA |
20:51:08 | FromDiscord | <Chronos [She/Her]> Beef you'd know right? You do a lot of macro fuckery |
20:58:29 | FromDiscord | <voidwalker> My knowledge is that it will compile only the instances that are called in the code, no ? |
21:00:25 | FromDiscord | <Chronos [She/Her]> Yeah, just wondering if I did use it in the code if that's how it'd work |
21:01:03 | FromDiscord | <voidwalker> pretty much, generics is just a way to not repeat code yourself.. the compiler does : ) |
21:02:29 | FromDiscord | <Chronos [She/Her]> Gucci |
21:02:56 | FromDiscord | <Chronos [She/Her]> But it makes me wonder if I could add them both a list (if they weren't generics) |
21:03:04 | FromDiscord | <Chronos [She/Her]> And then the type was a generic |
21:03:12 | FromDiscord | <Chronos [She/Her]> I can't explain words great, let me make an example |
21:03:45 | FromDiscord | <Chronos [She/Her]> Yeah okay nvm I can't even do that |
21:03:49 | FromDiscord | <Chronos [She/Her]> It's difficult to structure |
21:03:57 | FromDiscord | <Chronos [She/Her]> Maybe using methods would just be much better sigh... |
21:04:11 | FromDiscord | <Chronos [She/Her]> Are methods really bad for memory or are they mostly alright? |
21:04:36 | FromDiscord | <voidwalker> No idea. Haven't gotten to the methods chapter yet : ( Can't really tell where they're good |
21:05:17 | FromDiscord | <Chronos [She/Her]> Fair, they're supposed to be good for dynamic dispatch for one |
21:05:52 | FromDiscord | <voidwalker> `In computer science, dynamic dispatch is the process of selecting which implementation of a polymorphic operation (method or function) to call at run time.` |
21:06:00 | FromDiscord | <voidwalker> Oh, so it's used with inherited object types only ? |
21:06:55 | FromDiscord | <Chronos [She/Her]> :shrug; |
21:06:59 | FromDiscord | <Chronos [She/Her]> 🤷♀️ |
21:11:26 | FromDiscord | <Chronos [She/Her]> Okay so idk how to really handle events that use methods :p |
21:11:43 | FromDiscord | <Chronos [She/Her]> @griffith1deadly clueless on how I'd implement a Forge-like event handler honestly |
21:11:52 | FromDiscord | <Chronos [She/Her]> Sorry |
21:12:52 | FromDiscord | <Elegantbeef> When you call it yes↵(@Chronos [She/Her]) |
21:13:32 | FromDiscord | <Elegantbeef> Also there is no macro here 😛 |
21:16:23 | FromDiscord | <Elegantbeef> If you need dynamic dispatch they're pretty much the best you can do in Nim |
21:20:10 | FromDiscord | <Langosta> Quick question: is the [T: A] before the parameters a cast? |
21:21:32 | FromDiscord | <Elegantbeef> No |
21:21:41 | FromDiscord | <Elegantbeef> It's a generic constrained to a specific typeclass |
21:21:47 | FromDiscord | <Elegantbeef> In this case 'Any type that inherits from A' |
21:25:17 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "When you call it": Still AST related so- |
21:26:05 | FromDiscord | <Chronos [She/Her]> Basically rn I'm trying to figure out how I should structure an event system that calls methods that use an object with a specific parameter |
21:26:34 | FromDiscord | <Chronos [She/Her]> I might need a macro for it but that's not great for exposing it to C (which I need for WASM/other language interop) |
21:31:26 | * | xmachina quit (Quit: WeeChat 4.0.4) |
21:39:15 | * | sagax joined #nim |
21:57:40 | * | xmachina joined #nim |
22:00:52 | FromDiscord | <sOkam! 🫐> In reply to @chronos.vitaqua "Basically rn I'm trying": do you need the end-user of that object to create extended types with their own separate functions for processing that should not take your current code?↵if the answer is no, object variants are almost always cleaner to read/write (only slightly more involved because of the cases)↵the difference is you decide the behavior at compiletime with object variants, or at runtime w |
22:01:35 | FromDiscord | <Chronos [She/Her]> The answer is yes rip |
22:02:14 | FromDiscord | <Chronos [She/Her]> Idea is to make it so you inherit from a specific type, and can register event handlers for it, but that's a bit hard really |
22:05:38 | FromDiscord | <Chronos [She/Her]> @sOkam! 🫐 you have any ideas for how I'd implement it or nah? |
22:06:04 | FromDiscord | <Chronos [She/Her]> It might be possible with generics since they'll all inherit from one type |
22:06:15 | FromDiscord | <Chronos [She/Her]> But I'm just wondering how would I even dispatch the event |
22:08:55 | FromDiscord | <sOkam! 🫐> In reply to @chronos.vitaqua "Idea is to make": but what i mean is do they need to have their own fields stored in there mandatory... and have procedures that apply to the type itself (not the callback vtable)? |
22:09:45 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4Hg0 |
22:11:28 | FromDiscord | <sOkam! 🫐> In reply to @chronos.vitaqua "<@186489007247589376> you have any": i don't know if I understand the usecase enough to give ideas 😔 |
22:11:57 | FromDiscord | <Chronos [She/Her]> In reply to @heysokam "but what i mean": Yeah they need their own fields |
22:12:15 | FromDiscord | <Chronos [She/Her]> In reply to @heysokam "i don't know if": Okay so how this would ideally work (with a pseudocode example) is: |
22:14:17 | FromDiscord | <sOkam! 🫐> In reply to @chronos.vitaqua "Yeah they need their": that means the would also be able to override your entire library of predeclared methods↵thats basically the only thing you gain, other than `variable.events.field` vs `variable.field` |
22:15:14 | FromDiscord | <sOkam! 🫐> if you want the same as virtual methods, then yeah inheritance is the only way |
22:15:28 | FromDiscord | <Chronos [She/Her]> Those would be the types |
22:15:29 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4Hg1 |
22:15:38 | FromDiscord | <Elegantbeef> Well runtime interfaces are an alternative but that relies on implementing runtime interfaces 😄 |
22:15:39 | FromDiscord | <Chronos [She/Her]> Wait |
22:15:58 | FromDiscord | <Chronos [She/Her]> (edit) "https://play.nim-lang.org/#ix=4Hg1" => "https://play.nim-lang.org/#ix=4Hg2" |
22:16:06 | FromDiscord | <Chronos [She/Her]> (edit) "https://play.nim-lang.org/#ix=4Hg2" => "https://play.nim-lang.org/#ix=4Hg3" |
22:16:35 | FromDiscord | <Chronos [She/Her]> That's how I'd like the datatypes to look tbh |
22:16:59 | FromDiscord | <sOkam! 🫐> and what does the user do with them? |
22:17:08 | FromDiscord | <Chronos [She/Her]> I'm trying to figure out the syntax for that aha |
22:18:16 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4Hg4 |
22:18:27 | FromDiscord | <Chronos [She/Her]> That's how they'd be registered I think |
22:18:35 | FromDiscord | <sOkam! 🫐> so far all of that is doable with variants |
22:18:38 | FromDiscord | <Chronos [She/Her]> Not sure how I'd even structure an EventHandler type for this tho |
22:18:57 | FromDiscord | <sOkam! 🫐> if you need internally different types of player dead events, and different types of chat events |
22:18:58 | FromDiscord | <Chronos [She/Her]> In reply to @heysokam "so far all of": Yeah, that's my idea, it's just... very hard to output usable code for it :p |
22:19:21 | FromDiscord | <sOkam! 🫐> In reply to @chronos.vitaqua "Yeah, that's my idea,": then the problem is that you lack good understanding of the task |
22:19:23 | FromDiscord | <Chronos [She/Her]> ChatEvent and PlayerDeathEvent would be defined by the user themselves |
22:19:32 | FromDiscord | <sOkam! 🫐> hard to output code means the task is not well understood |
22:19:48 | FromDiscord | <sOkam! 🫐> otherwise it would just be easy but tedious (variants are indeed more tedious) |
22:19:55 | FromDiscord | <Chronos [She/Her]> I understand the idea of the task, just not how I'd implement it in Nim specifically |
22:20:17 | FromDiscord | <sOkam! 🫐> then you don't understand the task well enough to explain it to nim, thats what i mean 🙂 |
22:20:21 | FromDiscord | <Chronos [She/Her]> I could do it in Python (or Java) easily, but that's because they're obviously not statically typed |
22:20:25 | FromDiscord | <Chronos [She/Her]> Fair enough |
22:20:36 | FromDiscord | <Chronos [She/Her]> I'll revisit this when I wake up, maybe sleep will help |
22:20:42 | FromDiscord | <sOkam! 🫐> how would you do it in python? |
22:21:16 | FromDiscord | <Chronos [She/Her]> I'll write that up now |
22:21:39 | FromDiscord | <Chronos [She/Her]> With Python I wouldn't even need an `EventObj` is the thing oof |
22:23:16 | FromDiscord | <sOkam! 🫐> struggling to understand why you need the `theirobject.field` mandatory, compared to `theirobject.event.field` |
22:23:49 | FromDiscord | <sOkam! 🫐> they can just send you your object back, and figure out how to store it and what to do with it if they need? 🤔 |
22:24:10 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4Hg7 |
22:24:18 | FromDiscord | <sOkam! 🫐> instead of sending you their object directly, instead of sending you yours |
22:24:25 | FromDiscord | <Chronos [She/Her]> In reply to @heysokam "struggling to understand why": I'm not sure how that'd work at all |
22:24:32 | * | dtomato joined #nim |
22:24:37 | FromDiscord | <Chronos [She/Her]> Their event listeners need their own defined data |
22:25:28 | FromDiscord | <sOkam! 🫐> In reply to @chronos.vitaqua "Their event listeners need": how do -you- access their data? |
22:25:44 | FromDiscord | <sOkam! 🫐> if you are storing a vtable... you don't need their data, just their callbacks |
22:26:11 | FromDiscord | <Chronos [She/Her]> In reply to @heysokam "if you are storing": Yeah, but how would I add their events into a vtable? |
22:26:23 | FromDiscord | <Chronos [She/Her]> I don't know their events in my code, they may define custom events |
22:26:32 | FromDiscord | <sOkam! 🫐> with a predetermined object that holds procs of a specific type you determine |
22:26:48 | FromDiscord | <sOkam! 🫐> they send you that object, which holds their procs |
22:26:54 | FromDiscord | <sOkam! 🫐> you call the procs, they define the behavior |
22:27:34 | FromDiscord | <sOkam! 🫐> if you want the locust of control of the app to be fully on their side, then i don't think im understanding the target usecase |
22:28:20 | FromDiscord | <sOkam! 🫐> if you know GLFW, what im mentioning is the same idea |
22:28:52 | FromDiscord | <Chronos [She/Her]> I do not know GLFW actually :p |
22:29:14 | FromDiscord | <Chronos [She/Her]> In reply to @heysokam "you call the procs,": Not super getting it really, oof |
22:29:20 | FromDiscord | <Chronos [She/Her]> I think I'll attempt this when waking up tomorrow |
22:29:25 | FromDiscord | <sOkam! 🫐> kk |
22:37:13 | * | xmachina quit (Quit: WeeChat 4.0.4) |
22:39:02 | * | thomasross quit (Ping timeout: 258 seconds) |
23:43:33 | * | xmachina joined #nim |