00:30:31 | * | derpydoo quit (Ping timeout: 255 seconds) |
00:53:59 | * | mahlon quit (Ping timeout: 264 seconds) |
00:55:53 | * | mahlon joined #nim |
01:04:03 | * | rockcavera quit (*.net *.split) |
01:04:03 | * | cm quit (*.net *.split) |
01:04:03 | * | dtomato quit (*.net *.split) |
01:04:03 | * | tinytoast quit (*.net *.split) |
01:04:03 | * | attah quit (*.net *.split) |
01:04:28 | * | end quit (*.net *.split) |
01:04:28 | * | alice quit (*.net *.split) |
01:04:28 | * | tk quit (*.net *.split) |
01:04:28 | * | jkl quit (*.net *.split) |
01:04:29 | * | nisstyre quit (*.net *.split) |
01:04:29 | * | om3ga quit (*.net *.split) |
01:04:29 | * | droidrage quit (*.net *.split) |
01:04:29 | * | NimEventer quit (*.net *.split) |
01:04:29 | * | FromDiscord quit (*.net *.split) |
01:04:29 | * | lucerne quit (*.net *.split) |
01:04:29 | * | lumidify quit (*.net *.split) |
01:04:29 | * | marcus quit (*.net *.split) |
01:04:30 | * | _________ quit (*.net *.split) |
01:04:30 | * | oz quit (*.net *.split) |
01:04:30 | * | qwestion quit (*.net *.split) |
01:04:30 | * | Onionhammer quit (*.net *.split) |
01:05:36 | * | lucerne joined #nim |
01:05:38 | * | alice joined #nim |
01:06:31 | * | om3ga joined #nim |
01:06:31 | * | droidrage joined #nim |
01:06:31 | * | NimEventer joined #nim |
01:06:31 | * | FromDiscord joined #nim |
01:06:31 | * | lumidify joined #nim |
01:06:31 | * | marcus joined #nim |
01:06:31 | * | _________ joined #nim |
01:06:35 | * | rockcavera joined #nim |
01:06:35 | * | cm joined #nim |
01:06:35 | * | dtomato joined #nim |
01:06:35 | * | tinytoast joined #nim |
01:06:35 | * | attah joined #nim |
01:06:38 | * | _________ quit (Max SendQ exceeded) |
01:06:40 | * | oz joined #nim |
01:06:40 | * | qwestion joined #nim |
01:06:40 | * | Onionhammer joined #nim |
01:07:04 | * | _________ joined #nim |
01:07:26 | * | end joined #nim |
01:07:26 | * | tk joined #nim |
01:07:26 | * | jkl joined #nim |
01:07:26 | * | nisstyre joined #nim |
01:07:30 | * | adigitoleo quit (*.net *.split) |
01:08:40 | * | adigitoleo joined #nim |
02:11:45 | * | lucasta quit (Quit: Leaving) |
02:20:15 | * | oprypin quit (Remote host closed the connection) |
03:30:16 | * | edr quit (Quit: Leaving) |
05:56:05 | * | rockcavera quit (Remote host closed the connection) |
05:56:52 | * | cm quit (Ping timeout: 255 seconds) |
06:00:53 | * | cm joined #nim |
06:10:39 | * | oprypin joined #nim |
06:15:59 | * | notbad joined #nim |
06:24:18 | * | mahlon quit (Quit: PotatoTech) |
06:38:26 | * | azimut quit (Remote host closed the connection) |
06:39:01 | * | azimut joined #nim |
06:50:39 | * | mahlon joined #nim |
06:53:19 | * | azimut quit (Ping timeout: 240 seconds) |
07:07:23 | * | PMunch joined #nim |
07:10:24 | * | advesperacit joined #nim |
07:15:27 | * | kenran joined #nim |
07:29:04 | FromDiscord | <gogolxdong666> anyone played Vision Pro |
07:41:28 | FromDiscord | <arnetheduck> In reply to @guttural666 "or: will the compiler": this - by delaring the callback type gcsafe, you can only pass in gcsafe procedures so the caller of the callback can make assumptions - same with `{.raises.}` (right now, your callback can raise exceptions which you have to handle somewhere but you can constrain that too) |
07:58:42 | FromDiscord | <Phil> I wonder if nlvm has to be built on the system it'll run on or if you could build the binaries ahead of time and distribute them.↵I know that generally you can just distribute binaries but compiler repl stuff feels like a potentially special case |
07:58:56 | FromDiscord | <Elegantbeef> It has appimages |
07:59:32 | FromDiscord | <Phil> Which is the long version of" it doesn't have to be", check |
08:00:37 | FromDiscord | <Phil> Screwed up yesterday in trying to build with Nim 2.0 active and then it got too late for a second attempt for me, I'll try again later and maybe also check out said app image |
08:02:14 | FromDiscord | <arnetheduck> In reply to @isofruit "I wonder if nlvm": in classic toolchain terms, this is the "host" vs "target" - all compilers more or less support keeping them separate, some better than others - "normal" compilation where you compile for the same system as you're compiling on is a special case (that is usually optimised for because it's the most common one) - depending on how different the two are, you can reuse more or less of the pipeline |
08:03:39 | FromDiscord | <Phil> So basically building on your own CPU is prone to have some improvements associated |
08:03:43 | FromDiscord | <Phil> ? |
08:04:24 | FromDiscord | <arnetheduck> it's easier and faster in many cases, yes, starting with the user experience itself |
08:05:35 | FromDiscord | <Phil> Easier? I don't follow, mostly as my mental image of the scenario is downloading a binary Vs following installation instructions |
08:05:47 | FromDiscord | <Phil> What am I missing? |
08:06:13 | FromDiscord | <Phil> Note I haven't done app distribution so I'm prone to have knowledge gaps there |
08:13:14 | FromDiscord | <arnetheduck> what I mean is that if you want to build, it's easier to do so on the machine that you will run the binary on - otherwise, you're right - a precompiled binary will typically not be optimised for your specific setup.. what you're maybe thinking about is JIT, just-in-time compilation, which translates the code to machine instructions as it's being executed - this is what Java does |
08:15:39 | * | kenran` joined #nim |
08:17:22 | * | kenran quit (Ping timeout: 264 seconds) |
08:19:30 | om3ga | versions where nim was nimrod compiles in minix with minor modifications |
09:07:02 | FromDiscord | <konsumlamm> can anyone recommend a nice library for drawing stuff in a window? |
09:09:43 | PMunch | SDL? |
09:22:33 | FromDiscord | <konsumlamm> i'd prefer something that's easy to use and doesn't require any boilerplate (and that doesn't require me to first learn sdl) |
09:26:38 | PMunch | Pen and paper then |
09:27:41 | PMunch | The easiest would probably be to look at a small game library in Nim |
09:27:59 | FromDiscord | <nnsee> maybe naylib? |
09:28:26 | FromDiscord | <nnsee> also SDL is fairly boilerplate free |
09:28:36 | FromDiscord | <nnsee> as far as graphics goes |
09:39:23 | FromDiscord | <ravinder387> In reply to @nnsee "maybe naylib?": Hi Ras how's u |
09:39:58 | FromDiscord | <nnsee> hello |
09:40:00 | FromDiscord | <nnsee> i'm good, thanks |
09:40:03 | FromDiscord | <konsumlamm> naylib looks primising |
09:40:13 | FromDiscord | <konsumlamm> (edit) "primising" => "promising" |
10:08:21 | * | xutaxkamay quit (Ping timeout: 256 seconds) |
12:11:48 | * | kenran`` joined #nim |
12:13:15 | * | kenran` quit (Ping timeout: 245 seconds) |
12:15:26 | * | kenran``` joined #nim |
12:17:58 | * | kenran`` quit (Ping timeout: 264 seconds) |
12:22:45 | * | kenran``` is now known as kenran |
12:37:15 | FromDiscord | <Devon Myers> https://music.apple.com/us/album/luvhrts-ep/1716416831 |
12:37:42 | FromDiscord | <nnsee> what |
12:40:42 | FromDiscord | <nnsee> https://media.discordapp.net/attachments/371759389889003532/1179401549663977563/06-toilet-tumblr_maecpaIZ7n1qde54qo1_500.png?ex=6579a649&is=65673149&hm=a332772b671e4da50a92cd0d6dbf1354cc2c66a6128ca937be86bf98fe8e8414& |
12:56:40 | FromDiscord | <pmunch> Devon Myers\: not at all related to Nim |
13:21:24 | * | edr joined #nim |
13:26:24 | * | azimut joined #nim |
13:46:50 | FromDiscord | <apetransaction> how do i return data from a asyncronous function |
13:47:11 | FromDiscord | <apetransaction> im trying to get a sequence of bytes because im working with annoying ass compressed websockets |
13:49:23 | FromDiscord | <odexine> Just return it normally like other functions? I don’t recall if result or expression return was broken but I know return keyword would work |
13:53:40 | FromDiscord | <apetransaction> how do i access the data inside? |
13:53:45 | FromDiscord | <apetransaction> just like a normal sequence |
13:53:58 | FromDiscord | <apetransaction> or do i have to do some conversion between future and seq |
13:54:07 | PMunch | You need to await it |
13:54:14 | PMunch | Or use `waitFor` |
13:54:51 | FromDiscord | <apetransaction> sent a code paste, see https://play.nim-lang.org/#ix=4MNt |
13:55:17 | PMunch | Pretty much |
13:55:45 | PMunch | If you are in an async procedure you should use `var variableName = await asyncFunc()` |
13:57:49 | FromDiscord | <nnsee> for me, if i already have async code, it seems to somehow "spread" like an infection to the rest of the codebase, which i also rewrite to be async |
13:59:22 | PMunch | Good ol' coloring problem |
13:59:40 | PMunch | The trick is to sprinkle in some `waitFor? |
13:59:46 | PMunch | `waitFor` |
14:04:52 | NimEventer | New thread by dsrw: Enu 0.2, see https://forum.nim-lang.org/t/10700 |
14:04:59 | * | rockcavera joined #nim |
14:11:34 | FromDiscord | <odexine> Multi sync should be used more prolly, think it would reduce “the colouring problem” |
14:12:32 | FromDiscord | <nnsee> i use multisync where i can |
14:12:47 | FromDiscord | <nnsee> the sway IPC library i made when i was pretty new to nim used multisync |
14:13:02 | FromDiscord | <nnsee> should revisit it and rewrite it now that i'm not as dumb |
14:13:54 | PMunch | I actually played around with a colorless async system a while back. It would create a template for async procedures which checked if their context included an async runtime. If it did then it would call the async version and hook it into the runtime, otherwise it would create one to evaluate the async stuff in |
14:15:17 | FromDiscord | <nnsee> love my consistency... used the implicit return here but the explicit one in an analogous proc like 5 lines down https://git.dog/xx/nim-swayipc/src/branch/master/src/swayipc2/connection.nim#L19 |
14:18:18 | * | kenran quit (Remote host closed the connection) |
14:31:49 | FromDiscord | <michaelb.eth> sent a long message, see http://ix.io/4MNJ |
14:32:46 | FromDiscord | <michaelb.eth> (edit) "http://ix.io/4MNJ" => "http://ix.io/4MNK" |
14:39:19 | FromDiscord | <nnsee> very interesting, thank you michael |
14:55:31 | PMunch | Which of course is annoying when you design async systems, because it seems like a nice little optimization to do |
15:10:34 | * | PMunch quit (Quit: Leaving) |
15:37:43 | FromDiscord | <bostonboston> sent a code paste, see https://play.nim-lang.org/#ix=4MOc |
15:38:28 | FromDiscord | <bostonboston> My plan was that and then to dumpAstGen the result I wanted and past it in |
15:38:36 | FromDiscord | <bostonboston> Paste |
15:46:11 | * | jmdaemon quit (Ping timeout: 245 seconds) |
17:53:16 | NimEventer | New post on r/nim by dsrw: Enu: Learn to code and build 3D games with Nim, see https://reddit.com/r/nim/comments/186vivx/enu_learn_to_code_and_build_3d_games_with_nim/ |
18:22:54 | FromDiscord | <Phil> The package I consistently got errors for was serialization-0.2.0 |
18:23:06 | FromDiscord | <Phil> (edit) "The package I consistently got errors for was serialization-0.2.0 ... " added "and it having an invalid package name." |
18:23:44 | FromDiscord | <Phil> The above file is nim.cfg under the path `nlvm/Nim/config/nim.cfg` |
18:24:43 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/1yNoP |
18:31:17 | FromDiscord | <Phil> ... is it normal that a repl allows redefining "let" and "const" variables ? |
18:39:28 | Amun-Ra | stdin(2, 1) Error: '2' cannot be assigned to |
18:39:30 | Amun-Ra | no |
18:39:31 | FromDiscord | <jviega> The `kind` field is an enumeration, so basically stored as an int. The cases are fields that are there or not depending on the value of the `kind` field |
18:39:55 | FromDiscord | <Phil> In reply to @Amun-Ra "no": Wait, what is that in response to? |
18:39:58 | FromDiscord | <jviega> They are stored in a fixed amount of space, it's essentially a `union` in C |
18:40:24 | FromDiscord | <jviega> More precisely, it's a "discriminated union" |
18:40:29 | FromDiscord | <null_pointer0> In reply to @jviega "The `kind` field is": Okay so if I have a Node with kind nkInt it still requires as much memory to store the fields I am not using |
18:40:36 | FromDiscord | <jviega> Yes. |
18:40:41 | FromDiscord | <null_pointer0> sent a code paste, see https://paste.rs/BGuQW |
18:40:48 | FromDiscord | <jviega> If you want it to be otherwise, store a pointer to an object specific to that type |
18:40:57 | FromDiscord | <jviega> (usually a ref object) |
18:42:57 | FromDiscord | <null_pointer0> Okay I see. So this code is actually very inefficient albeit cool |
18:43:12 | FromDiscord | <jviega> What do you mean by inefficient? |
18:43:28 | FromDiscord | <jviega> Not doing heap allocations is usually more efficient than having a pointer |
18:43:35 | FromDiscord | <jviega> Space is generally cheap |
18:44:27 | FromDiscord | <null_pointer0> In reply to @jviega "Space is generally cheap": Yeah but if you have lots of objects packed together the cache misses must be insane |
18:44:34 | FromDiscord | <jviega> It's less memory efficient if you have some node types that have disproportionately large sizes relative to others, but more performant in general. |
18:44:58 | FromDiscord | <jviega> Cache misses will come when you're using references, not when you're using the union |
18:45:35 | FromDiscord | <redmechanics> does anyone know how to simulate keypresses ? |
18:46:05 | FromDiscord | <jviega> Sure, what are you trying to do exactly? |
18:46:06 | FromDiscord | <null_pointer0> In reply to @jviega "It's less memory efficient": Well I mean no matter what the "kind" is we still need to reserve space for intVal, floatVal, etc |
18:46:21 | FromDiscord | <jviega> Yes, but it will all be next to each other, in the same cache line |
18:46:48 | FromDiscord | <jviega> Fields are access by offset, and are constant time accesses |
18:46:56 | FromDiscord | <redmechanics> In reply to @jviega "Sure, what are you": type some text automatically in a notepad |
18:47:21 | FromDiscord | <jviega> If you have a reference in there, you've got the possibility of a cache miss, since your data is probably on the heap |
18:47:21 | FromDiscord | <null_pointer0> In reply to @jviega "Yes, but it will": Yeah but is this really the best way to do it |
18:48:16 | FromDiscord | <jviega> Let me refer you to: `https://github.com/crashappsec/cap10` |
18:48:32 | FromDiscord | <jviega> It will make it easy to inject data into a subprocess |
18:48:42 | FromDiscord | <michaelb.eth> In reply to @jviega "Sure, what are you": her/his previous postings here in the last week+ are suggestive of a malware author |
18:48:44 | FromDiscord | <null_pointer0> In reply to @jviega "If you have a": Fair enough, I just wanted to know if it is essentially wasting memory |
18:48:56 | FromDiscord | <jviega> @NullPointer, absolutely, unless you are in an embedded system w/ a very constrained stack |
18:49:02 | FromDiscord | <jviega> Not at all |
18:49:15 | FromDiscord | <jviega> Good to know, thanks @michaelb.eth |
18:49:30 | FromDiscord | <jviega> Absolutely meaning it's absolutely better |
18:49:41 | FromDiscord | <null_pointer0> Thank you |
18:50:51 | FromDiscord | <michaelb.eth> after I wrote that, given the frequency and interleaving of posts, I was referring to DevNitrate, not NullPointer |
18:50:55 | FromDiscord | <jviega> Generally you should only worry about optimizations of any kind (memory, performance) once you know you have a problem, because they're rarely an issue in practice. And in my experience, memory is so cheap and plentiful these days (and virtual memory works so well) that your odds of needing memory optimization approach 0 |
18:51:03 | FromDiscord | <jviega> Yeah I figured that out |
19:18:34 | FromDiscord | <Phil> I wonder if nlvm, given its a full fledged REPL, could be the basis for jupyter integration |
19:18:50 | FromDiscord | <Phil> Sadly, I know way too little about that entire area of tech |
19:19:11 | om3ga | what can be atmdotdotatslibatssystemdotnim_Init000? |
19:43:18 | * | LuxuryMode joined #nim |
19:55:52 | * | Guest36 joined #nim |
19:55:52 | * | Guest36 quit (Write error: Connection reset by peer) |
19:59:24 | FromDiscord | <System64 ~ Flandre Scarlet> Does someone knows how I can port makefiles to Nim please? |
20:08:40 | FromDiscord | <michaelb.eth> In reply to @sys64 "Does someone knows how": in your current estimately, what pros does NimScript have over Makefile syntax? |
20:08:48 | FromDiscord | <michaelb.eth> (edit) "estimately," => "estimation," |
20:08:51 | Amun-Ra | port? |
20:11:08 | Amun-Ra | something like this? https://dpaste.com/BQRNSTV43 |
20:11:30 | FromDiscord | <nervecenter> sent a long message, see https://paste.rs/FKZFJ |
20:11:34 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @michaelb.eth "in your current estimation,": I want to make bindings for SGDK |
20:23:38 | FromDiscord | <michaelb.eth> Ah, I get you. Well, depending on the dependency, sometimes it's feasible to have it as a submodule in your Nim lib, relying on nimble to resolve it in a shallow way (which it does), and in your lib's compile-time code using `gorgeEx` to invoke `make` or `cmake` or whatever. |
20:23:50 | FromDiscord | <michaelb.eth> Other times, that doesn't work out so well. |
20:25:41 | FromDiscord | <michaelb.eth> I've been meaning to explore `atlas`, to learn if it deals with that in a better way, but I've no experience with `atlas` currently |
20:30:58 | * | lucasta joined #nim |
20:30:59 | FromDiscord | <Chronos [She/Her]> In reply to @sys64 "Does someone knows how": I think @sOkam! 🫐's Confy library has that functionality somewhere? |
20:55:21 | FromDiscord | <Elegantbeef> Ideally if the compilation environment is compact enough you can just use the `{.compile.}` pragma with sub modules |
21:10:28 | FromDiscord | <yetiwizard> sent a code paste, see https://paste.rs/wbPwr |
21:12:40 | * | advesperacit quit () |
21:12:58 | FromDiscord | <yetiwizard> (edit) "https://paste.rs/MksIu" => "https://paste.rs/dQpev" |
21:22:33 | FromDiscord | <Elegantbeef> But the solution is simpler |
21:24:26 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/h137f |
21:25:00 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/SOhhs |
21:28:04 | * | targz77 joined #nim |
21:29:30 | FromDiscord | <yetiwizard> omg, this works, thanks!↵still, if somebody could show how the example above could be implemented (to learn how to make macros), I'd be grateful |
21:30:09 | FromDiscord | <yetiwizard> unbelievable how simple it was |
21:32:05 | FromDiscord | <yetiwizard> sent a code paste, see https://paste.rs/eHVP9 |
21:48:48 | FromDiscord | <griffith1deadly> In reply to @yetiwizard "I literally spent 2h": but dont forgot that copying decrease speed |
21:53:33 | FromDiscord | <yetiwizard> In my case characters is a seq of ref Character↵So I hope this won't affect speed too much |
21:56:34 | FromDiscord | <jviega> It's not always true that copying will decrease speed. Fragmenting your memory accesses can slow things down far more. |
21:56:42 | FromDiscord | <System64 ~ Flandre Scarlet> sent a long message, see https://paste.rs/01qz6 |
21:57:16 | FromDiscord | <Elegantbeef> @griffith1deadly it's copying a ref so it's negligable |
21:57:19 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @jviega "It's not always true": This is why computures tends to slow down until reboot? |
21:57:31 | FromDiscord | <Elegantbeef> It's a `gcref` + integer copy |
21:57:55 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @sys64 "Well, the thing is": Also, the MegaDrive uses an m68000 CPU |
21:59:40 | FromDiscord | <jviega> Basically if we hung out in a real room, I'd wear a t-shirt with a different slogan about optimization each day, like "When you think you mean 'optimize', you really mean, 'make worse'", or "You should take meds for your premature optimization problem" |
22:01:39 | FromDiscord | <Elegantbeef> Lol |
22:01:55 | FromDiscord | <Elegantbeef> Don't worry my optimisation suggestions are optimisation suggestions! |
22:03:40 | FromDiscord | <jviega> I don't really mean you, more the tons of people who came to a compiled language and spend way too much time worrying about performance instead of learning the language |
22:04:12 | FromDiscord | <Elegantbeef> Oh I was just joking, I do often bikeshed silly optimisations that do not likely matter in the grand scale |
22:04:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/ocivG |
22:04:55 | FromDiscord | <Elegantbeef> Like whenever I see "ref" I hiss audibly |
22:05:43 | FromDiscord | <jviega> Heh |
22:05:51 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/S5zPD |
22:08:38 | FromDiscord | <Elegantbeef> This does make me want to toy with simd to try to speed up my silly fractal toy |
22:08:39 | FromDiscord | <Elegantbeef> fractal tree toy\ |
22:09:54 | FromDiscord | <jviega> Hmm, if I've got a seq[X] in some object, is having a ref object wrapper the only reasonable way to hold a pointer to that? |
22:10:28 | FromDiscord | <Elegantbeef> Much smarter to just write a compute shader over using simd though.... |
22:10:31 | FromDiscord | <Elegantbeef> Yep that's Nim 'safe' way to hold a pointer |
22:10:51 | FromDiscord | <Elegantbeef> thankfully move semantics means that it's very little overhead to take a seq and move it to a reference |
22:12:03 | FromDiscord | <jviega> Yeah, that's a bit lame, but okay. Basically have a huge array that's getting copied way too much by tree-nodes that basically just need to know how to get to the right element in the array. |
22:12:41 | FromDiscord | <Elegantbeef> I mean you can do `myData[0].addr` but that's of course unsafe if the seq is every mutated |
22:13:32 | FromDiscord | <jviega> Yeah, and doesn't work if the sequence is empty. |
22:13:56 | FromDiscord | <Elegantbeef> View types cannot come soon enough 😄 |
22:15:37 | FromDiscord | <Elegantbeef> Works on my machine |
22:15:38 | FromDiscord | <Elegantbeef> `nim -v`? |
22:16:22 | FromDiscord | <yetiwizard> sent a code paste, see https://paste.rs/xnboF |
22:16:30 | FromDiscord | <yetiwizard> Nim Compiler Version 2.0.0 [Windows: amd64]↵Compiled at 2023-08-01 |
22:17:29 | FromDiscord | <Elegantbeef> Odd |
22:17:36 | FromDiscord | <yetiwizard> sent a code paste, see https://paste.rs/2DZN0 |
22:18:04 | FromDiscord | <yetiwizard> oh nvm |
22:18:07 | FromDiscord | <yetiwizard> it wasn't exported |
22:18:14 | FromDiscord | <yetiwizard> lol |
22:18:34 | FromDiscord | <yetiwizard> those sneaky asterisks |
22:18:40 | FromDiscord | <yetiwizard> thanks a lot! |
22:18:41 | FromDiscord | <Phil> Question, is how LLVM works basically:↵Programming Language --> LLVM-IR --> Binary↵With LLVM-IR basically being for any LLVM-based lang what C is for nim when compiling "normally" ? |
22:18:51 | FromDiscord | <Elegantbeef> Some people's children |
22:20:39 | FromDiscord | <Elegantbeef> For normal Nim it's really Nim -\> C -\> C compiler's IR -\> Binary 😄 |
22:20:41 | FromDiscord | <Elegantbeef> But yes llvm ir is a lower level IR that holds "only what is necessary" |
22:21:18 | FromDiscord | <yetiwizard> what is a good resource to learn macros? |
22:21:56 | FromDiscord | <yetiwizard> also, from a performance point of view, do you think the iterator version or the macro version is "better"? |
22:22:37 | FromDiscord | <Phil> From a performance point of view unroll allllll the loops you can. Not sure if iterators can do that, macros can |
22:22:44 | FromDiscord | <griffith1deadly> In reply to @yetiwizard "what is a good": practice and echo some code like ast |
22:23:45 | FromDiscord | <jviega> Iterators generally optimize for memory, often at the expense of complexity and speed, which is usually wrong. |
22:24:02 | FromDiscord | <yetiwizard> echo result.repr is really useful for that, true |
22:24:12 | FromDiscord | <ElegantBeef> The iterator and macro and template version are identical |
22:24:22 | FromDiscord | <ElegantBeef> The iterator is the most compiler friendly |
22:24:30 | FromDiscord | <ElegantBeef> It does not have to resem a tree every time |
22:24:40 | FromDiscord | <Phil> As for learning macros:↵1) Understand that every kind of statement in Nim is a pattern of NimNodes↵2) Look at the NimNode patterns of some statements and try to write your own small DSL where the user inputs weird stuff and you transform it into the statement you desire |
22:24:46 | FromDiscord | <griffith1deadly> In reply to @yetiwizard "echo result.repr is really": dumpTree best |
22:24:47 | FromDiscord | <Phil> (edit) "desire" => "desire. That'll teach you a lot" |
22:25:07 | FromDiscord | <Phil> dumpTree and dumpAstGen both are useful for this imo |
22:25:07 | FromDiscord | <jviega> I think you just just return a big chunk of consecutive items and loop over them most of the time 🙂 |
22:25:24 | FromDiscord | <ElegantBeef> I'd say iterators optimise for speed and memory |
22:26:19 | FromDiscord | <yetiwizard> oh, I didn't know about dumpTree, seems really useful for that |
22:26:28 | FromDiscord | <jviega> Eh, the extra state people tend to keep can often lead to extra cache misses |
22:26:30 | FromDiscord | <ElegantBeef> You do not have to allocate a sequence nor add to it a lot growing it causing more allocations and copy |
22:26:45 | FromDiscord | <ElegantBeef> Depends on what you're doing and how you're doing it |
22:27:01 | FromDiscord | <jviega> You also then basically have a view, instead of worrying about mutating white you work |
22:27:08 | FromDiscord | <Phil> And after the fundamentals (basically being able to replicate statements with NimNodes) you can look into nicer tools that allow you to generate some code more quickly like quote do |
22:27:14 | FromDiscord | <ElegantBeef> Also depends on whether we're talking about closure or inline iterators |
22:27:16 | FromDiscord | <Phil> IIRC, I don't tend to use those |
22:27:21 | FromDiscord | <Phil> (edit) "IIRC," => "IIRC at least," |
22:27:41 | FromDiscord | <Phil> (edit) "do" => "do, or the micros package" |
22:27:45 | FromDiscord | <ElegantBeef> Speaking of macros phil I did make that partial call macro without using micros it's dead simple with just std/macros 😄 |
22:27:52 | FromDiscord | <yetiwizard> In reply to @isofruit "From a performance point": can you unroll it with macros if you don't know the number of elems at compile time? |
22:27:58 | FromDiscord | <ElegantBeef> Of course not |
22:28:02 | FromDiscord | <Phil> In reply to @yetiwizard "can you unroll it": Nope |
22:28:03 | FromDiscord | <ElegantBeef> Loop unrolling is a static operation |
22:28:32 | FromDiscord | <Phil> In reply to @elegantbeef "Speaking of macros phil": The curry thing? |
22:28:41 | FromDiscord | <ElegantBeef> It's not currying actually, but yea |
22:29:01 | FromDiscord | <ElegantBeef> Currying and partial call evaluation are very similar but not the same |
22:29:06 | FromDiscord | <ElegantBeef> <https://github.com/beef331/nimtrest/blob/master/tumeric.nim> |
22:29:14 | FromDiscord | <ElegantBeef> I did give it a nice name when I threw it in my dumpster fire repo |
22:29:21 | FromDiscord | <yetiwizard> ok now I have some info to work with, thanks a lot for the help and info everyone :D |
22:29:56 | FromDiscord | <ElegantBeef> I will say that Nim gives you many ways to avoid using macros and that is generally the better path |
22:29:58 | FromDiscord | <Chronos [She/Her]> In reply to @elegantbeef "Of course not": Not if you're a quitter! Embed the compiler into the program! /j |
22:30:09 | FromDiscord | <yetiwizard> another thing I was wondering:↵is it possible to have templates with default params like in procs? |
22:30:27 | FromDiscord | <ElegantBeef> It is, but it's not ideal |
22:30:39 | FromDiscord | <ElegantBeef> Generally just overloads are used |
22:30:41 | FromDiscord | <yetiwizard> cause rn I'm doing overloads |
22:30:48 | FromDiscord | <yetiwizard> kk |
22:31:01 | FromDiscord | <Phil> Generally overloads > Default parameters |
22:31:35 | FromDiscord | <Phil> There are some scenarios where default parameters are more expressive but I really don't recall them all that much |
22:35:39 | FromDiscord | <ElegantBeef> `cast[T](...)` would get rid of the warning |
22:36:39 | FromDiscord | <yetiwizard> sent a code paste, see https://paste.rs/KVHse |
22:36:43 | FromDiscord | <Phil> I mean you pretty much can't unless you disable that warning.↵The only reason cast gets rid of said warning as well is because cast is no-mans-land in terms of safety |
22:37:08 | FromDiscord | <ElegantBeef> Almost like that's a way to get rid of the warning 😄 |
22:37:30 | FromDiscord | <ElegantBeef> You also can do `{.warning[HoleEnumConv]: off.}` and on |
22:37:34 | FromDiscord | <yetiwizard> where would I put that cast? |
22:37:35 | FromDiscord | <Chronos [She/Her]> My comment was ignored 😔✊ |
22:37:38 | FromDiscord | <ElegantBeef> Or whatever that name |
22:37:49 | FromDiscord | <ElegantBeef> Around the expression giving the warning instead of a type conversion |
22:38:04 | FromDiscord | <ElegantBeef> In reply to @chronos.vitaqua "My comment was ignored": I read it but didnt have anything to respond with |
22:38:15 | FromDiscord | <Chronos [She/Her]> Yeah that's fair lol |
22:38:28 | FromDiscord | <Phil> I read it and decided to ignore it specifically out of sheer pettiness for that is me. |
22:38:40 | FromDiscord | <yetiwizard> In reply to @elegantbeef "You also can do": is this always per file/module? |
22:38:46 | FromDiscord | <ElegantBeef> Per project |
22:38:55 | FromDiscord | <ElegantBeef> So turn it off inside the block then turn it back on |
22:39:16 | FromDiscord | <Chronos [She/Her]> I'd imagine that's how it'd be done, at least according to Beef |
22:39:28 | FromDiscord | <Chronos [She/Her]> In reply to @isofruit "I read it and": Shame 😔 |
22:39:35 | FromDiscord | <ElegantBeef> That or the warning disable |
22:39:46 | FromDiscord | <Chronos [She/Her]> Eh, I think this is more convenient |
22:39:53 | FromDiscord | <yetiwizard> hmmm, disabling the warning in a template and enabling it again is problematic |
22:39:57 | FromDiscord | <ElegantBeef> It uses `cast` so must be obliterated |
22:39:58 | FromDiscord | <Chronos [She/Her]> I dislike the fact the warning is turned off for the entire project |
22:40:14 | FromDiscord | <ElegantBeef> No one is saying turn it off for the entire project permanently |
22:40:21 | FromDiscord | <yetiwizard> cause I'd have to enable it where I use it, rather than doing it in the template |
22:40:36 | FromDiscord | <ElegantBeef> You can renable it inside the template |
22:40:47 | FromDiscord | <ElegantBeef> `T(0)` |
22:40:55 | FromDiscord | <ElegantBeef> Read the line number kids |
22:41:12 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://paste.rs/kKrDL |
22:41:14 | FromDiscord | <Chronos [She/Her]> I remember trying to use `push` and `pop` to disable an unused import warning but I couldn't figure out why the code kept displaying it, until I decided I could live with it :P |
22:41:26 | FromDiscord | <ElegantBeef> Unused imports is done after module is semd |
22:41:40 | FromDiscord | <ElegantBeef> You cannot disable it's warning anywhere but project wide |
22:41:41 | FromDiscord | <Chronos [She/Her]> Ah so that's why then? |
22:41:45 | FromDiscord | <ElegantBeef> Well think about it |
22:41:55 | FromDiscord | <Chronos [She/Her]> Shame |
22:41:56 | FromDiscord | <ElegantBeef> To know if a module is unused you have to sem the entire module |
22:42:05 | FromDiscord | <ElegantBeef> If you disable the warning inside the module then enable it inside the module |
22:42:14 | FromDiscord | <Chronos [She/Her]> In reply to @elegantbeef "To know if a": To check if it's unused within a specific file, though? |
22:42:22 | FromDiscord | <ElegantBeef> Right |
22:42:29 | FromDiscord | <ElegantBeef> But it happens after the entire module is sem'd |
22:42:40 | FromDiscord | <ElegantBeef> So as it sems it disables/enables the warning |
22:42:42 | FromDiscord | <Chronos [She/Her]> https://github.com/Yu-Vitaqua-fer-Chronos/NULID/blob/main/src/nulid/private/constants.nim#L40 |
22:42:43 | FromDiscord | <Chronos [She/Her]> Pain |
22:42:45 | FromDiscord | <ElegantBeef> Then it hits the end of the file |
22:42:48 | FromDiscord | <ElegantBeef> And it's not used |
22:42:50 | FromDiscord | <yetiwizard> sent a code paste, see https://paste.rs/gFhf7 |
22:43:04 | FromDiscord | <Chronos [She/Her]> Oh well |
22:43:22 | FromDiscord | <ElegantBeef> What are you trying to prevent it from warning? |
22:43:26 | FromDiscord | <ElegantBeef> Those imports? |
22:43:29 | FromDiscord | <Chronos [She/Her]> I get why it happens now, but it's frustrating |
22:43:35 | FromDiscord | <Chronos [She/Her]> In reply to @elegantbeef "Those imports?": Yep |
22:44:12 | FromDiscord | <Chronos [She/Her]> `HasJsony` and `HasDebby` purely exists so that I can just check a variables rather than using a `when compiles` check (because I just prefer it) |
22:44:59 | FromDiscord | <Chronos [She/Her]> Oh that's a good idea |
22:45:43 | FromDiscord | <ElegantBeef> Alternatively just put the unused switch around the import of `constants` |
22:46:22 | FromDiscord | <ElegantBeef> sent a code paste, see https://paste.rs/Xlux4 |
22:47:03 | FromDiscord | <ElegantBeef> sent a code paste, see https://paste.rs/iAbPO |
22:51:02 | FromDiscord | <ElegantBeef> Me like CTE |
22:53:04 | FromDiscord | <ElegantBeef> sent a code paste, see https://paste.rs/FbVPj |
23:36:12 | * | xutaxkamay joined #nim |
23:43:37 | * | jmdaemon joined #nim |
23:46:31 | * | notbad quit (Remote host closed the connection) |