00:17:33 | * | rockcavera quit (Read error: Connection reset by peer) |
00:17:55 | * | rockcavera joined #nim |
00:23:32 | FromDiscord | <albassort> does IpAddress support subnets? |
00:31:16 | FromDiscord | <albassort> no |
00:31:18 | FromDiscord | <albassort> it does not btw |
00:37:25 | FromDiscord | <bostonboston> What for |
00:41:06 | FromDiscord | <albassort> you need subnets for things |
00:41:07 | FromDiscord | <albassort> sometimes :3 |
00:46:19 | FromDiscord | <bostonboston> Yes, but, my understanding was thats the network layers job to worry about so I'm curious what I'm missing |
00:48:04 | FromDiscord | <albassort> In reply to @bostonboston "Yes, but, my understanding": Sometimes you need to do things involving your local intranet |
00:48:17 | FromDiscord | <albassort> (edit) "intranet" => "intranet/intranets" |
00:48:42 | FromDiscord | <albassort> your devices can talk to each other, and sometimes, you need to facilitate that, or prevent that |
00:48:47 | FromDiscord | <albassort> so you can block a mask |
00:48:58 | FromDiscord | <albassort> (edit) "so you can block a mask ... " added "or send a ping to a mask" |
00:49:07 | FromDiscord | <albassort> (edit) "mask" => "mask, etc" |
00:54:10 | FromDiscord | <bostonboston> I figured that would all be handled by the router and it's rules that both subnets are connected to |
02:11:43 | * | SchweinDeBurg quit (Quit: WeeChat 4.6.0-dev) |
02:15:04 | * | SchweinDeBurg joined #nim |
03:29:53 | FromDiscord | <Robyn [She/Her]> what is a subnet? |
03:30:19 | FromDiscord | <Robyn [She/Her]> I assume it's the /xx at the end of IPs sometimes but what does it mean? |
03:39:58 | FromDiscord | <bostonboston> An IP address actually contains two addresses, a network address and a host address, the network address describes what network the host address is on (the subnet), the subnet mask describes what part of the ip address is the network address vs host address |
03:58:55 | FromDiscord | <Elegantbeef> 2 address in 32 bytes?! 😛 |
04:02:33 | * | krux02 quit (Remote host closed the connection) |
04:09:39 | FromDiscord | <bostonboston> And nothing bad ever happened with ip, the end |
05:10:32 | * | rockcavera quit (Remote host closed the connection) |
06:56:44 | * | ntat joined #nim |
07:38:19 | FromDiscord | <emmanuel.giveaway> sent a long message, see https://pasty.ee/wfWGxfhm |
07:41:24 | Amun-Ra | Robyn: the second number denotes the number of bits that form a netmask, /24 - 24 bits of 1, and the rest are 0, so /24 is 255.255.255.0 |
07:44:06 | FromDiscord | <kreed1415> Question, I have a task in my config.nim to build and run the app. However, how would I copy a dynamic library into my build directory? I tried using copyToDirectory() but it says that proc can't be used from scripts |
07:45:04 | FromDiscord | <Elegantbeef> `cpFile` |
07:45:15 | FromDiscord | <Elegantbeef> You have to use `nimscript` procs (they're imported by default in Nimble |
07:45:22 | FromDiscord | <kreed1415> ah nice |
07:46:09 | FromDiscord | <kreed1415> it seems like vscode can't handlenimscript |
07:46:48 | FromDiscord | <Elegantbeef> `when defined(nimsuggest): import nimscript` |
07:50:04 | FromDiscord | <kreed1415> both worked like a charm |
07:50:23 | FromDiscord | <kreed1415> So good news. I have succeeded in creating a wrapper for SDL3 |
07:51:19 | FromDiscord | <kreed1415> i need to set up wrapping for the other files but you can nimble install SDL3 from here: https://github.com/NitroPlum/sdl3nim |
07:53:54 | FromDiscord | <drunkenalcoholic> noob question when did std/os module start adding prefixed forward slash for getHomeDir() is that something newly added? |
08:00:07 | * | beholders_eye joined #nim |
08:04:01 | * | nils` quit (Ping timeout: 248 seconds) |
08:19:56 | strogon14 | Seems like a bug to me. |
08:21:10 | strogon14 | Esp. Since it also does it when the home dir is just "/", returning "//". |
08:30:35 | FromDiscord | <spotlightkid> @kreed1415\: nice! so this is the wrapper generated by futhark?↵There is a way to have both the generated wrapper and also a module, which generates the wrapper at compile time using the `outputPath` option for `importc:`.↵Here's an example\: https://github.com/SpotlightKid/nim-libsoundio/blob/master/src/soundio.nim |
09:08:05 | * | nils` joined #nim |
09:53:03 | * | beholders_eye quit (Quit: WeeChat 4.1.2) |
10:23:06 | FromDiscord | <Robyn [She/Her]> In reply to @Amun-Ra "Robyn: the second number": ah okay, thank you |
10:55:16 | * | beholders_eye joined #nim |
11:08:32 | FromDiscord | <pmunch> Hmm, has anyone tried to rename the object files Nim creates? |
11:08:49 | FromDiscord | <pmunch> Talking about the ones in `.cache` with the @ symbols in them |
11:09:17 | FromDiscord | <pmunch> I have to move some object files around with a linker script, but the linker script doesn't like those filenames |
11:36:38 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#pasty=ZZrXpGcu |
11:40:02 | FromDiscord | <Robyn [She/Her]> In reply to @ambient3332 "Why am I getting": can you share the exact error message? |
11:40:13 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#pasty=AIDHpzsD |
11:41:08 | FromDiscord | <Robyn [She/Her]> are you sure bitxor can be used as an op? try using it as a normal function |
11:41:40 | FromDiscord | <ambient3332> ok that works but I dont understand why |
11:41:54 | FromDiscord | <ambient3332> shouldn't Nim have a.foo b, a foo b and foo(a, b) as equivalent? |
11:42:59 | FromDiscord | <ambient3332> it's a macro, I guess shrug |
11:43:14 | FromDiscord | <ambient3332> which means I get footgunned |
11:43:53 | FromDiscord | <solitudesf> In reply to @ambient3332 "shouldn't Nim have a.foo": not `a foo b`. |
11:44:31 | FromDiscord | <Robyn [She/Her]> You can't define arbitrary infix ops in Nim |
11:45:31 | FromDiscord | <ambient3332> gotcha |
11:46:13 | FromDiscord | <ambient3332> a.foo b works, not a foo b |
11:46:21 | FromDiscord | <solitudesf> In reply to @ambient3332 "shouldn't Nim have a.foo": https://nim-lang.org/docs/manual.html#lexical-analysis-operators |
11:50:17 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#pasty=HEaYIghC |
11:50:37 | FromDiscord | <ambient3332> UIknow value doesn't get initialized as 0.9 |
11:51:15 | FromDiscord | <ambient3332> The idea would be to run mouseClick on UIelement and the message being autorouted to the relevant data structure depending on component type |
11:52:26 | FromDiscord | <ambient3332> I don't need either hierarchy or overlap tests, just rectangular reqions that get fed messages and react accordingly |
11:52:57 | FromDiscord | <System64 ~ Flandre Scarlet> Is there more recent Lua libraries for Nim please? |
11:57:44 | FromDiscord | <solitudesf> newest one is for luajit specifically https://github.com/glassesneo/spellua |
12:00:25 | * | valms19901 joined #nim |
12:04:09 | FromDiscord | <pmunch> ambient, just get rid of the var casting and you're good: https://play.nim-lang.org/#pasty=RGdaqOJh |
12:04:34 | FromDiscord | <pmunch> They are already reference objects, so var doesn't do what you think it does |
12:05:12 | FromDiscord | <pmunch> Not 100% why exactly casting to `var` doesn't work, but it messes up something |
12:05:54 | FromDiscord | <albassort> https://media.discordapp.net/attachments/371759389889003532/1318912118636154950/btcapi.nim?ex=67640c21&is=6762baa1&hm=e6e71518bc9352270aa9ed70d27b2d049b60ff68ffe4ca0ebbd159ac7ab6d634& |
12:06:02 | FromDiscord | <albassort> i spent all day making a 1000 line btc wrapper |
12:06:42 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#pasty=MiKCcPWC |
12:06:59 | FromDiscord | <ambient3332> How do you add the expand to code paste? |
12:08:56 | FromDiscord | <ambient3332> Also I didn't even know the difference between method and proc 😮💨 |
12:11:15 | FromDiscord | <pmunch> @albassort, why didn't you just spend ten minutes doing it in Futhark? 🤔 |
12:11:32 | FromDiscord | <ambient3332> What's the current situation of Futhark + Windows? |
12:12:17 | FromDiscord | <pmunch> Windows? Who's that? |
12:12:31 | FromDiscord | <ambient3332> A think you have to use for job |
12:12:42 | FromDiscord | <pmunch> Ah yes, proc has to know statically at compile-time, method is dynamic dispatch |
12:12:43 | FromDiscord | <ambient3332> (edit) "think" => "thing" |
12:13:12 | FromDiscord | <pmunch> @ambient3332, pfft, I recommend my devs to use Linux |
12:13:33 | FromDiscord | <pmunch> I don't actually remember what the issue on Windows was, might've been fixed? |
12:16:19 | FromDiscord | <albassort> In reply to @pmunch "<@217459674700578816>, why didn't you": Not sure if there is a C api wrapper |
12:16:29 | FromDiscord | <albassort> (edit) "In reply to @pmunch "<@217459674700578816>, why didn't you": Not sure if there is a C api wrapper ... " added "for it" |
12:16:45 | FromDiscord | <albassort> regardless, it was good because i had to learn each function |
12:16:58 | FromDiscord | <albassort> and also mines probably more up to date to the API |
12:16:58 | FromDiscord | <pmunch> Ah, that makes it harder to use Futhark |
12:17:20 | FromDiscord | <albassort> i mean the implementation is in CPP, so maybe |
12:17:28 | FromDiscord | <albassort> its RPC, if you read the code |
12:37:19 | FromDiscord | <luteva> sent a long message, see https://pasty.ee/BZVHJSXt |
13:09:41 | FromDiscord | <k0ts> have you tried importing `db_connector/db_common` |
14:21:10 | FromDiscord | <kreed1415> In reply to @spotlightkid "<@67270681271734272>\: nice! so this": Ah nice. I was just generating it in a repo then another repo is the module. That way you don’t have to pull the SDL source into your project. It’s also a little weird since SDL3 isn’t officially released. It’s just a tag to a preview build that is close to done. This way I can keep the wrapper updated without people having to mess with the submodule |
14:21:35 | FromDiscord | <kreed1415> In reply to @ambient3332 "What's the current situation": I got it working |
14:21:42 | FromDiscord | <kreed1415> On windows |
14:29:01 | FromDiscord | <xtrayambak> god, I love Nim's C++ interop |
14:30:34 | FromDiscord | <xtrayambak> I just binded (bound?) some of the Louvre library and now I have a Wayland compositor working in Nim :^) |
14:45:33 | FromDiscord | <rakgew> @xtrayambak \: very nice! are you building something like nimdows (nim-x-twm) but for wayland by any chance? |
14:46:26 | FromDiscord | <xtrayambak> In reply to @rakgew "<@498088092406644736> \: very nice!": Nope, I'm planning to build something more akin to [Hyprland](https://github.com/hyprwm/hyprland) |
14:46:42 | FromDiscord | <xtrayambak> Louvre is a very nice library because it removes 99% of the complexity that comes with writing a Wayland compositor |
14:48:43 | FromDiscord | <xtrayambak> here's what it currently looks like https://media.discordapp.net/attachments/371759389889003532/1318953094629031947/i8O0Rg1.png?ex=6764324a&is=6762e0ca&hm=dbe20e84c7dcc8f3dd9340e6e429ccf804efd732b435830794d82844fd3a1531& |
14:49:07 | FromDiscord | <xtrayambak> sent a code paste, see https://play.nim-lang.org/#pasty=ayuQsYKl |
15:18:47 | * | beholders_eye quit (Ping timeout: 265 seconds) |
15:39:15 | FromDiscord | <treeform> In reply to @xtrayambak "Louvre is a very": But writing wayland compositor is not that hard? See: https://github.com/treeform/windy/tree/master/src/windy/platforms/linux |
15:39:36 | FromDiscord | <xtrayambak> In reply to @treeform "But writing wayland compositor": I think you're mistaking a Wayland client for a Wayland compositor |
15:39:43 | FromDiscord | <treeform> Yes I am, sorry. |
15:39:52 | FromDiscord | <xtrayambak> A Wayland compositor is equivalent to an X11 window manager |
15:40:02 | FromDiscord | <xtrayambak> (edit) "manager" => "manager, except it's much more lower level" |
15:40:05 | FromDiscord | <xtrayambak> In reply to @treeform "Yes I am, sorry.": No worries |
15:40:28 | FromDiscord | <xtrayambak> To be fair I got excited for a minute, thinking you started a grassroots project like Smithay but for Nim xD |
15:40:35 | FromDiscord | <xtrayambak> given you, it wouldn't be too far fetched |
15:41:16 | FromDiscord | <xtrayambak> Maybe we can get a modern Linux desktop environment written in Nim, like Nim's own cosmic one day :^) |
15:41:40 | FromDiscord | <xtrayambak> It'd be nice if fidget worked under Wayland natively, that DE wouldn't be too far fetched then |
15:41:45 | FromDiscord | <treeform> Why stop there, a 100% Nim OS. |
15:42:10 | FromDiscord | <xtrayambak> In reply to @treeform "Why stop there, a": Haha, [khaledh's fusion kernel](https://github.com/khaledh/fusion) comes to mind |
15:43:17 | FromDiscord | <treeform> My first open source project was an OS (2004): https://github.com/treeform/Atomic4 |
15:43:33 | FromDiscord | <treeform> I think I have learned a thing or two in 20 years 🙂 |
15:43:33 | FromDiscord | <xtrayambak> Ooh, in pure ASM too |
15:43:53 | FromDiscord | <xtrayambak> My first one was when I was 9 or something, but it can't really be called a project |
15:43:58 | FromDiscord | <xtrayambak> it was just a bunch of BASIC code samples |
15:44:08 | FromDiscord | <xtrayambak> I think I deleted the GitHub repository |
15:44:24 | FromDiscord | <treeform> I was too poor to have a computer at 9 😦 |
15:44:32 | FromDiscord | <xtrayambak> In reply to @treeform "I was too poor": Aw, that's sad |
15:44:50 | FromDiscord | <xtrayambak> I was using my mom's laptop to write BASIC back then, I learnt Nim on that thing as well |
15:45:20 | FromDiscord | <treeform> Thats pretty cool. |
15:45:46 | FromDiscord | <treeform> I did not know programming existed at 9. |
15:46:09 | FromDiscord | <xtrayambak> I saw my uncle, who's a senior SWE at HP and thought it was pretty cool |
15:46:16 | FromDiscord | <xtrayambak> He works on maintaining HP-UX from what I've seen |
15:46:24 | FromDiscord | <treeform> yeah that would do it |
15:46:50 | FromDiscord | <xtrayambak> I think I'll commit an atrocity and bridge my JavaScript engine and the Louvre bindings so that you can create Wayland compositors in a very limited dialect of JavaScript 😅 |
15:47:02 | FromDiscord | <xtrayambak> Nah, I think that'd actually be too evil |
15:51:06 | FromDiscord | <xtrayambak> I love having to decipher stuff like this https://media.discordapp.net/attachments/371759389889003532/1318968794378670090/SojOu9H.png?ex=676440e9&is=6762ef69&hm=d8e9bddf7b492ef651407a5a0de13b064d9aace68bd4599df76e1e9bf4b9ee0c& |
15:52:16 | FromDiscord | <xtrayambak> Ah, I mismatched the `header` and `importcpp` pragmas |
15:54:03 | * | beholders_eye joined #nim |
16:40:28 | * | nils` quit (Ping timeout: 265 seconds) |
17:05:24 | FromDiscord | <saint._._.> What are Louvre bindings? |
17:07:45 | FromDiscord | <luteva> In reply to @k0ts "have you tried importing": yes i tried that as well. same problem |
17:13:13 | * | krux02 joined #nim |
17:35:11 | FromDiscord | <rongcuid> Is it possible to use C procedures without declaring them manually? Like somehow including a C header or something |
17:36:13 | FromDiscord | <demotomohiro> In reply to @rongcuid "Is it possible to": Use futhark or c2nim to generate binding automatically. |
17:36:51 | FromDiscord | <demotomohiro> https://github.com/PMunch/futhark |
17:38:41 | FromDiscord | <anuke> How is state generally handled with async/multithreaded programs?↵↵I have a telegram bot using the telebot library; it requires a .gcsafe. proc to [handle incoming messages](<https://github.com/ba0f3/telebot.nim/blob/master/examples/echo_bot.nim#L30>) - I can't access any global state in this proc, or use any data (e.g. images) I preloaded before registering the handler. Is there a workaround to this that doesn't involve .gcsafe. casts? |
17:40:21 | FromDiscord | <anuke> I did try `{.cast(gcsafe).}:` as a temporary workaround, but that caused hard crashes whenever a recoverable exception was raised in a try/catch (could be unrelated?). |
17:41:31 | FromDiscord | <rongcuid> In reply to @demotomohiro "Use futhark or c2nim": Ok, thanks |
18:04:27 | * | strogon14 quit (Quit: Auf Wiese geh'n!) |
18:05:26 | FromDiscord | <kreed1415> Is there a good place to submit issues with vscode? it's getting pretty bad |
18:06:05 | * | strogon14 joined #nim |
18:06:53 | FromDiscord | <nasuray> In reply to @luteva "yes i tried that": you likely need to fork ormin and update that code to use the `db_connector` and change the import to `db_connector/db_common` , since `db_common` is no longer in the standard library |
18:13:02 | FromDiscord | <anuke> In reply to @kreed1415 "Is there a good": I don't think there's a better place than the vscode-nim repository. I saw your issue report there, but sadly it doesn't seem like any of the VSC extensions are being very actively developed/maintained. |
18:14:05 | FromDiscord | <bostonboston> https://github.com/nim-lang/vscode-nim↵↵Is actively being developed, be sure that this is the extension you installed |
18:14:15 | FromDiscord | <rakgew> cool! looking forward.↵do you plan on posting it on the project show case in the nim forum?↵(@xtrayambak) |
18:16:16 | FromDiscord | <kreed1415> In reply to @bostonboston "https://github.com/nim-lang/vscode-nim Is actively": conI think so, im using the official one |
18:16:19 | FromDiscord | <kreed1415> https://media.discordapp.net/attachments/371759389889003532/1319005335964352662/image.png?ex=676462f2&is=67631172&hm=651b786a6830cd71493c62652535f0773e12930a9e5d037fa93b57c964763930& |
18:16:23 | FromDiscord | <kreed1415> (edit) "conI" => "I" |
18:16:39 | FromDiscord | <kreed1415> but it almost always starts to hang after ever save |
18:16:45 | FromDiscord | <kreed1415> (edit) "ever" => "every" |
18:16:55 | FromDiscord | <anuke> In reply to @bostonboston "https://github.com/nim-lang/vscode-nim Is actively": Yes, that is the repository I was referring to. The last commit was 2 months ago, and there are some [obvious long-standing issues](<https://github.com/nim-lang/vscode-nim/issues/74>) with no developer response. |
18:17:37 | FromDiscord | <kreed1415> it's essentially unusable for me |
18:18:17 | FromDiscord | <bostonboston> 2 months is not a long time (its also the holidays). The lead developers of the extension from what I understand are employees of Status, and likely have other things to deal with as well |
18:20:27 | FromDiscord | <anuke> Right, I'm not blaming anyone in particular, but in my experience the plugin has enough serious long-standing issues to make it pretty much unusable outside of basic syntax highlighting |
18:20:45 | FromDiscord | <kreed1415> syntax hilighting doesn't even work anymore |
18:20:58 | FromDiscord | <kreed1415> I have to close and reopen vscode every 2 minutes for it to work |
18:21:23 | FromDiscord | <smartdev0809> sent a long message, see https://pasty.ee/CScALfWs |
18:22:08 | FromDiscord | <kreed1415> am I crazy or is this definitely not correct: |
18:22:12 | FromDiscord | <kreed1415> https://media.discordapp.net/attachments/371759389889003532/1319006816398475314/image.png?ex=67646452&is=676312d2&hm=4bb5d04afc947d163f4d92817765dbb976fc6d0e064eb0d2b850162efa3afbad& |
18:22:27 | FromDiscord | <kreed1415> it just keeps doing this over and over and hanging |
18:22:44 | FromDiscord | <k0ts> Has https://github.com/nim-lang/choosenim/issues/13 been mentioned yet |
18:22:57 | FromDiscord | <k0ts> <@&371760044473319454> spam above |
18:23:07 | FromDiscord | <kreed1415> In reply to @k0ts "Has https://github.com/nim-lang/choosenim/issues/13": oh this is interesting |
18:23:17 | * | Goodbye_Vincent1 quit (Quit: ) |
18:23:30 | FromDiscord | <kreed1415> the problem is caused by choosenim |
18:24:10 | FromDiscord | <kreed1415> so i need to abandon choosenim? |
18:24:23 | FromDiscord | <k0ts> Try without choosenim and see if it solves the problem |
18:24:28 | FromDiscord | <bostonboston> I'm unfamiliar with the problems, the only thing I can report is the I use choosenim, and the extension on windows without much issue |
18:24:50 | FromDiscord | <bostonboston> Other than I have to restart vs code for newly installed nimble packages to be found |
18:28:34 | * | beholders_eye quit (Ping timeout: 248 seconds) |
18:30:40 | FromDiscord | <kreed1415> In reply to @k0ts "Try without choosenim and": any idea how to remove choosenim? |
18:40:14 | FromDiscord | <kreed1415> nvm yeah I think that fixed it for me |
18:51:02 | * | beholders_eye joined #nim |
18:53:12 | * | nils` joined #nim |
19:07:41 | FromDiscord | <kreed1415> IO lied |
19:07:43 | FromDiscord | <kreed1415> (edit) "IO" => "I" |
19:07:45 | FromDiscord | <kreed1415> it's still broken |
19:08:14 | * | beholders_eye quit (Ping timeout: 244 seconds) |
19:09:00 | * | disso-peach joined #nim |
19:16:42 | * | Goodbye_Vincent1 joined #nim |
19:19:49 | * | nils` quit (Ping timeout: 248 seconds) |
19:51:32 | FromDiscord | <ambient3332> I see it was actually a bug that nimsuggest.exe was left hanging in the background. How hard would it be to modify choosenim to also close the child process? |
20:01:37 | FromDiscord | <Elegantbeef> Think there is a PR to choosenim that resolves it for linux |
20:01:45 | FromDiscord | <Elegantbeef> Work is still required for windows if I recall correctly |
20:45:52 | FromDiscord | <wug.s> sent a code paste, see https://paste.rs/aQKk0 |
20:45:55 | FromDiscord | <wug.s> for some reason this doesn't work |
20:46:05 | FromDiscord | <luteva> In reply to @nasuray "you likely need to": Thx! I'll try that! |
20:46:26 | FromDiscord | <wug.s> sent a code paste, see https://play.nim-lang.org/#pasty=AyHSvyHr |
20:46:32 | FromDiscord | <wug.s> (edit) "https://paste.rs/O4cHg" => "https://play.nim-lang.org/#pasty=WWCAkart" |
20:46:51 | FromDiscord | <wug.s> actually in general, using tuples for types like that doesn't work, which is strange |
20:46:57 | FromDiscord | <wug.s> unless im forgetting something? |
20:47:02 | FromDiscord | <Elegantbeef> Well yea |
20:47:11 | FromDiscord | <Elegantbeef> It's `(Vector[int], Vector[int])` if you want anonymous |
20:47:25 | FromDiscord | <Elegantbeef> If you want named fields you use `tuple[a: T, b: Y]` |
20:51:22 | FromDiscord | <wug.s> ahhh ok that makes sense |
20:51:58 | FromDiscord | <wug.s> thanks |
20:52:02 | FromDiscord | <wug.s> (edit) "thanks" => "thanks, it worked" |
20:52:22 | FromDiscord | <wug.s> sent a code paste, see https://play.nim-lang.org/#pasty=IycxUShn |
20:52:27 | * | xet7 quit (Remote host closed the connection) |
20:52:32 | FromDiscord | <wug.s> (edit) "sent a code paste, see https://play.nim-lang.org/#pasty=iyDNQVJk" => "so you only use `tuple[stuff]` if you want named?" |
20:53:04 | FromDiscord | <ambient3332> Personally, I find hard to think of any good use cases for anonymous tuples 🤷♂️ |
20:53:46 | * | xet7 joined #nim |
20:54:00 | FromDiscord | <Elegantbeef> Personally I find very little merit in named tuples |
20:54:17 | * | beholders_eye joined #nim |
20:54:33 | FromDiscord | <ambient3332> if you want array, you use array, if you want tuple, each element has some meaning and you lose information if you don't name them |
20:54:48 | FromDiscord | <Elegantbeef> Right but if I want to name them I want distinct typing |
20:54:57 | FromDiscord | <Elegantbeef> So why would I name a tuple then lose distinct typing |
20:55:04 | FromDiscord | <ambient3332> So you would use something like object? |
20:55:10 | FromDiscord | <Elegantbeef> Correct |
20:55:20 | FromDiscord | <Elegantbeef> I only use tuples for variadic generics or unpacking |
20:55:42 | FromDiscord | <ambient3332> I guess I use them as inline objects, which may not be super smart |
20:55:50 | FromDiscord | <Elegantbeef> So I might use named tuples to document return parameters but I never have a tuple on the left side of anything |
20:56:12 | FromDiscord | <Elegantbeef> If it's the left side of an expression it's an object cause I want distinct typing |
20:58:12 | FromDiscord | <ambient3332> Even as function return values named tuples are kinf of an ad hoc type definition |
20:58:34 | FromDiscord | <Elegantbeef> They are but I only use it for unpacking |
20:58:51 | FromDiscord | <wug.s> In reply to @ambient3332 "if you want array,": i mean its mostly just good to know and unnamed is faster to write |
20:59:05 | FromDiscord | <wug.s> im doing advent of code so it doesn't matter much |
20:59:13 | FromDiscord | <wug.s> its small-scale code and its easy to write |
21:00:02 | FromDiscord | <wug.s> In reply to @ambient3332 "I guess I use": as long as you don't need mutability, whats the difference? |
21:00:03 | FromDiscord | <ambient3332> Especially for complex AoC I would prefer named tuples, because keeping what all the indexing in my head means is just needless cognitive overhead |
21:00:25 | FromDiscord | <wug.s> day 16 is not that complicated 🤷♂️ |
21:00:29 | FromDiscord | <wug.s> im slightly behind |
21:01:35 | FromDiscord | <Elegantbeef> Ambient that sounds like "use an object" to me |
21:01:49 | FromDiscord | <ambient3332> maybe I'm allergic to objects |
21:02:43 | FromDiscord | <Elegantbeef> Well if you don't mind structurally typing keep on using tuples, but it's weak typed nightmare if you ask me |
21:02:47 | FromDiscord | <ambient3332> Never know if I should put all the global type definitions at the top of the file or sprinkle them in between procs |
21:02:55 | FromDiscord | <Elegantbeef> Just cause two objects have the same field names and types does not mean they're interopable |
21:03:27 | FromDiscord | <kreed1415> so in getting emscripten to work I was told to add this to my config. It works but im curious what this block is called and what's happening? |
21:03:29 | FromDiscord | <kreed1415> https://media.discordapp.net/attachments/371759389889003532/1319047407542997064/image.png?ex=67648a20&is=676338a0&hm=46c3894cb6b8f5fe89bb4fbf6ff4168cb7ccca18f0d1de4d4e0c4c83189fda4d& |
21:04:00 | FromDiscord | <Elegantbeef> `when defined` not `if` |
21:04:12 | FromDiscord | <Elegantbeef> It's just a when statement |
21:04:15 | FromDiscord | <kreed1415> but is this a macro or something? |
21:04:17 | FromDiscord | <Elegantbeef> THere is nothing special in the config |
21:04:31 | FromDiscord | <Elegantbeef> the `--` is a template yes |
21:04:33 | FromDiscord | <ambient3332> Do tuples and objects have the same performance characteristics in Nim? |
21:04:38 | FromDiscord | <kreed1415> ok that's the issue then |
21:04:48 | FromDiscord | <Elegantbeef> Of course they do |
21:05:06 | FromDiscord | <Elegantbeef> The difference between an object and a tuple is that an object is typed by name, whereas a tuple is typed by shape |
21:05:18 | FromDiscord | <Elegantbeef> An object is more like a `distinct tuple` |
21:05:25 | FromDiscord | <Elegantbeef> It's not the same but it's close |
21:05:28 | FromDiscord | <kreed1415> sent a code paste, see https://play.nim-lang.org/#pasty=wGmoZCEO |
21:05:41 | FromDiscord | <Elegantbeef> You just showed it |
21:05:47 | FromDiscord | <kreed1415> it doesn't seem to work |
21:05:50 | FromDiscord | <Elegantbeef> \`--passL\:"Bleh" |
21:06:02 | FromDiscord | <Elegantbeef> It's a template so it has to be valid Nim still |
21:06:03 | FromDiscord | <kreed1415> if I pass a string literal that's fine |
21:06:18 | FromDiscord | <kreed1415> but if I pass a variable that is a string it doesn't work |
21:06:33 | FromDiscord | <Elegantbeef> If you're using a dynamically computed value it has to be `switch("passL", ...)` |
21:06:41 | FromDiscord | <Elegantbeef> Cause the `--` is untyped and just poops out what you give it |
21:07:07 | FromDiscord | <kreed1415> yeah I assumed it was something like that I just didn't know the solution |
21:07:10 | FromDiscord | <kreed1415> so it's switch? |
21:07:41 | FromDiscord | <Elegantbeef> the `--` is just a template over `switch` which does `switch(firstParameter, astToStr(secondParameter))` |
21:09:10 | FromDiscord | <kreed1415> In reply to @Elegantbeef "the `--` is just": incredibly helpful |
21:09:49 | FromDiscord | <helwastaken> Anyone know how to fix the issue in #tooling |
21:10:02 | FromDiscord | <helwastaken> With nimlangserver not working fully |
21:10:08 | FromDiscord | <Elegantbeef> But alas it's just the latter half |
21:10:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=bMnnIJhl |
21:10:22 | FromDiscord | <Elegantbeef> Did you use choosenim to install it? |
21:12:28 | FromDiscord | <helwastaken> In reply to @Elegantbeef "Did you use choosenim": Nope just downloaded and added to path |
21:13:47 | FromDiscord | <Elegantbeef> Well that removes the #1 issue that people run into |
21:13:48 | FromDiscord | <Elegantbeef> My job here is done |
21:13:57 | FromDiscord | <Elegantbeef> Do you have a .nimble file? |
21:14:16 | FromDiscord | <helwastaken> I did try with choosenim as well tho |
21:14:22 | FromDiscord | <helwastaken> Month or two ago |
21:14:32 | FromDiscord | <helwastaken> This is a long lasting issue i had |
21:19:45 | * | beholders_eye quit (Ping timeout: 248 seconds) |
21:20:19 | * | ntat quit (Quit: Leaving) |
21:25:27 | * | beholders_eye joined #nim |
21:31:45 | FromDiscord | <spotlightkid> The PR actually now contains the fix for Windows as well. But there are no tests, thatswhy it is still a draft PR. But I use the change form the PR in my choosenim package for Arch Linux since a couple of weeks now without problems. |
21:31:55 | * | beholders_eye quit (Ping timeout: 265 seconds) |
22:08:40 | FromDiscord | <kreed1415> So, how would I write a nimscript that runs nimhttpd? |
22:08:52 | FromDiscord | <kreed1415> I've tried doing it and you can't simply exec that command |
22:08:56 | FromDiscord | <Elegantbeef> `exec` |
22:09:34 | FromDiscord | <kreed1415> you get an OSerror |
22:09:42 | FromDiscord | <kreed1415> unless you run gorgeEx |
22:09:54 | FromDiscord | <kreed1415> but then it just runs and immediately shuts down |
22:11:49 | FromDiscord | <Elegantbeef> Which says? |
22:15:42 | FromDiscord | <kreed1415> In reply to @Elegantbeef "Which says?": it doesn't say anything |
22:15:55 | FromDiscord | <Elegantbeef> So you have an OsError with no message? |
22:16:06 | FromDiscord | <kreed1415> oh you mean the os error? |
22:16:47 | FromDiscord | <Elegantbeef> Yes the OSError will provide diagnostic information |
22:17:46 | FromDiscord | <kreed1415> it says it cant find the file specified but i literally gave it a full url |
22:18:13 | FromDiscord | <Elegantbeef> Full path to the `nimhttpd` binary? |
22:18:24 | FromDiscord | <kreed1415> oh it can't find that |
22:18:35 | FromDiscord | <kreed1415> i assumed it was the file I wanted to serve |
22:25:18 | FromDiscord | <kreed1415> ah ok that's weird that it can't find it despite being in my path |
22:25:27 | FromDiscord | <kreed1415> so i gotta figure out how to get the nimble path in there |
22:34:08 | FromDiscord | <.throwstar> Someone please tell me what im doing wrong↵https://play.nim-lang.org/#pasty=QhvjEkTj |
22:37:50 | * | beholders_eye joined #nim |
22:37:55 | FromDiscord | <Elegantbeef> `0..<sample_count` |
22:37:56 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#pasty=hVsAsbap |
22:38:26 | FromDiscord | <Elegantbeef> Same values now |
22:38:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=aAkwcXsh |
22:39:00 | FromDiscord | <.throwstar> Theres no way |
22:39:07 | FromDiscord | <.throwstar> Ive been stuck on this for days |
22:39:15 | FromDiscord | <Elegantbeef> `a..b` is inclusive 😄 |
22:39:41 | FromDiscord | <Elegantbeef> I take it you didn't think it was odd the Nim side had 8 values? |
22:40:10 | FromDiscord | <.throwstar> I quickly made that example to share I wasnt paying full attention |
22:42:49 | FromDiscord | <Elegantbeef> Ambient Nimsuggest doesn't like methods |
22:43:08 | FromDiscord | <.throwstar> Nim should add c for loops so I can fight my own incompetence rather than the language |
22:43:25 | FromDiscord | <Elegantbeef> Nah C for loops suck |
22:44:12 | FromDiscord | <ambient3332> You can do all kinds of crazy stuff with templates and macros. Customizing for loops to your liking shouldn't be that complex |
22:44:26 | FromDiscord | <Elegantbeef> It's not really possible to do that |
22:44:34 | FromDiscord | <Elegantbeef> `for x in y` is hard coded in Nim |
22:46:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=HwaCxXfx |
22:46:46 | FromDiscord | <Elegantbeef> Ah sorry that'd need to be `(var x = 0)` |
22:48:41 | FromDiscord | <Elegantbeef> I have no idea how that's better than `for x in 0..<10` but who am I to judge |
22:51:32 | FromDiscord | <.throwstar> In reply to @Elegantbeef "I have no idea": I typically refer to c code when Im looking for algorithms just cause theres not a whole lot of nim examples |
22:51:47 | FromDiscord | <.throwstar> + Im more used to the c for loop style, its easier for me to read |
23:10:24 | * | coldfeet joined #nim |
23:31:14 | FromDiscord | <ambient3332> Every child class method has to also exist in the parent class "virtual" methods? |
23:33:13 | FromDiscord | <Elegantbeef> What does that even mean |
23:34:59 | FromDiscord | <ambient3332> I try and make some example code |
23:35:02 | FromDiscord | <ambient3332> brb |
23:38:33 | * | beholders_eye quit (Ping timeout: 265 seconds) |
23:43:36 | * | beholders_eye joined #nim |
23:46:10 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#pasty=hiLfYeQY |
23:46:49 | FromDiscord | <Elegantbeef> Well yea that's what `{.base.}` is for |
23:49:15 | FromDiscord | <Elegantbeef> If `setBreed` is supposed to exist for all `Animal`s it needs to be there |
23:49:26 | FromDiscord | <ambient3332> Only for some animals |
23:49:38 | FromDiscord | <ambient3332> That have relevant data fields |
23:49:52 | FromDiscord | <Elegantbeef> So then implement it for the root type that needs it |
23:50:41 | FromDiscord | <Elegantbeef> Either use `doAssert false` or raise an exception if the base method is called |
23:50:56 | FromDiscord | <Elegantbeef> If you need all children of `Animal` to have `setBreed` |
23:51:11 | FromDiscord | <Elegantbeef> otherwise you need to implement a `BreedAnimal` |
23:51:25 | FromDiscord | <ambient3332> The issue is that I need some fields and some functions to exist only in certain children. Other children to have other fields and functions |
23:51:45 | FromDiscord | <Elegantbeef> I mean you're using inheritance so make the tree up |
23:51:54 | FromDiscord | <ambient3332> Although I have no ides what the backend for seq[Animal] would look like then |
23:54:13 | FromDiscord | <Elegantbeef> "backend"? |
23:54:14 | FromDiscord | <Elegantbeef> Do question if you can use an object variant instead |
23:54:20 | FromDiscord | <Elegantbeef> Inheritance trees and methods are easy to use but chaotic to live |
23:54:43 | FromDiscord | <ambient3332> I shall look into it |