<< 02-08-2023 >>

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:50FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4C68
00:13:44FromDiscord<Chronos [She/Her]> Idk how else to handle it though so
00:14:12FromDiscord<m4ul3r> What is the size is owo.exe?
00:15:20FromDiscord<Elegantbeef> Too big
00:15:40FromDiscord<Elegantbeef> That's a joke due to the binary name, not an actual answer
00:16:05FromDiscord<etra> In reply to @Elegantbeef "<@329819426000076801>\: isolated data is": can ref objects be isolated?
00:16:43FromDiscord<Elegantbeef> Of course
00:17:23*lumo_e joined #nim
00:17:32FromDiscord<etra> ugh, trying to use taskpools has been harder than I'd like, I have Severe Skill Issues
00:17:39FromDiscord<etra> but cannot provide examples, sadly
00:18:45FromDiscord<m4ul3r> sent a code paste, see https://play.nim-lang.org/#ix=4C6a
00:19:23FromDiscord<Elegantbeef> https://forum.nim-lang.org/t/10161#67280 etra
00:24:18FromDiscord<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:24FromDiscord<jan_darkk> does nim have automatic getter and setter makers?
01:28:48FromDiscord<jan_darkk> for example Crystal has `getter(:var1, :var2, :var3)` and `setter(:var1, :var2, :var3)`
01:28:54FromDiscord<jan_darkk> (edit) "makers?" => "function creators?"
01:29:21FromDiscord<huantian> what does that do?
01:30:54FromDiscord<Elegantbeef> Probably creates properties for a field
01:30:54FromDiscord<Elegantbeef> Akin to odin's using
01:47:23NimEventerNew Nimble package! bcs - nim implementation of bcs serialization format, see https://github.com/C-NERD/nimBcs
02:14:50FromDiscord<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:07FromDiscord<jan_darkk> In reply to @huantian "what does that do?": sorry for late reply, but it makes getter and setter functions automatically
02:24:31FromDiscord<Elegantbeef> Nim doesnt have that, one could make a template to do it quite quickly
02:25:09FromDiscord<jan_darkk> alright, ty
02:33:21*xet7 quit (Remote host closed the connection)
02:33:26FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4C6p @jan_darkk see really simple 😄
02:34:41*xet7 joined #nim
02:35:01FromDiscord<Elegantbeef> Well shit that errors 😄
03:43:08FromDiscord<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:20FromDiscord<Elegantbeef> I think it means with refc, I could be wrong though
03:48:30FromDiscord<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:59FromDiscord<etra> sent a code paste, see https://play.nim-lang.org/#ix=4C6G
04:15:05FromDiscord<Elegantbeef> You may want `syncRoot(Weave)` before the `exit`
04:16:45FromDiscord<Elegantbeef> It seems that's what `syncScope` is supposed to do, but i don't know
04:25:20FromDiscord<etra> wait that actually works lol
04:25:28FromDiscord<etra> omfg
04:25:32FromDiscord<etra> but using a for loop breaks it again
04:26:08FromDiscord<Elegantbeef> `parallelfor` time?
04:27:18FromDiscord<.matrixagent> wait nim 2.0 is out?
04:27:27FromDiscord<.matrixagent> what changes happened
04:33:38FromDiscord<demotomohiro> In reply to @.matrixagent "wait nim 2.0 is": https://forum.nim-lang.org/t/10366
04:35:04FromDiscord<etra> sent a code paste, see https://play.nim-lang.org/#ix=4C6H
04:35:14FromDiscord<etra> (edit) "https://play.nim-lang.org/#ix=4C6H" => "https://play.nim-lang.org/#ix=4C6I"
04:48:03FromDiscord<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:59FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4C6K
04:53:30FromDiscord<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:45FromDiscord<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:59FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#foreign-function-interface-varargs-pragma Might work
05:42:30FromDiscord<michaelb.eth> ah! thanks <:ocaml_hug:913105874615148564>
05:42:40FromDiscord<Elegantbeef> Don't recall the cursed `va_list` type
05:42:44Amun-RaI don't think this is going to work
05:42:53FromDiscord<Elegantbeef> Me either
05:42:58FromDiscord<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:47FromDiscord<Phil> What's coding without a little bit of cursed code! It is required to spice things up!
05:52:20Amun-Ramichaelb.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:41FromDiscord<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:24FromDiscord<Festive> Any way to convert an entire CPP file info nimlang automatically
06:11:42FromDiscord<Elegantbeef> Nope c2nim can help but it'll never be right
06:13:13FromDiscord<demotomohiro> Converting an C++ files to Nim code automatically would be like rocket science even if you can use bleeding edge AI.
06:13:15FromDiscord<Festive> https://github.com/geissbuehler/TermsrvPatcher↵↵Im trying to port this to nim
06:13:20FromDiscord<Festive> It's C# tho
06:15:56*kenran joined #nim
06:55:01*ntat joined #nim
07:00:29FromDiscord<gamedroit> Omg finally Nim 2 was released :3 I'll try it tomorrow
07:03:16FromDiscord<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:21FromDiscord<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:08FromDiscord<gamedroit> Hmm but new features are interesting, I think I'll always have strictDefs enabled in the config file lol
07:04:42FromDiscord<gamedroit> And making an error seems more fitting than a warning that can be easily ignored.
07:06:06FromDiscord<gamedroit> Tho the changelog doesn't mention if there were improvements to the exception produced from an async function
07:06:11FromDiscord<gamedroit> I hope so
07:06:55FromDiscord<gamedroit> (edit) "changelog" => "~~changelog~~ release article"
07:07:06*ntat quit (Quit: leaving)
07:07:49FromDiscord<Elegantbeef> Zoom\: just remembered, slicerator's master branch is out
07:07:57*ntat joined #nim
07:08:24FromDiscord<Elegantbeef> Itermacros for all
07:10:16FromDiscord<gamedroit> Beef, do you have a collection of libraries that you use in most of your projects?
07:14:29FromDiscord<Elegantbeef> I don't write many projects that arent small toy libraries
07:14:32FromDiscord<Elegantbeef> So not really
07:14:47FromDiscord<Elegantbeef> `micros` is really the most used thing I have that probably is depended on by all my files
07:20:01FromDiscord<Elegantbeef> Maybe if I was a real developer I'd have a more concrete list 😄
07:26:21FromDiscord<anuke> ~~where's the usage guide for slicerators??~~
07:26:34FromDiscord<Elegantbeef> `tests/...` 😜
07:27:06FromDiscord<Elegantbeef> I guess one day I'll setup CIs for docs
07:27:09FromDiscord<Elegantbeef> I still hate using CIs
07:36:18*hmht joined #nim
08:15:10FromDiscord<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:52FromDiscord<fwsgonzo> Hey all, is there any way to share the nimcache between separate programs transpiled to C?
10:00:26FromDiscord<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:15FromDiscord<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:37Amun-Ratrue
12:48:21FromDiscord<ringabout> In reply to @fwsgonzo "Hey all, is there": https://forum.nim-lang.org/t/10366#69019
12:48:31FromDiscord<ringabout> > https://forum.nim-lang.org/t/10366#69019
12:48:39FromDiscord<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:56FromDiscord<ieltan> Damn, IC will need to be redone?
13:06:03FromDiscord<ieltan> 😢
13:10:54*rockcavera joined #nim
13:17:08Amun-RaI 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:20FromDiscord<odexine> idts
13:20:37Amun-Ratx
13:30:46FromDiscord<odexine> i at least do not recall any functions that look like that
13:31:37FromDiscord<.kanaxa> There's a really nice book in the Python community called "Automate the Boring Stuff with Python"
13:31:44FromDiscord<.kanaxa> I was wondering if there's something similar for Nim?
13:31:47FromDiscord<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:02FromDiscord<.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:21FromDiscord<.kanaxa> But with Nimscript it does seem possible for NIm to be used for a lot more automation and fun stuff
13:34:05FromDiscord<leetnewb> ATBS is pretty standout period. hard to match something like that.
13:34:37FromDiscord<leetnewb> (edit) "ATBS is pretty standout period. hard to match something like that. ... " added "very high bar."
13:35:15FromDiscord<leetnewb> If you haven't seen this one, it's very good though: https://ssalewski.de/nimprogramming.html
13:39:11FromDiscord<.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:32FromDiscord<.kanaxa> The programming exercises for Dr Salewski's stuff is fantastic though
13:53:25NimEventerNew Nimble package! karkas - Layout helpers and sugar for Karax, see https://github.com/moigagoo/karkas
14:08:57FromDiscord<requiresupport> sent a code paste, see https://play.nim-lang.org/#ix=4C96
14:10:17arkanoidwhats is the background reason why nim defaults to gcc compared to clang for compilation?
14:12:48FromDiscord<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:20arkanoidambient3332, also clang?
14:49:43NimEventerNew thread by moigagoo: Karkas: Karax library to build layouts and work with styles, see https://forum.nim-lang.org/t/10368
14:50:41FromDiscord<spotlightkid> And keep in mind how many years Python already existed when this book was written.↵(@leetnewb)
14:52:14FromDiscord<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:28FromDiscord<juan_carlos> sent a code paste, see https://play.nim-lang.org/#ix=4C9l
14:56:31*ntat joined #nim
15:07:25FromDiscord<Phil> ~~discard the Future, it is not important, program in the now~~
15:10:43FromDiscord<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:52NimEventerNew 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:48FromDiscord<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:34FromDiscord<spotlightkid> Routing is done by the OS, not by the network client code.
15:59:50FromDiscord<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:36FromDiscord<nnsee> and set up the proper outbound route using something like `ip` on Linux
16:01:12FromDiscord<nnsee> `ip r add 100.100.0.0/24 via 192.168.1.1 dev eth0`
16:01:14FromDiscord<nnsee> or something
16:02:01FromDiscord<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:39FromDiscord<bostonboston> This is not a traditional client server application
16:05:02FromDiscord<nnsee> you want to setsockopt IF_MULTICAST_IP to the adapter IP iirc
16:05:25FromDiscord<nnsee> (edit) "IF_MULTICAST_IP" => "IP_MULTICAST_IF"
16:06:08FromDiscord<nnsee> or something. it's been a while since I've done something like this
16:12:58FromDiscord<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:29FromDiscord<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:42FromDiscord<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:00FromDiscord<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:51FromDiscord<that_dude.> sent a code paste, see https://play.nim-lang.org/#ix=4Ca1
16:39:01FromDiscord<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:33FromDiscord<that_dude.> (edit) "https://play.nim-lang.org/#ix=4Ca1" => "https://play.nim-lang.org/#ix=4Ca2"
16:39:43FromDiscord<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:56FromDiscord<Festive> Can you compile nim with another compile other than "nim c/cpp/js"?
17:53:14FromDiscord<jan_darkk> https://nim-lang.org/docs/nimc.html#:~:text=%2Db%2C%20%2D%2Dbackend%3Ac,or%20nim%20r
17:53:19FromDiscord<jan_darkk> yes, objc
17:53:49FromDiscord<juan_carlos> Nimscript, objc, wasm via clang, etc
17:56:19*xet7 quit (Remote host closed the connection)
17:58:37FromDiscord<Phil> I tend to use clang to link with musl regularly for example
17:58:52FromDiscord<Phil> Wait, I think I do, let me check my nimscript
17:59:03FromDiscord<Chronos [She/Her]> sent a long message, see http://ix.io/4Cav
17:59:32FromDiscord<Phil> (edit) "clang" => "musl-gcc"
17:59:39*ajunior joined #nim
17:59:45FromDiscord<Phil> Corrected myself, it was musl-gcc >_>
18:00:43FromDiscord<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:29FromDiscord<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:34FromDiscord<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:16FromDiscord<Chronos [She/Her]> Yeah exactly
18:07:42FromDiscord<Chronos [She/Her]> Well tbf might separate frontend and backend but
18:08:19*xet7 joined #nim
18:09:20FromDiscord<Phil> You connect those two via a Websocket I assume? Or do you wanna do long polling?
18:09:51FromDiscord<Phil> Or RPC given that you wrote "how to hnadle method calls"
18:09:53FromDiscord<Phil> (edit) "Or RPC given that you wrote "how to hnadle method calls" ... " added "?"
18:10:10FromDiscord<Chronos [She/Her]> Definitely will be doing websockets↵↵But I'm moreso talking about abstraction of data storage
18:10:51FromDiscord<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:16FromDiscord<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:35FromDiscord<Phil> (edit) "handler" => "websocket-message-handler"
18:13:55FromDiscord<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:59FromDiscord<Festive> and not the default nim one
18:14:03FromDiscord<Festive> (edit) "differet" => "different"
18:15:05FromDiscord<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:32FromDiscord<Festive> In reply to @isofruit "Keep in mind there's": Is there some compiler flag I can use to do this
18:16:06FromDiscord<Elegantbeef> https://nim-lang.org/docs/nimc.html#compiler-selection
18:17:56FromDiscord<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:03FromDiscord<Phil> Shameless self promo
18:19:22FromDiscord<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:12FromDiscord<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:09FromDiscord<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:41FromDiscord<Chronos [She/Her]> Issue is, to do this, I'd imagine I need to do something similar to what std/streams does?
18:22:08FromDiscord<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:23FromDiscord<Chronos [She/Her]> I think this makes sense now? Sorry for the confusing explanation at the start
18:23:58FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CaE
18:24:19FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4CaE" => "https://play.nim-lang.org/#ix=4CaF"
18:24:22FromDiscord<Chronos [She/Her]> Ah okay, thank you! Hopefully should be able to do that
18:24:50FromDiscord<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:35FromDiscord<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:01FromDiscord<Chronos [She/Her]> I'd imagine using some macro hackery?
18:26:24FromDiscord<Phil> Could try having a bunch of private assignments like `let x: procTypeDefinition = pers.myProc` in persistence.nim
18:26:50FromDiscord<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:56FromDiscord<Chronos [She/Her]> That seems a bit painful honestly lol
18:27:00FromDiscord<Chronos [She/Her]> But would probably be a good idea
18:27:04FromDiscord<Phil> It is, that is the price for safety 😛
18:27:10FromDiscord<Chronos [She/Her]> Would that code get eliminated in a release binary?
18:27:21FromDiscord<Elegantbeef> Only if the C compiler cares
18:27:42FromDiscord<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:47FromDiscord<Phil> But I'd declare that a coin toss
18:28:03FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/EyGX6
18:28:06FromDiscord<Elegantbeef> Make that a template, call it a day
18:28:18FromDiscord<Phil> That seems like a better way to go about it
18:28:45FromDiscord<Elegantbeef> Probably should be `when declared(myProc) and myProc is proc`
18:29:07FromDiscord<Chronos [She/Her]> proc(...)(myProc)?
18:29:09FromDiscord<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:35FromDiscord<Chronos [She/Her]> Yeah we've used it before lol
18:30:05FromDiscord<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:12FromDiscord<Elegantbeef> Yes convert the symbol to your proc type
18:30:12FromDiscord<Elegantbeef> "throw an exception at compile time"
18:30:12FromDiscord<Elegantbeef> Well that's not true, it just errors
18:30:15FromDiscord<Phil> (edit) "think" => "thing"
18:31:30FromDiscord<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:38FromDiscord<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:02FromDiscord<Phil> (edit) "between" => "to make"
18:33:51FromDiscord<_gumbercules> there's a big difference and it matters
18:34:10FromDiscord<Elegantbeef> Well "Throw exception at compile time" sounds like it can be caught and managed
18:34:46FromDiscord<Elegantbeef> While it technically can be managed it's done use `when not compiles(...)`
18:34:49FromDiscord<_gumbercules> err sorry I meant in response to Phil
18:35:05FromDiscord<_gumbercules> yeah I don't think the runtime facilities for handling exceptions are available at compile time
18:35:06FromDiscord<Elegantbeef> I was responding to phil aswell
18:35:14FromDiscord<demotomohiro> I throw `Defect` at compile time if there is something wrong.
18:36:22FromDiscord<Elegantbeef> The VM does support exception handling, but doubt that's what yo umean
18:36:56FromDiscord<_gumbercules> well if exceptions are able to be thrown and caught at compile time I'm wrong
18:37:06FromDiscord<_gumbercules> I rarely ever use exceptions in Nim
18:37:40FromDiscord<Elegantbeef> Demo when possible error is much nicer imo
18:37:58FromDiscord<Elegantbeef> It doesnt appear like an exception, it is just a compiler error with a nice message
18:38:18FromDiscord<_gumbercules> yeah i usually rely on the `{.error: "whatever".}` pragma
18:40:16FromDiscord<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:53FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "Yes convert the symbol": Ah
18:42:32FromDiscord<demotomohiro> error pragma is nice, but doesn't work with when statement or proc with compiletime pragma.
18:57:18FromDiscord<Chronos [She/Her]> Why doesn't it work with when statements?
18:57:23FromDiscord<Chronos [She/Her]> I swear it does
18:58:24FromDiscord<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:42FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4Cb3
19:28:07FromDiscord<nivviv> sent a long message, see http://ix.io/4Cb5
19:28:51FromDiscord<Chronos [She/Her]> Ngl currently wondering if I should make something like 'traits' for Nim
19:28:56FromDiscord<Chronos [She/Her]> Idk
19:28:58FromDiscord<Chronos [She/Her]> Eh nah
19:29:53FromDiscord<etra> concepts are very similar afaik
19:37:01*ntat quit (Quit: leaving)
19:52:39*jjido joined #nim
20:01:07FromDiscord<Elegantbeef> https://github.com/beef331/traitor PRs welcome 😛↵(@Chronos [She/Her])
20:02:11FromDiscord<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:19FromDiscord<shalokshalom> In reply to @Elegantbeef "https://github.com/beef331/traitor PRs welcome 😛": Genius name
20:13:24FromDiscord<shalokshalom> i give you that
20:17:21FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "https://github.com/beef331/traitor PRs welcome 😛": Interesting
20:19:08FromDiscord<Elegantbeef> The traitor1 branch has more accessible macros, but is also not a trait system really but an interface system
20:21:20FromDiscord<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:38FromDiscord<m4ul3r> Are binaries larger with nim 2.0 compared to 1.6?
21:45:47FromDiscord<Elegantbeef> That's easy enough to test
21:46:29FromDiscord<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:52FromDiscord<Elegantbeef> Hello world using refc on 1.6.14 is 92kb it's nicekb with orc on 2.0
21:47:59FromDiscord<Elegantbeef> 52kb with clang and lto
21:48:05FromDiscord<Elegantbeef> on 1.6.14 with refc
21:48:23FromDiscord<Elegantbeef> 40kb with orc, clang and lto
21:48:34FromDiscord<Elegantbeef> So for basic programs that do not use orc it's smaller 😄
21:49:57FromDiscord<m4ul3r> Must be orc, my hello world is 243kb `-d:release` on windows with mingw64\bin\gcc.exe
21:50:13FromDiscord<Elegantbeef> On what nim version?
21:50:18FromDiscord<m4ul3r> 2.0.0
21:50:31FromDiscord<Elegantbeef> Try clang or vcc i guess
21:51:45FromDiscord<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:00FromDiscord<Elegantbeef> Yea with mingw I get 349kb on 1.6.14 with refc. And 556kb with 2.0 and orc
21:53:04NimEventerNew thread by walkr: A template inside a template, see https://forum.nim-lang.org/t/10370
21:53:30FromDiscord<Elegantbeef> Though it's still smaller with orc on 1.6.14 than 2.0
21:53:36FromDiscord<m4ul3r> I'll have to go back and redownload older nim
21:53:40FromDiscord<Elegantbeef> It's smaller with orc on 1.6.14 than even refc
21:53:44FromDiscord<m4ul3r> to check
21:53:48FromDiscord<Elegantbeef> This is why you use choosenim
21:54:05FromDiscord<m4ul3r> yeaahh, i went the route of installing nim manually
21:57:17FromDiscord<.matrixagent> any performance improvments in 2.0?
21:57:43FromDiscord<.matrixagent> i dont know if its worth recompiling my production code with it since i'd need to heavily test it
21:57:46FromDiscord<Elegantbeef> Orc is default and orc can allow optimisations through move semantics
21:58:14FromDiscord<Elegantbeef> It also can be faster out of the box
21:58:22FromDiscord<Elegantbeef> Depends on the program though
21:58:56FromDiscord<.matrixagent> just websockets and some json parsing
21:59:26FromDiscord<Elegantbeef> Probably would have lower latency
21:59:48FromDiscord<Elegantbeef> Hard to say, that's one benefit of ARC atleast is that it has lower latency vs. refc
22:00:03FromDiscord<Elegantbeef> But if you're using the cycle collector that becomes tricky to guess
22:00:10FromDiscord<.matrixagent> yeah im running arc not orc
22:00:34FromDiscord<Elegantbeef> If you're running arc there is no benefit to orc
22:01:10FromDiscord<Elegantbeef> 2.0 might have arc fixes and optimisations but it'll likely be similar peformance
22:05:27rockcaveram4ul3r you can use -d:strip if you use gcc
22:06:21FromDiscord<Elegantbeef> Oh yea that gets both under 100kb
22:06:29FromDiscord<m4ul3r> yeah there are a few things to get it down, just noticed it was a little chonkier without anything
22:06:39FromDiscord<m4ul3r> not by much tbh, like 50kbish
22:06:49FromDiscord<Elegantbeef> Though 2.0 is 30kb larger
22:08:52rockcaveraif 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:55rockcaverato avoid this you can use --exceptions:setjmp or --panics:on
22:11:56FromDiscord<Festive> In reply to @rockcavera "m4ul3r you can use": What does -d:strip do?
22:12:43FromDiscord<m4ul3r> In reply to @Festive "What does -d:strip do?": strips symbols and probably a bit more
22:12:48rockcaveraremove all symbol and relocation information
22:12:51FromDiscord<Festive> Holy shit it just brought my file size down 100kb
22:13:16FromDiscord<Festive> sorcery
22:13:50rockcaverait just goes to the link to remove, it's not the nim compiler that does it, it's gcc or clang
22:14:10FromDiscord<Festive> so it's different from --opt:size?
22:14:24FromDiscord<Elegantbeef> Yes
22:14:27rockcaverayes
22:14:33FromDiscord<Festive> if opt-size doesn't take out all of the extra junk, what's it even do
22:14:48FromDiscord<m4ul3r> optimizes for size
22:14:57FromDiscord<Festive> no duh, but how
22:14:58FromDiscord<Elegantbeef> Tell the C compiler "we care about size not speed"
22:14:59rockcaverait removes "unnecessary" stuff from the executable, it doesn't interfere with the generated machine code
22:15:04FromDiscord<m4ul3r> magic
22:15:23FromDiscord<m4ul3r> gcc has a lot of magic options
22:15:31FromDiscord<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:36FromDiscord<Elegantbeef> optimising for size means not inline aggressive and other tricks that you'd generally want
22:15:42FromDiscord<Elegantbeef> no `--opt:size` is still a C flag
22:15:48FromDiscord<Festive> damn
22:15:55FromDiscord<Festive> so many flags
22:16:00rockcaveraone 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:41rockcaveraI speak in Windows, because I don't use linux to answer if the operation is the same as gcc there.
22:17:02FromDiscord<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:17FromDiscord<Elegantbeef> By default linux binaries with gcc were tremendously smaller 😄
22:17:31FromDiscord<Elegantbeef> `--opt:size -d:lto -d:strip`
22:17:44rockcavera-d:useMalloc
22:17:47rockcavera=)
22:18:04rockcavera-d:useMalloc removes Nim's memory allocator
22:18:18FromDiscord<Festive> Will my program still function if I remove it though
22:18:22FromDiscord<Elegantbeef> Of course
22:18:24FromDiscord<Festive> In reply to @Elegantbeef "`--opt:size -d:lto -d:strip`": 179kb
22:18:44FromDiscord<Festive> In reply to @rockcavera "-d:useMalloc removes Nim's memory": same thing
22:18:58FromDiscord<Festive> it seems 179kb is the lowest I can go with my program
22:19:06FromDiscord<Elegantbeef> `-d:nimAllocPagesViaMalloc` might also reduce the size enough without throwing the water out
22:19:14FromDiscord<Elegantbeef> You can get lower with `-d:danger` but that's only cause it removes bounds checks 😄
22:19:46FromDiscord<Festive> 166 😉
22:20:02FromDiscord<Festive> nim --opt:size -d:lto -d:danger -d:nimAllocPagesViaMall -d:strip c main.nim
22:20:30FromDiscord<Festive> And it still works!
22:20:36FromDiscord<Elegantbeef> Do not actually use `-d:danger`
22:20:44FromDiscord<Festive> why?
22:21:10FromDiscord<Elegantbeef> It removes all runtime safety checks
22:21:10FromDiscord<Elegantbeef> So an array out of bounds is a valid operation
22:21:22FromDiscord<Festive> Oh ok
22:21:29FromDiscord<Festive> how about -d:release
22:21:36FromDiscord<Elegantbeef> As the name implies it's dangerous
22:21:43FromDiscord<Elegantbeef> Release is fine
22:21:53NimEventerNew 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:15FromDiscord<Elegantbeef> You also might be able to get a smaller binary using a different compiler
22:22:20FromDiscord<Elegantbeef> Clang or vcc might produce smaller binaries
22:24:37rockcavera-d:useMalloc on windows reduces a hello world by 5kb
22:24:48rockcavera-d:useMalloc only works with --mm:arc/orc
22:25:11rockcavera-d:useMalloc may reduce performance
22:27:30FromDiscord<Elegantbeef> How's `-d:nimAllocPagesViaMalloc` change the binary size?
22:27:50FromDiscord<Elegantbeef> I imagine not much since the allocator is still there, but it doesnt use mmap or similar
22:29:46rockcaverareduced about 500bytes here
22:30:12FromDiscord<Elegantbeef> Yea about what I expected 😄
22:31:20rockcavera512 bytes, I believe =)
22:37:39*ajunior joined #nim
22:44:04FromDiscord<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:27FromDiscord<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…)