00:02:58 | * | jmd_ joined #nim |
00:11:41 | * | lumo_e quit (Ping timeout: 260 seconds) |
00:12:03 | * | xet7 quit (Remote host closed the connection) |
00:12:50 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4C68 |
00:13:44 | FromDiscord | <Chronos [She/Her]> Idk how else to handle it though so |
00:14:12 | FromDiscord | <m4ul3r> What is the size is owo.exe? |
00:15:20 | FromDiscord | <Elegantbeef> Too big |
00:15:40 | FromDiscord | <Elegantbeef> That's a joke due to the binary name, not an actual answer |
00:16:05 | FromDiscord | <etra> In reply to @Elegantbeef "<@329819426000076801>\: isolated data is": can ref objects be isolated? |
00:16:43 | FromDiscord | <Elegantbeef> Of course |
00:17:23 | * | lumo_e joined #nim |
00:17:32 | FromDiscord | <etra> ugh, trying to use taskpools has been harder than I'd like, I have Severe Skill Issues |
00:17:39 | FromDiscord | <etra> but cannot provide examples, sadly |
00:18:45 | FromDiscord | <m4ul3r> sent a code paste, see https://play.nim-lang.org/#ix=4C6a |
00:19:23 | FromDiscord | <Elegantbeef> https://forum.nim-lang.org/t/10161#67280 etra |
00:24:18 | FromDiscord | <etra> ah... it seems `HTTPClient` may not be isolable |
00:46:41 | * | lumo_e quit (Ping timeout: 260 seconds) |
00:59:17 | * | xet7 joined #nim |
01:28:24 | FromDiscord | <jan_darkk> does nim have automatic getter and setter makers? |
01:28:48 | FromDiscord | <jan_darkk> for example Crystal has `getter(:var1, :var2, :var3)` and `setter(:var1, :var2, :var3)` |
01:28:54 | FromDiscord | <jan_darkk> (edit) "makers?" => "function creators?" |
01:29:21 | FromDiscord | <huantian> what does that do? |
01:30:54 | FromDiscord | <Elegantbeef> Probably creates properties for a field |
01:30:54 | FromDiscord | <Elegantbeef> Akin to odin's using |
01:47:23 | NimEventer | New Nimble package! bcs - nim implementation of bcs serialization format, see https://github.com/C-NERD/nimBcs |
02:14:50 | FromDiscord | <djazz> In reply to @Elegantbeef "<@81390960805675008>\: when can I": Not yet, need some more nimification |
02:20:25 | * | ajunior quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
02:24:07 | FromDiscord | <jan_darkk> In reply to @huantian "what does that do?": sorry for late reply, but it makes getter and setter functions automatically |
02:24:31 | FromDiscord | <Elegantbeef> Nim doesnt have that, one could make a template to do it quite quickly |
02:25:09 | FromDiscord | <jan_darkk> alright, ty |
02:33:21 | * | xet7 quit (Remote host closed the connection) |
02:33:26 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4C6p @jan_darkk see really simple 😄 |
02:34:41 | * | xet7 joined #nim |
02:35:01 | FromDiscord | <Elegantbeef> Well shit that errors 😄 |
03:43:08 | FromDiscord | <etra> I'm probably being incredibly dumb here, but <https://github.com/status-im/nim-taskpools#non-goals> does that means that taskpools doesn't support any non-trivial object when spawning? |
03:48:16 | * | rockcavera quit (Read error: Connection reset by peer) |
03:48:20 | FromDiscord | <Elegantbeef> I think it means with refc, I could be wrong though |
03:48:30 | FromDiscord | <Elegantbeef> @mratsim\: may respond if we do this |
03:48:39 | * | rockcavera joined #nim |
03:48:39 | * | rockcavera quit (Changing host) |
03:48:40 | * | rockcavera joined #nim |
04:05:19 | * | rockcavera quit (Read error: Connection reset by peer) |
04:05:47 | * | rockcavera joined #nim |
04:05:47 | * | rockcavera quit (Changing host) |
04:05:47 | * | rockcavera joined #nim |
04:12:59 | FromDiscord | <etra> sent a code paste, see https://play.nim-lang.org/#ix=4C6G |
04:15:05 | FromDiscord | <Elegantbeef> You may want `syncRoot(Weave)` before the `exit` |
04:16:45 | FromDiscord | <Elegantbeef> It seems that's what `syncScope` is supposed to do, but i don't know |
04:25:20 | FromDiscord | <etra> wait that actually works lol |
04:25:28 | FromDiscord | <etra> omfg |
04:25:32 | FromDiscord | <etra> but using a for loop breaks it again |
04:26:08 | FromDiscord | <Elegantbeef> `parallelfor` time? |
04:27:18 | FromDiscord | <.matrixagent> wait nim 2.0 is out? |
04:27:27 | FromDiscord | <.matrixagent> what changes happened |
04:33:38 | FromDiscord | <demotomohiro> In reply to @.matrixagent "wait nim 2.0 is": https://forum.nim-lang.org/t/10366 |
04:35:04 | FromDiscord | <etra> sent a code paste, see https://play.nim-lang.org/#ix=4C6H |
04:35:14 | FromDiscord | <etra> (edit) "https://play.nim-lang.org/#ix=4C6H" => "https://play.nim-lang.org/#ix=4C6I" |
04:48:03 | FromDiscord | <Phil> In reply to @etra "how am I supposed": Got to use nimble (or maybe atlas?) if you want to compile and have dependencies installed automatically 😛 |
04:52:59 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4C6K |
04:53:30 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4C6K" => "https://play.nim-lang.org/#ix=4C6M" |
05:11:21 | * | rockcavera quit (Remote host closed the connection) |
05:30:18 | * | azimut quit (Ping timeout: 240 seconds) |
05:40:45 | FromDiscord | <michaelb.eth> when wrapping C, is there a blessed/recommended way to wrap a C function that has a parameter of C's `va_list` type? |
05:41:59 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#foreign-function-interface-varargs-pragma Might work |
05:42:30 | FromDiscord | <michaelb.eth> ah! thanks <:ocaml_hug:913105874615148564> |
05:42:40 | FromDiscord | <Elegantbeef> Don't recall the cursed `va_list` type |
05:42:44 | Amun-Ra | I don't think this is going to work |
05:42:53 | FromDiscord | <Elegantbeef> Me either |
05:42:58 | FromDiscord | <michaelb.eth> In reply to @Elegantbeef "Don't recall the cursed": yeah, seems a bit cursed |
05:43:14 | * | xet7 quit (Remote host closed the connection) |
05:47:47 | FromDiscord | <Phil> What's coding without a little bit of cursed code! It is required to spice things up! |
05:52:20 | Amun-Ra | michaelb.eth: I don't think va_list is even well defined in C standard; writing wrapper is one way, the other is not to use functions using va_list ;) |
05:53:41 | FromDiscord | <michaelb.eth> > the other is not to use functions using va_list 😉↵↵yeah, I think I'm looking at disclaimer in my wrapper's readme that "such and such aren't wrapped because they would require wrapping `va_list`" |
06:00:31 | * | xet7 joined #nim |
06:11:24 | FromDiscord | <Festive> Any way to convert an entire CPP file info nimlang automatically |
06:11:42 | FromDiscord | <Elegantbeef> Nope c2nim can help but it'll never be right |
06:13:13 | FromDiscord | <demotomohiro> Converting an C++ files to Nim code automatically would be like rocket science even if you can use bleeding edge AI. |
06:13:15 | FromDiscord | <Festive> https://github.com/geissbuehler/TermsrvPatcher↵↵Im trying to port this to nim |
06:13:20 | FromDiscord | <Festive> It's C# tho |
06:15:56 | * | kenran joined #nim |
06:55:01 | * | ntat joined #nim |
07:00:29 | FromDiscord | <gamedroit> Omg finally Nim 2 was released :3 I'll try it tomorrow |
07:03:16 | FromDiscord | <Phil> In reply to @gamedroit "Omg finally Nim 2": You will find... it's like nim 1.6 but better and (imo) slightly faster compilation, though that is not based on any measured data |
07:03:21 | FromDiscord | <Phil> (edit) "In reply to @gamedroit "Omg finally Nim 2": You will find... it's like nim 1.6 but better and (imo) slightly faster compilation, though that is not based on any measured data ... " added "😄" |
07:04:08 | FromDiscord | <gamedroit> Hmm but new features are interesting, I think I'll always have strictDefs enabled in the config file lol |
07:04:42 | FromDiscord | <gamedroit> And making an error seems more fitting than a warning that can be easily ignored. |
07:06:06 | FromDiscord | <gamedroit> Tho the changelog doesn't mention if there were improvements to the exception produced from an async function |
07:06:11 | FromDiscord | <gamedroit> I hope so |
07:06:55 | FromDiscord | <gamedroit> (edit) "changelog" => "~~changelog~~ release article" |
07:07:06 | * | ntat quit (Quit: leaving) |
07:07:49 | FromDiscord | <Elegantbeef> Zoom\: just remembered, slicerator's master branch is out |
07:07:57 | * | ntat joined #nim |
07:08:24 | FromDiscord | <Elegantbeef> Itermacros for all |
07:10:16 | FromDiscord | <gamedroit> Beef, do you have a collection of libraries that you use in most of your projects? |
07:14:29 | FromDiscord | <Elegantbeef> I don't write many projects that arent small toy libraries |
07:14:32 | FromDiscord | <Elegantbeef> So not really |
07:14:47 | FromDiscord | <Elegantbeef> `micros` is really the most used thing I have that probably is depended on by all my files |
07:20:01 | FromDiscord | <Elegantbeef> Maybe if I was a real developer I'd have a more concrete list 😄 |
07:26:21 | FromDiscord | <anuke> ~~where's the usage guide for slicerators??~~ |
07:26:34 | FromDiscord | <Elegantbeef> `tests/...` 😜 |
07:27:06 | FromDiscord | <Elegantbeef> I guess one day I'll setup CIs for docs |
07:27:09 | FromDiscord | <Elegantbeef> I still hate using CIs |
07:36:18 | * | hmht joined #nim |
08:15:10 | FromDiscord | <mratsim> In reply to @etra "I'm probably being incredibly": It means it's not tested, in particular handling destructors correctly |
08:52:11 | * | om3ga quit (Ping timeout: 264 seconds) |
08:57:38 | * | om3ga joined #nim |
09:25:23 | * | jmd_ quit (Ping timeout: 250 seconds) |
09:59:52 | FromDiscord | <fwsgonzo> Hey all, is there any way to share the nimcache between separate programs transpiled to C? |
10:00:26 | FromDiscord | <fwsgonzo> (edit) "Hey all, is there any way to share the nimcache between separate programs transpiled to C? ... " added "and what is the status of incremental compilation?" |
10:02:15 | FromDiscord | <fwsgonzo> also, thank god -d:useMalloc is still an option 😉 it's very important that it stays! |
10:17:21 | * | sagax joined #nim |
10:18:56 | * | junaid_ joined #nim |
10:19:20 | * | junaid_ quit (Client Quit) |
11:12:02 | * | kenran quit (Remote host closed the connection) |
11:17:10 | * | ajunior joined #nim |
12:47:37 | Amun-Ra | true |
12:48:21 | FromDiscord | <ringabout> In reply to @fwsgonzo "Hey all, is there": https://forum.nim-lang.org/t/10366#69019 |
12:48:31 | FromDiscord | <ringabout> > https://forum.nim-lang.org/t/10366#69019 |
12:48:39 | FromDiscord | <ringabout> (edit) "https://forum.nim-lang.org/t/10366#69019" => "What about IC? A: Bugs aside, the way we implemented IC doesn't show enough of a performance benefit so we'll redo the way it works yet again." |
12:52:31 | * | lucasta joined #nim |
12:54:55 | * | ntat quit (Quit: leaving) |
13:05:56 | FromDiscord | <ieltan> Damn, IC will need to be redone? |
13:06:03 | FromDiscord | <ieltan> 😢 |
13:10:54 | * | rockcavera joined #nim |
13:17:08 | Amun-Ra | I need to extend the signed type in some cases, is there an equivalent of https://play.nim-lang.org/#ix=4C8M in stdlib? |
13:18:20 | FromDiscord | <odexine> idts |
13:20:37 | Amun-Ra | tx |
13:30:46 | FromDiscord | <odexine> i at least do not recall any functions that look like that |
13:31:37 | FromDiscord | <.kanaxa> There's a really nice book in the Python community called "Automate the Boring Stuff with Python" |
13:31:44 | FromDiscord | <.kanaxa> I was wondering if there's something similar for Nim? |
13:31:47 | FromDiscord | <deech4592> Re: IC, a generics story that doesn't just macro expand should speed up compilation overall by only compiling higher order code once. But it is a lot more complicated because you essentially have to implement a runtime JIT that generates efficient code for any given type, see https://forums.swift.org/t/compiling-swift-generics-part-i/60898. Having read about the tradeoffs I now think there's a strong case to be made for keeping generi |
13:32:02 | FromDiscord | <.kanaxa> In reply to @.kanaxa "I was wondering if": Currently there's only Nim in action, and a few disparate guides/books online |
13:32:21 | FromDiscord | <.kanaxa> But with Nimscript it does seem possible for NIm to be used for a lot more automation and fun stuff |
13:34:05 | FromDiscord | <leetnewb> ATBS is pretty standout period. hard to match something like that. |
13:34:37 | FromDiscord | <leetnewb> (edit) "ATBS is pretty standout period. hard to match something like that. ... " added "very high bar." |
13:35:15 | FromDiscord | <leetnewb> If you haven't seen this one, it's very good though: https://ssalewski.de/nimprogramming.html |
13:39:11 | FromDiscord | <.kanaxa> In reply to @leetnewb "If you haven't seen": I love this one! Have been going over it slowly, but it reads like a reference manual at times, compared to Automate the Boring Stuff which gets your feet wet in the language really quickly, feels quite conversational and is geared towards general daily use |
13:39:32 | FromDiscord | <.kanaxa> The programming exercises for Dr Salewski's stuff is fantastic though |
13:53:25 | NimEventer | New Nimble package! karkas - Layout helpers and sugar for Karax, see https://github.com/moigagoo/karkas |
14:08:57 | FromDiscord | <requiresupport> sent a code paste, see https://play.nim-lang.org/#ix=4C96 |
14:10:17 | arkanoid | whats is the background reason why nim defaults to gcc compared to clang for compilation? |
14:12:48 | FromDiscord | <ambient3332> gcc is easier to ship as a bundled package? |
14:17:34 | * | hmht quit (Quit: leaving) |
14:24:34 | * | azimut joined #nim |
14:26:56 | * | ajunior quit (Ping timeout: 246 seconds) |
14:29:28 | * | ajunior joined #nim |
14:41:20 | arkanoid | ambient3332, also clang? |
14:49:43 | NimEventer | New thread by moigagoo: Karkas: Karax library to build layouts and work with styles, see https://forum.nim-lang.org/t/10368 |
14:50:41 | FromDiscord | <spotlightkid> And keep in mind how many years Python already existed when this book was written.↵(@leetnewb) |
14:52:14 | FromDiscord | <leetnewb> In reply to @spotlightkid "And keep in mind": Interesting point. although maybe at 2.0, nim is ready for its own "edition" |
14:53:28 | FromDiscord | <juan_carlos> sent a code paste, see https://play.nim-lang.org/#ix=4C9l |
14:56:31 | * | ntat joined #nim |
15:07:25 | FromDiscord | <Phil> ~~discard the Future, it is not important, program in the now~~ |
15:10:43 | FromDiscord | <juan_carlos> In reply to @arkanoid "whats is the background": Installed by default in Linux, BSD, etc ?, it has option for Clang too. |
15:18:52 | NimEventer | New thread by sls1005: Top-level generic variable, see https://forum.nim-lang.org/t/10369 |
15:39:36 | * | azimut_ joined #nim |
15:41:13 | * | Guest78 joined #nim |
15:41:58 | * | azimut quit (Ping timeout: 240 seconds) |
15:42:33 | * | Guest78 quit (Client Quit) |
15:43:48 | FromDiscord | <bostonboston> How do I choose which network adapter to route my outgoing traffic, the traffic is UDP, and I have a static IP on the adapter |
15:55:34 | FromDiscord | <spotlightkid> Routing is done by the OS, not by the network client code. |
15:59:50 | FromDiscord | <nnsee> i mean, you _can_ send arbitrary packets from any interface if you have CAP_NET_RAW, but unless you have a very good reason to do so, you should just leave routing to the OS |
16:00:36 | FromDiscord | <nnsee> and set up the proper outbound route using something like `ip` on Linux |
16:01:12 | FromDiscord | <nnsee> `ip r add 100.100.0.0/24 via 192.168.1.1 dev eth0` |
16:01:14 | FromDiscord | <nnsee> or something |
16:02:01 | FromDiscord | <bostonboston> The reason is the os has no idea who I'm sending to. I'm sending the data to the broadcast address (because reasons and there is nothing I can do about it) and I need to ensure that the device I want to receive the packet, gets the packet, it is critical that I can select which adapter I send the packet on |
16:04:39 | FromDiscord | <bostonboston> This is not a traditional client server application |
16:05:02 | FromDiscord | <nnsee> you want to setsockopt IF_MULTICAST_IP to the adapter IP iirc |
16:05:25 | FromDiscord | <nnsee> (edit) "IF_MULTICAST_IP" => "IP_MULTICAST_IF" |
16:06:08 | FromDiscord | <nnsee> or something. it's been a while since I've done something like this |
16:12:58 | FromDiscord | <that_dude.> If it's anything like python, you can enforce the adapter by using using `bindAddr` to the ip address of the adapter and then send like normal. |
16:13:29 | FromDiscord | <that_dude.> (edit) "If it's anything like python, you can enforce the adapter by using using `bindAddr` to the ... ip" added "local" |
16:19:42 | FromDiscord | <geekrelief> In reply to @fwsgonzo "Hey all, is there": Have you considered using a PCH file instead of reusing the contents of nimcache? In NimForUE we created a build system that manipulated the contents of the cpp files and built a pch file to compile with Unreal. |
16:22:08 | * | xaltsc joined #nim |
16:27:15 | * | junaid_ joined #nim |
16:31:00 | FromDiscord | <bostonboston> Binding the address gives me an exception "The requested address is not valid in it's context" but the adapter is attached with it's ip set |
16:38:51 | FromDiscord | <that_dude.> sent a code paste, see https://play.nim-lang.org/#ix=4Ca1 |
16:39:01 | FromDiscord | <that_dude.> All I got is this for general socket things↵https://stackoverflow.com/questions/38958233/the-requested-address-is-not-valid-in-its-context-error |
16:39:33 | FromDiscord | <that_dude.> (edit) "https://play.nim-lang.org/#ix=4Ca1" => "https://play.nim-lang.org/#ix=4Ca2" |
16:39:43 | FromDiscord | <that_dude.> (edit) "https://play.nim-lang.org/#ix=4Ca2" => "https://play.nim-lang.org/#ix=4Ca3" |
16:52:41 | * | lucasta quit (Quit: Leaving) |
17:22:58 | * | ntat quit (Quit: leaving) |
17:39:54 | * | ajunior quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
17:51:56 | FromDiscord | <Festive> Can you compile nim with another compile other than "nim c/cpp/js"? |
17:53:14 | FromDiscord | <jan_darkk> https://nim-lang.org/docs/nimc.html#:~:text=%2Db%2C%20%2D%2Dbackend%3Ac,or%20nim%20r |
17:53:19 | FromDiscord | <jan_darkk> yes, objc |
17:53:49 | FromDiscord | <juan_carlos> Nimscript, objc, wasm via clang, etc |
17:56:19 | * | xet7 quit (Remote host closed the connection) |
17:58:37 | FromDiscord | <Phil> I tend to use clang to link with musl regularly for example |
17:58:52 | FromDiscord | <Phil> Wait, I think I do, let me check my nimscript |
17:59:03 | FromDiscord | <Chronos [She/Her]> sent a long message, see http://ix.io/4Cav |
17:59:32 | FromDiscord | <Phil> (edit) "clang" => "musl-gcc" |
17:59:39 | * | ajunior joined #nim |
17:59:45 | FromDiscord | <Phil> Corrected myself, it was musl-gcc >_> |
18:00:43 | FromDiscord | <Phil> In reply to @yu.vitaqua.fer.chronos "Hey guys, so I": First of, you talk of a platform, so I assume you want to do both FE and BE?↵Where do you want to replace the swathes of code? Frontend because you speak of components? |
18:02:29 | FromDiscord | <Chronos [She/Her]> Yeah, also by replacing, I mean just swapping out different implementations for types, and by components I just mean different pieces within the backend |
18:03:34 | FromDiscord | <Phil> Ah, so you want to provide a fully fledged webserver with a FE built-in that provides chatting capabilities within which you want to have modular bits and pieces. |
18:07:16 | FromDiscord | <Chronos [She/Her]> Yeah exactly |
18:07:42 | FromDiscord | <Chronos [She/Her]> Well tbf might separate frontend and backend but |
18:08:19 | * | xet7 joined #nim |
18:09:20 | FromDiscord | <Phil> You connect those two via a Websocket I assume? Or do you wanna do long polling? |
18:09:51 | FromDiscord | <Phil> Or RPC given that you wrote "how to hnadle method calls" |
18:09:53 | FromDiscord | <Phil> (edit) "Or RPC given that you wrote "how to hnadle method calls" ... " added "?" |
18:10:10 | FromDiscord | <Chronos [She/Her]> Definitely will be doing websockets↵↵But I'm moreso talking about abstraction of data storage |
18:10:51 | FromDiscord | <Chronos [She/Her]> Since obviously I need to store data in a structure but I also want to make it so I can swap out how it's stored (so I can use a db instead of just writing JSON data) |
18:12:16 | FromDiscord | <Phil> I'll need some help here because after work and my chat with treeform my brain is basically crispy fried:↵You're asking for how to do routing to handler procs based of a websocket message + how to make your persistence layer in your application modular? |
18:12:35 | FromDiscord | <Phil> (edit) "handler" => "websocket-message-handler" |
18:13:55 | FromDiscord | <Festive> In reply to @jan_darkk "https://nim-lang.org/docs/nimc.html#:~:text=%2Db%2C": No, I meant like use a differet compiler |
18:13:59 | FromDiscord | <Festive> and not the default nim one |
18:14:03 | FromDiscord | <Festive> (edit) "differet" => "different" |
18:15:05 | FromDiscord | <Phil> Keep in mind there's a nim --> C step and from there you use a C compiler (assuming you compile to C and not JS).↵For the nim --> C step I don't think there's an alternative.↵For C --> binary you can use whatever. It defaults to your OSs default compiler (gcc on linux) but you can obviously swap those out for clang etc. |
18:15:32 | FromDiscord | <Festive> In reply to @isofruit "Keep in mind there's": Is there some compiler flag I can use to do this |
18:16:06 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/nimc.html#compiler-selection |
18:17:56 | FromDiscord | <Phil> And here a popular example to for example use the zig compiler just because:↵https://stackoverflow.com/questions/73345643/how-to-use-the-zig-compiler-in-order-to-compile-nim-code |
18:18:03 | FromDiscord | <Phil> Shameless self promo |
18:19:22 | FromDiscord | <Chronos [She/Her]> In reply to @isofruit "I'll need some help": I think I should rephrase completely, not the best wording I've had lol |
18:20:12 | FromDiscord | <Chronos [She/Her]> So I want to be able to abstract specific parts of my chat platform's backend, such as the part of it that provides and stores data to be used and processed in my application (for example: Messages) |
18:21:09 | FromDiscord | <Chronos [She/Her]> But I want to do it in a way where using a compile switch, I can toggle what storage method is being used, since I plan to be able to store data in a JSON format, or in a Postgres db |
18:21:17 | * | ntat joined #nim |
18:21:41 | FromDiscord | <Chronos [She/Her]> Issue is, to do this, I'd imagine I need to do something similar to what std/streams does? |
18:22:08 | FromDiscord | <Chronos [She/Her]> Basically it stores the reference to the procs in the actual type itself so it can be called (due to type information getting lost and such) |
18:22:23 | FromDiscord | <Chronos [She/Her]> I think this makes sense now? Sorry for the confusing explanation at the start |
18:23:58 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CaE |
18:24:19 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4CaE" => "https://play.nim-lang.org/#ix=4CaF" |
18:24:22 | FromDiscord | <Chronos [She/Her]> Ah okay, thank you! Hopefully should be able to do that |
18:24:50 | FromDiscord | <Chronos [She/Her]> Probably still gonna need to make a custom macro for containing information about the format version and how to migrate lol, but should be easier to do |
18:25:35 | FromDiscord | <Phil> You can of course name stuff however you want.↵You might also be able to have checks in persistence.nim that ensure that persistence/A etc. implement all the necessary procs |
18:26:01 | FromDiscord | <Chronos [She/Her]> I'd imagine using some macro hackery? |
18:26:24 | FromDiscord | <Phil> Could try having a bunch of private assignments like `let x: procTypeDefinition = pers.myProc` in persistence.nim |
18:26:50 | FromDiscord | <Phil> If no proc of the name exists --> compiler error↵If the proc doesn't match the type it should have --> compiler error |
18:26:56 | FromDiscord | <Chronos [She/Her]> That seems a bit painful honestly lol |
18:27:00 | FromDiscord | <Chronos [She/Her]> But would probably be a good idea |
18:27:04 | FromDiscord | <Phil> It is, that is the price for safety 😛 |
18:27:10 | FromDiscord | <Chronos [She/Her]> Would that code get eliminated in a release binary? |
18:27:21 | FromDiscord | <Elegantbeef> Only if the C compiler cares |
18:27:42 | FromDiscord | <Phil> It might? This seems like the kind of thing that would get tree shaken out because all the assignments are private and they aren't used anywhere |
18:27:47 | FromDiscord | <Phil> But I'd declare that a coin toss |
18:28:03 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/EyGX6 |
18:28:06 | FromDiscord | <Elegantbeef> Make that a template, call it a day |
18:28:18 | FromDiscord | <Phil> That seems like a better way to go about it |
18:28:45 | FromDiscord | <Elegantbeef> Probably should be `when declared(myProc) and myProc is proc` |
18:29:07 | FromDiscord | <Chronos [She/Her]> proc(...)(myProc)? |
18:29:09 | FromDiscord | <Phil> {.error.} will cause the compiler to throw an exception at compile time if it encounters that pragma with the error message declare there, that's why it's pretty useful (in case you weren't aware of that pragma, I wasn't when I first saw it) |
18:29:35 | FromDiscord | <Chronos [She/Her]> Yeah we've used it before lol |
18:30:05 | FromDiscord | <Phil> 👍 ↵I ask for forgiveness for any error or think I'm forgetting, as stated, crispy fried. I'll keel over in an hour I think |
18:30:12 | FromDiscord | <Elegantbeef> Yes convert the symbol to your proc type |
18:30:12 | FromDiscord | <Elegantbeef> "throw an exception at compile time" |
18:30:12 | FromDiscord | <Elegantbeef> Well that's not true, it just errors |
18:30:15 | FromDiscord | <Phil> (edit) "think" => "thing" |
18:31:30 | FromDiscord | <Phil> My language is pretty lax in distinguishing between errors and exceptions.↵I'm aware they're separate but I don't tend to care between the distinction, practically it simply means "bad thing here, fix" |
18:31:38 | FromDiscord | <Phil> (edit) "My language is pretty lax in distinguishing between errors and exceptions.↵I'm aware they're separate but I don't tend to care between the distinction, practically it simply means "bad thing here, fix" ... " added "to me" |
18:32:02 | FromDiscord | <Phil> (edit) "between" => "to make" |
18:33:51 | FromDiscord | <_gumbercules> there's a big difference and it matters |
18:34:10 | FromDiscord | <Elegantbeef> Well "Throw exception at compile time" sounds like it can be caught and managed |
18:34:46 | FromDiscord | <Elegantbeef> While it technically can be managed it's done use `when not compiles(...)` |
18:34:49 | FromDiscord | <_gumbercules> err sorry I meant in response to Phil |
18:35:05 | FromDiscord | <_gumbercules> yeah I don't think the runtime facilities for handling exceptions are available at compile time |
18:35:06 | FromDiscord | <Elegantbeef> I was responding to phil aswell |
18:35:14 | FromDiscord | <demotomohiro> I throw `Defect` at compile time if there is something wrong. |
18:36:22 | FromDiscord | <Elegantbeef> The VM does support exception handling, but doubt that's what yo umean |
18:36:56 | FromDiscord | <_gumbercules> well if exceptions are able to be thrown and caught at compile time I'm wrong |
18:37:06 | FromDiscord | <_gumbercules> I rarely ever use exceptions in Nim |
18:37:40 | FromDiscord | <Elegantbeef> Demo when possible error is much nicer imo |
18:37:58 | FromDiscord | <Elegantbeef> It doesnt appear like an exception, it is just a compiler error with a nice message |
18:38:18 | FromDiscord | <_gumbercules> yeah i usually rely on the `{.error: "whatever".}` pragma |
18:40:16 | FromDiscord | <Elegantbeef> Same with macros, if you do not use the `error` procedure inside a macro in a wrong state, you're just the worst |
18:40:53 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "Yes convert the symbol": Ah |
18:42:32 | FromDiscord | <demotomohiro> error pragma is nice, but doesn't work with when statement or proc with compiletime pragma. |
18:57:18 | FromDiscord | <Chronos [She/Her]> Why doesn't it work with when statements? |
18:57:23 | FromDiscord | <Chronos [She/Her]> I swear it does |
18:58:24 | FromDiscord | <Phil> Pretty sure it does, I use it that way successfully with my mapping proc play project |
19:01:04 | * | jmdaemon joined #nim |
19:06:50 | * | junaid_ quit (Remote host closed the connection) |
19:11:42 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4Cb3 |
19:28:07 | FromDiscord | <nivviv> sent a long message, see http://ix.io/4Cb5 |
19:28:51 | FromDiscord | <Chronos [She/Her]> Ngl currently wondering if I should make something like 'traits' for Nim |
19:28:56 | FromDiscord | <Chronos [She/Her]> Idk |
19:28:58 | FromDiscord | <Chronos [She/Her]> Eh nah |
19:29:53 | FromDiscord | <etra> concepts are very similar afaik |
19:37:01 | * | ntat quit (Quit: leaving) |
19:52:39 | * | jjido joined #nim |
20:01:07 | FromDiscord | <Elegantbeef> https://github.com/beef331/traitor PRs welcome 😛↵(@Chronos [She/Her]) |
20:02:11 | FromDiscord | <Elegantbeef> @nivviv\: I have not used altas but my understanding is it just adds the current most recent tag to the nimble file when you do `atlas use bleh` |
20:13:19 | FromDiscord | <shalokshalom> In reply to @Elegantbeef "https://github.com/beef331/traitor PRs welcome 😛": Genius name |
20:13:24 | FromDiscord | <shalokshalom> i give you that |
20:17:21 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "https://github.com/beef331/traitor PRs welcome 😛": Interesting |
20:19:08 | FromDiscord | <Elegantbeef> The traitor1 branch has more accessible macros, but is also not a trait system really but an interface system |
20:21:20 | FromDiscord | <Chronos [She/Her]> Makes sense |
20:29:02 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
21:38:03 | * | ajunior quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
21:40:51 | * | ajunior joined #nim |
21:44:38 | FromDiscord | <m4ul3r> Are binaries larger with nim 2.0 compared to 1.6? |
21:45:47 | FromDiscord | <Elegantbeef> That's easy enough to test |
21:46:29 | FromDiscord | <m4ul3r> I should go back and test, they just feel a little bigger on first look with a basic `nim c -d:release file.nim` |
21:46:52 | FromDiscord | <Elegantbeef> Hello world using refc on 1.6.14 is 92kb it's nicekb with orc on 2.0 |
21:47:59 | FromDiscord | <Elegantbeef> 52kb with clang and lto |
21:48:05 | FromDiscord | <Elegantbeef> on 1.6.14 with refc |
21:48:23 | FromDiscord | <Elegantbeef> 40kb with orc, clang and lto |
21:48:34 | FromDiscord | <Elegantbeef> So for basic programs that do not use orc it's smaller 😄 |
21:49:57 | FromDiscord | <m4ul3r> Must be orc, my hello world is 243kb `-d:release` on windows with mingw64\bin\gcc.exe |
21:50:13 | FromDiscord | <Elegantbeef> On what nim version? |
21:50:18 | FromDiscord | <m4ul3r> 2.0.0 |
21:50:31 | FromDiscord | <Elegantbeef> Try clang or vcc i guess |
21:51:45 | FromDiscord | <Elegantbeef> How big was it on 1.6.14 with refc |
21:51:49 | * | ajunior quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
21:53:00 | FromDiscord | <Elegantbeef> Yea with mingw I get 349kb on 1.6.14 with refc. And 556kb with 2.0 and orc |
21:53:04 | NimEventer | New thread by walkr: A template inside a template, see https://forum.nim-lang.org/t/10370 |
21:53:30 | FromDiscord | <Elegantbeef> Though it's still smaller with orc on 1.6.14 than 2.0 |
21:53:36 | FromDiscord | <m4ul3r> I'll have to go back and redownload older nim |
21:53:40 | FromDiscord | <Elegantbeef> It's smaller with orc on 1.6.14 than even refc |
21:53:44 | FromDiscord | <m4ul3r> to check |
21:53:48 | FromDiscord | <Elegantbeef> This is why you use choosenim |
21:54:05 | FromDiscord | <m4ul3r> yeaahh, i went the route of installing nim manually |
21:57:17 | FromDiscord | <.matrixagent> any performance improvments in 2.0? |
21:57:43 | FromDiscord | <.matrixagent> i dont know if its worth recompiling my production code with it since i'd need to heavily test it |
21:57:46 | FromDiscord | <Elegantbeef> Orc is default and orc can allow optimisations through move semantics |
21:58:14 | FromDiscord | <Elegantbeef> It also can be faster out of the box |
21:58:22 | FromDiscord | <Elegantbeef> Depends on the program though |
21:58:56 | FromDiscord | <.matrixagent> just websockets and some json parsing |
21:59:26 | FromDiscord | <Elegantbeef> Probably would have lower latency |
21:59:48 | FromDiscord | <Elegantbeef> Hard to say, that's one benefit of ARC atleast is that it has lower latency vs. refc |
22:00:03 | FromDiscord | <Elegantbeef> But if you're using the cycle collector that becomes tricky to guess |
22:00:10 | FromDiscord | <.matrixagent> yeah im running arc not orc |
22:00:34 | FromDiscord | <Elegantbeef> If you're running arc there is no benefit to orc |
22:01:10 | FromDiscord | <Elegantbeef> 2.0 might have arc fixes and optimisations but it'll likely be similar peformance |
22:05:27 | rockcavera | m4ul3r you can use -d:strip if you use gcc |
22:06:21 | FromDiscord | <Elegantbeef> Oh yea that gets both under 100kb |
22:06:29 | FromDiscord | <m4ul3r> yeah there are a few things to get it down, just noticed it was a little chonkier without anything |
22:06:39 | FromDiscord | <m4ul3r> not by much tbh, like 50kbish |
22:06:49 | FromDiscord | <Elegantbeef> Though 2.0 is 30kb larger |
22:08:52 | rockcavera | if I'm not mistaken, --mm:orc uses goto exception by default which throws bunch of ifs after every function call. This makes the code little slower and bloated compared to refc. |
22:09:55 | rockcavera | to avoid this you can use --exceptions:setjmp or --panics:on |
22:11:56 | FromDiscord | <Festive> In reply to @rockcavera "m4ul3r you can use": What does -d:strip do? |
22:12:43 | FromDiscord | <m4ul3r> In reply to @Festive "What does -d:strip do?": strips symbols and probably a bit more |
22:12:48 | rockcavera | remove all symbol and relocation information |
22:12:51 | FromDiscord | <Festive> Holy shit it just brought my file size down 100kb |
22:13:16 | FromDiscord | <Festive> sorcery |
22:13:50 | rockcavera | it just goes to the link to remove, it's not the nim compiler that does it, it's gcc or clang |
22:14:10 | FromDiscord | <Festive> so it's different from --opt:size? |
22:14:24 | FromDiscord | <Elegantbeef> Yes |
22:14:27 | rockcavera | yes |
22:14:33 | FromDiscord | <Festive> if opt-size doesn't take out all of the extra junk, what's it even do |
22:14:48 | FromDiscord | <m4ul3r> optimizes for size |
22:14:57 | FromDiscord | <Festive> no duh, but how |
22:14:58 | FromDiscord | <Elegantbeef> Tell the C compiler "we care about size not speed" |
22:14:59 | rockcavera | it removes "unnecessary" stuff from the executable, it doesn't interfere with the generated machine code |
22:15:04 | FromDiscord | <m4ul3r> magic |
22:15:23 | FromDiscord | <m4ul3r> gcc has a lot of magic options |
22:15:31 | FromDiscord | <Festive> In reply to @rockcavera "it removes "unnecessary" stuff": so basically --opt:size is telling nimlang to remove the useless stuff, and -d:strip tells the compiler to remove the useless stuff |
22:15:36 | FromDiscord | <Elegantbeef> optimising for size means not inline aggressive and other tricks that you'd generally want |
22:15:42 | FromDiscord | <Elegantbeef> no `--opt:size` is still a C flag |
22:15:48 | FromDiscord | <Festive> damn |
22:15:55 | FromDiscord | <Festive> so many flags |
22:16:00 | rockcavera | one way to look at this on windows, with mingw, is `objdump -d file.exe` with and without strip. You verify that the debug markers add up. |
22:16:41 | rockcavera | I speak in Windows, because I don't use linux to answer if the operation is the same as gcc there. |
22:17:02 | FromDiscord | <Festive> So if I wanted to make my file as small as humanly possible and sacrifice everything else what flags can I use |
22:17:17 | FromDiscord | <Elegantbeef> By default linux binaries with gcc were tremendously smaller 😄 |
22:17:31 | FromDiscord | <Elegantbeef> `--opt:size -d:lto -d:strip` |
22:17:44 | rockcavera | -d:useMalloc |
22:17:47 | rockcavera | =) |
22:18:04 | rockcavera | -d:useMalloc removes Nim's memory allocator |
22:18:18 | FromDiscord | <Festive> Will my program still function if I remove it though |
22:18:22 | FromDiscord | <Elegantbeef> Of course |
22:18:24 | FromDiscord | <Festive> In reply to @Elegantbeef "`--opt:size -d:lto -d:strip`": 179kb |
22:18:44 | FromDiscord | <Festive> In reply to @rockcavera "-d:useMalloc removes Nim's memory": same thing |
22:18:58 | FromDiscord | <Festive> it seems 179kb is the lowest I can go with my program |
22:19:06 | FromDiscord | <Elegantbeef> `-d:nimAllocPagesViaMalloc` might also reduce the size enough without throwing the water out |
22:19:14 | FromDiscord | <Elegantbeef> You can get lower with `-d:danger` but that's only cause it removes bounds checks 😄 |
22:19:46 | FromDiscord | <Festive> 166 😉 |
22:20:02 | FromDiscord | <Festive> nim --opt:size -d:lto -d:danger -d:nimAllocPagesViaMall -d:strip c main.nim |
22:20:30 | FromDiscord | <Festive> And it still works! |
22:20:36 | FromDiscord | <Elegantbeef> Do not actually use `-d:danger` |
22:20:44 | FromDiscord | <Festive> why? |
22:21:10 | FromDiscord | <Elegantbeef> It removes all runtime safety checks |
22:21:10 | FromDiscord | <Elegantbeef> So an array out of bounds is a valid operation |
22:21:22 | FromDiscord | <Festive> Oh ok |
22:21:29 | FromDiscord | <Festive> how about -d:release |
22:21:36 | FromDiscord | <Elegantbeef> As the name implies it's dangerous |
22:21:43 | FromDiscord | <Elegantbeef> Release is fine |
22:21:53 | NimEventer | New question by jwesonga: Async HTTP call and json using Nim, see https://stackoverflow.com/questions/76823853/async-http-call-and-json-using-nim |
22:22:15 | FromDiscord | <Elegantbeef> You also might be able to get a smaller binary using a different compiler |
22:22:20 | FromDiscord | <Elegantbeef> Clang or vcc might produce smaller binaries |
22:24:37 | rockcavera | -d:useMalloc on windows reduces a hello world by 5kb |
22:24:48 | rockcavera | -d:useMalloc only works with --mm:arc/orc |
22:25:11 | rockcavera | -d:useMalloc may reduce performance |
22:27:30 | FromDiscord | <Elegantbeef> How's `-d:nimAllocPagesViaMalloc` change the binary size? |
22:27:50 | FromDiscord | <Elegantbeef> I imagine not much since the allocator is still there, but it doesnt use mmap or similar |
22:29:46 | rockcavera | reduced about 500bytes here |
22:30:12 | FromDiscord | <Elegantbeef> Yea about what I expected 😄 |
22:31:20 | rockcavera | 512 bytes, I believe =) |
22:37:39 | * | ajunior joined #nim |
22:44:04 | FromDiscord | <Chronos [She/Her]> Anyone know if there's a minimal browser that I can compile into my Nim program to puppet a website? Lol |
22:44:27 | FromDiscord | <Chronos [She/Her]> Can't be big because it's gonna be an android app...which obviously, Chromium and Firefox aren't lol |
22:48:11 | * | ajunior quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
23:00:23 | * | ajunior joined #nim |
23:00:52 | * | rockcavera quit (Remote host closed the connection) |
23:01:16 | * | rockcavera joined #nim |
23:17:02 | * | ajunior quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |