00:20:27 | * | lucasta joined #nim |
00:51:15 | * | krux02 quit (Remote host closed the connection) |
01:30:13 | FromDiscord | <etra> does https://play.nim-lang.org loads for anyone? |
01:30:34 | FromDiscord | <etra> I'm getting Gateway time-out: Error 504 |
01:30:38 | FromDiscord | <Yardanico> no, it's down again :9 |
01:30:39 | FromDiscord | <Yardanico> (edit) ":9" => ":(" |
01:30:41 | FromDiscord | <Elegantbeef> Pmunch really needs to get a server that's a bit more round than a potato, maybe a mango |
01:30:49 | FromDiscord | <Yardanico> i mean, it's not his server |
01:30:54 | FromDiscord | <Yardanico> it's whatever Nim gets for free from DO |
01:31:00 | FromDiscord | <Yardanico> iirc it has 1gb ram? but i might be totally wrong |
01:31:05 | FromDiscord | <Elegantbeef> Right, same difference 😛 |
01:31:16 | FromDiscord | <Yardanico> @etra there are some alternatives though |
01:31:30 | FromDiscord | <Yardanico> e.g. https://wandbox.org/ |
01:31:36 | FromDiscord | <etra> In reply to @Elegantbeef "Pmunch really needs to": if GlaDOS could survive on a potato... |
01:31:47 | FromDiscord | <Yardanico> seems like they removed nim devel though, but they do have latest stable |
01:32:09 | FromDiscord | <etra> I wanted to access an old play I did, is there a way? |
01:32:16 | FromDiscord | <Yardanico> yes, do you have a url? |
01:32:20 | FromDiscord | <etra> yes |
01:32:21 | FromDiscord | <Yardanico> nim playground just uses ix.io |
01:32:28 | FromDiscord | <Elegantbeef> it's stored on `ix.io` so just drop the ... |
01:32:33 | FromDiscord | <Yardanico> http://ix.io/yourid |
01:32:56 | FromDiscord | <Yardanico> the ID is what comes after `#ix=` |
01:33:07 | FromDiscord | <etra> oh, there it goes, thanks! |
02:12:25 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1099880496596516924/image.png |
02:12:32 | FromDiscord | <Yardanico> finally, actual cool graphs |
02:12:50 | FromDiscord | <Yardanico> (it's not s |
02:12:53 | FromDiscord | <Yardanico> (edit) "s" => "seconds actually)" |
02:14:31 | FromDiscord | <Elegantbeef> It's years right? |
02:14:37 | FromDiscord | <Yardanico> its relative to the baseline :) |
02:14:49 | FromDiscord | <Yardanico> which is 1.1 seconds here (1 as a baseline) |
02:33:14 | FromDiscord | <Yardanico> with seconds, I use lowestValue 0.9 as the baseline https://media.discordapp.net/attachments/371759389889003532/1099885731675119796/image.png |
02:41:43 | FromDiscord | <ringabout> @Yardanico Nice work! Would be a great boost for Nim CI? |
02:41:48 | FromDiscord | <ringabout> (edit) "@Yardanico Nice work! Would ... be" added "it" |
02:42:32 | FromDiscord | <Yardanico> In reply to @ringabout "<@177365113899057152> Nice work! Would": I mean, PGO can be useful, but I fear it might trigger some hard-to-find bugs in Nim itself |
02:42:44 | FromDiscord | <Yardanico> also i haven't built -d:release pgo yet, which is what should be used for CI |
02:42:53 | FromDiscord | <Yardanico> and even then, it'll only speedup the nim part, not the C compilation |
02:43:12 | FromDiscord | <Yardanico> and then x2 for each new CI we'll have to build a new PGO'd compiler, and doing that takes quite a long time too |
02:43:37 | FromDiscord | <Yardanico> basically PGO'ing a compiler is useful when you'll be using the same binary a lot of times afterwards, but in CI you need to have the fresh compiler each run |
02:46:11 | FromDiscord | <ringabout> I see |
02:46:44 | FromDiscord | <Yardanico> honestly I feel like pgo compiler is most useful for actual end users, especially people who write/use libraries that have a lot of heavy macro code |
02:47:06 | FromDiscord | <Yardanico> nim-regex, polymorth, arraymancer, that's why I actually use those projects for profiling |
02:47:24 | FromDiscord | <Elegantbeef> Not using CPS programs? |
02:47:42 | FromDiscord | <Yardanico> ? |
02:48:10 | FromDiscord | <Elegantbeef> CPS is quite macro heavy aswell so it could also be a good candidate to PGO in/test |
02:48:19 | FromDiscord | <Yardanico> ohh you mean the lib, sure |
02:48:28 | FromDiscord | <Yardanico> if it compiles with devel with no issues it's just 1 more line in the const array |
02:48:39 | FromDiscord | <Yardanico> now, the hardest question: what colors do I pick for gcc and clang |
02:48:41 | FromDiscord | <Yardanico> in the graph |
02:49:13 | FromDiscord | <Elegantbeef> Brown for the gnu and silver for the dragon |
02:50:10 | FromDiscord | <Yardanico> you think? https://media.discordapp.net/attachments/371759389889003532/1099889996053356574/image.png |
02:50:17 | FromDiscord | <Elegantbeef> Yea |
02:50:30 | FromDiscord | <Yardanico> okay, but i'll make that brown a bit lighter |
03:02:20 | NimEventer | New post on r/nim by RememberToBackupData: How do I do a nested sort on a seq of objects, some ascending and others descending?, see https://reddit.com/r/nim/comments/12x0peq/how_do_i_do_a_nested_sort_on_a_seq_of_objects/ |
03:40:49 | FromDiscord | <Yardanico> uhh |
03:40:56 | FromDiscord | <Yardanico> i think my graphs are actually useless |
03:41:06 | FromDiscord | <Yardanico> they are all literally almost the same each time |
03:41:14 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1099902845769232424/image.png https://media.discordapp.net/attachments/371759389889003532/1099902846025072700/image.png https://media.discordapp.net/attachments/371759389889003532/1099902846297702542/image.png |
03:41:30 | FromDiscord | <Yardanico> basically the different compiler binaries are faster by a constant x that doesn't actually get changed a lot depending on the project |
03:55:04 | FromDiscord | <Yardanico> i want to find some nim project that won't follow the same graphs aaa |
04:11:06 | * | ltriant joined #nim |
04:12:25 | * | ltriant_ quit (Ping timeout: 240 seconds) |
04:34:25 | * | azimut joined #nim |
04:44:07 | NimEventer | New thread by Yardanico: Small experiment with compiling the Nim compiler with PGO, see https://forum.nim-lang.org/t/10128 |
05:24:03 | * | advesperacit joined #nim |
05:58:37 | * | m5zs7k quit (Ping timeout: 255 seconds) |
05:58:37 | * | om3ga quit (Ping timeout: 255 seconds) |
05:58:37 | * | droidrage quit (Ping timeout: 255 seconds) |
05:58:43 | * | om3ga_ joined #nim |
05:58:52 | * | m5zs7k_ joined #nim |
06:07:15 | FromDiscord | <qb> Is this still the way to go or are there more elegant ways yet to run synchronous code in a async event loop? https://forum.nim-lang.org/t/6889#43141 |
06:07:54 | * | m5zs7k_ is now known as m5zs7k |
06:11:58 | FromDiscord | <Dudugz> So what you want is to asyncify a sync proc? |
06:12:21 | FromDiscord | <Dudugz> I think if so then it seems like the only viable solution at the moment |
06:14:07 | FromDiscord | <Yardanico> In reply to @qb "Is this still the": Maybe https://github.com/yglukhov/asyncthreadpool , haven't tried |
06:14:18 | FromDiscord | <Yardanico> But that code in the forum post looks simple enough |
06:15:06 | FromDiscord | <Dudugz> The question is why? |
06:15:29 | FromDiscord | <Yardanico> ? |
06:15:36 | FromDiscord | <Dudugz> Wouldn't it be simpler to have an async function and call it and use await? The code will keep waiting anyway. |
06:15:45 | FromDiscord | <Yardanico> Uhh no |
06:16:04 | FromDiscord | <Yardanico> If you have synchronous code that takes a while to execute, it'll block the entire program |
06:16:05 | FromDiscord | <qb> Thanks 🙂 |
06:16:12 | FromDiscord | <Yardanico> Async is single threaded |
06:16:21 | FromDiscord | <Yardanico> In Nim by default |
06:16:29 | FromDiscord | <Dudugz> In reply to @Yardanico "If you have synchronous": Yes, that makes sense, I'm talking about making the function async |
06:16:36 | FromDiscord | <Yardanico> but that won't change anything |
06:16:45 | FromDiscord | <Yardanico> If it has synchronous code |
06:16:55 | FromDiscord | <Dudugz> You can use await sleepAsync(0) to not block |
06:16:58 | FromDiscord | <Yardanico> You can only make IO stuff into async |
06:17:03 | FromDiscord | <Yardanico> In reply to @Dudugz "You can use await": Again, no |
06:17:09 | FromDiscord | <Dudugz> Hm |
06:17:20 | FromDiscord | <Yardanico> Even if you define it as an async function and it has sync blocking code, it'll block |
06:17:29 | FromDiscord | <Yardanico> In fact that's how async Nim code always works |
06:17:45 | FromDiscord | <Dudugz> well yes that makes sense |
06:17:48 | FromDiscord | <Elegantbeef> Async in Nim only is non blocking if the code has a place to return the cpu |
06:17:52 | FromDiscord | <Yardanico> At the singular point in time there's only one line running |
06:18:12 | FromDiscord | <Elegantbeef> But even then it's technically blocking if we want to be pedantic 😄 |
06:18:22 | FromDiscord | <Yardanico> it just switches between async coroutines fast enough when they wait for IO |
06:19:42 | FromDiscord | <Dudugz> So if you want to avoid this is it better to use spawn? |
06:20:16 | madprops | can github actions compile nim programs? |
06:20:22 | FromDiscord | <Yardanico> if you have blocking code that'll run for quite some time and you want async stuff to work, you use threads |
06:20:27 | FromDiscord | <Yardanico> In reply to @madprops "can github actions compile": Of course |
06:20:36 | madprops | whoa. im just learning about this |
06:20:40 | FromDiscord | <Dudugz> In reply to @madprops "can github actions compile": I think so, I set up a workflow to run my tests |
06:20:44 | FromDiscord | <Yardanico> They're just CI |
06:20:51 | FromDiscord | <Yardanico> That run VMs |
06:21:02 | FromDiscord | <Dudugz> In reply to @Yardanico "if you have blocking": Ok thx |
06:21:04 | FromDiscord | <Yardanico> You can run anything on them really, and for Nim there's a ready to use template |
06:21:11 | madprops | so github will compiled optimized binaries for free? |
06:21:20 | madprops | compile* |
06:21:33 | FromDiscord | <Yardanico> it you don't go over limits, yes |
06:21:34 | FromDiscord | <Yardanico> https://github.com/marketplace/actions/setup-nim-environment |
06:22:03 | FromDiscord | <Yardanico> <https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#usage-limits> |
06:22:42 | FromDiscord | <Dudugz> Hmm I wonder if it's possible to build in a private repository and publish the artifact in another repository which is public. |
06:22:52 | FromDiscord | <Yardanico> it is |
06:23:11 | FromDiscord | <Dudugz> well this will come in handy 😁 |
06:24:11 | FromDiscord | <Dudugz> I have a project where the code is private for security reasons, but exposing the binaries is fine. |
06:24:41 | FromDiscord | <Elegantbeef> "code is private for security reasons" |
06:24:55 | FromDiscord | <Elegantbeef> Cmon obscurity is not security |
06:25:12 | FromDiscord | <Dudugz> Hm, it's not for the code itself, the code can be done by anyone |
06:26:03 | FromDiscord | <Dudugz> In reply to @Elegantbeef "Cmon obscurity is not": I know, but there are contributors, I'm not the only one on the project because I'm not able to fix all the edge-cases by myself. |
06:26:17 | FromDiscord | <Dudugz> (edit) "fix" => "fix/catch" |
06:26:52 | FromDiscord | <Dudugz> This is also why exposing the binaries is safe, anyone can reverse engineer the binaries. |
06:27:29 | FromDiscord | <Elegantbeef> I'm just too biased, I think any proprietary software is unsafe |
06:27:30 | FromDiscord | <Dudugz> But I'm also trying to change that, I'm going to talk to people to make the repository public. |
06:27:54 | FromDiscord | <Elegantbeef> closed source proprietary\ |
06:28:13 | FromDiscord | <Dudugz> Hm, well, if you don't know what the software does then it makes sense. But sometimes I think people are too scared. |
06:28:25 | FromDiscord | <Elegantbeef> Looks at lastpass |
06:29:25 | FromDiscord | <Dudugz> Just to be ironic, the repository is private with an MIT license lol |
06:29:41 | FromDiscord | <Dudugz> I mean, anyone with access to the code can edit the code. |
06:29:44 | FromDiscord | <Elegantbeef> Doesnt that technically put you at risk |
06:30:08 | FromDiscord | <Elegantbeef> If the code is released accidentally you have no legal basis to quell it |
06:30:54 | FromDiscord | <Dudugz> In reply to @Elegantbeef "Doesnt that technically put": Yup, but there's no point in making the code private too, just tweaking a few things here and there. |
06:31:54 | FromDiscord | <Dudugz> About the license, I personally prefer that people have the freedom to do what they want with what I develop. I think it's the feeling of those who have participated in modding communities |
06:32:52 | FromDiscord | <Elegantbeef> So yea i sorta agree |
06:32:55 | FromDiscord | <Elegantbeef> I have the view that all software should be free and aside from paths to profit like games, it should be permissively licensed |
06:35:09 | FromDiscord | <Dudugz> Yea, but games I understand why they are private. Hackers would love to exploit any security holes they can identify. |
06:35:38 | FromDiscord | <Dudugz> and as you said there is the issue that they can be paid for, it makes no sense to pay for software you can get for free. |
06:37:29 | FromDiscord | <Elegantbeef> Hackers isnt an issue |
06:37:35 | FromDiscord | <Elegantbeef> Oh noes my single player game has hackers |
06:37:49 | FromDiscord | <Dudugz> Not for single player but for multi player |
06:38:09 | FromDiscord | <Dudugz> Nobody cares if a singleplayer game gets hacked lol it doesn't affect the game ecosystem. |
06:38:32 | FromDiscord | <Elegantbeef> Meh hackers still get by even anticheat so it's not like source would do anything but show issues faster |
06:39:26 | FromDiscord | <Dudugz> Maybe, Riot Games was fancy with Vanguard running at the kernel level and hackers are already managing to bypass it. |
06:39:54 | FromDiscord | <Elegantbeef> I mean fallguys is a prime example of a poorly designed game 😄 |
06:39:54 | madprops | pasting that into the yml file didn't work https://i.imgur.com/Qbh8TCh.jpg |
06:39:59 | madprops | says theer's an error in line 1 |
06:40:23 | FromDiscord | <Elegantbeef> It's a networked physics game that had hackers and needed an anticheat, instead of just being designed with server authority and client interpolation |
06:40:41 | FromDiscord | <Dudugz> yea |
06:41:16 | FromDiscord | <Dudugz> In reply to @madprops "pasting that into the": Well because it does, YAML works with indentation and for me everything seems to be in the same column |
06:41:28 | madprops | it says: Invalid workflow file |
06:41:39 | madprops | .github/workflows/github-action.yml |
06:41:44 | madprops | i used a custom name |
06:41:46 | FromDiscord | <Dudugz> Oh, did you just paste this? |
06:41:56 | madprops | yeah |
06:42:15 | FromDiscord | <Dudugz> It's not a matter of the name, it's a matter of not being correctly configured, it would be better to have created a workflow on Github itself |
06:42:33 | madprops | oh |
06:42:38 | FromDiscord | <Dudugz> https://github.com/dark-mice/core/blob/master/.github/workflows/run_tests.yml |
06:42:50 | FromDiscord | <Dudugz> look at mine and you will see what i mean |
06:43:10 | madprops | i see so it adds a bunch of other stuff |
06:44:02 | * | lucasta quit (Remote host closed the connection) |
06:44:16 | FromDiscord | <Dudugz> Yup, it was better to have created it on github to come with the default configuration and then just paste the steps there |
06:44:39 | * | lucasta joined #nim |
06:44:49 | madprops | i deleted the dir |
06:44:53 | madprops | trying again |
06:46:01 | * | lucasta quit (Client Quit) |
06:47:36 | madprops | not sure this helps https://docs.github.com/en/actions/quickstart |
06:48:01 | FromDiscord | <Dudugz> clicking on Actions in your repository you will see the New workflow button to create a default file. https://media.discordapp.net/attachments/371759389889003532/1099949852328198235/Screenshots_2023-04-24-02-47-17.png |
06:48:55 | FromDiscord | <Dudugz> In reply to @madprops "not sure this helps": Yeah that's what helped me understand GA lol, what I posted above was my first time creating a workflow on github |
06:50:23 | madprops | so i have this now https://github.com/madprops/goldie/blob/main/.github/workflows/nim.yml |
06:50:31 | madprops | now add the thing i pasted there i guess |
06:51:14 | FromDiscord | <Dudugz> yup what you posted goes inside the steps |
06:53:34 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4u9o |
06:53:49 | FromDiscord | <Dudugz> Then ``nimble test`` compiles and runs the binary in the folder |
06:54:09 | madprops | think the playground is broken |
06:54:28 | madprops | but i got a green indicator on the build |
06:54:28 | FromDiscord | <Dudugz> I think they were saying earlier that it was off the air |
06:54:37 | FromDiscord | <Dudugz> (edit) removed "the air" |
06:55:11 | madprops | i have the idea action builds are automatically available on my repo to anyone |
06:55:19 | FromDiscord | <Dudugz> Wait, what are you talking about exactly? |
06:55:44 | madprops | https://i.imgur.com/c826N0S.jpg |
06:56:18 | FromDiscord | <Dudugz> If you talk about the workflow you just installed Nim in the vm I think, you need to add commands to do what you want |
06:56:29 | madprops | ahh |
06:56:50 | madprops | i'll check your repo again |
06:56:51 | FromDiscord | <Dudugz> Yes, this green mark indicates that the workflow ran successfully |
06:58:13 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4u9p |
06:58:41 | FromDiscord | <Dudugz> (edit) "https://play.nim-lang.org/#ix=4u9p" => "https://play.nim-lang.org/#ix=4u9q" |
06:58:46 | madprops | im running a CI job |
06:58:49 | madprops | in progress |
06:59:18 | * | Notxor joined #nim |
06:59:24 | madprops | sorry i can't access those texts |
07:01:07 | madprops | i'll try this later |
07:01:11 | madprops | ate too much pizza |
07:36:33 | FromDiscord | <ricky> In reply to @Dudugz "Maybe, Riot Games was": DMA gang |
07:37:11 | FromDiscord | <Dudugz> What is DMA? |
07:40:31 | FromDiscord | <Rika> direct memory access i assume> |
07:40:34 | FromDiscord | <Rika> (edit) "assume>" => "assume?" |
07:41:18 | FromDiscord | <Z3NTL3> sent a code paste, see https://play.nim-lang.org/#ix=4u9v |
07:41:19 | FromDiscord | <Z3NTL3> why does this not workj |
07:41:29 | FromDiscord | <Rika> openarray isnt a "concrete type" |
07:41:29 | FromDiscord | <Z3NTL3> openArray[T]↵..? |
07:41:34 | FromDiscord | <Z3NTL3> ooh |
07:41:36 | FromDiscord | <Rika> aka you cant use it as a variable type |
07:41:42 | FromDiscord | <Z3NTL3> but i need to |
07:41:47 | FromDiscord | <Rika> why |
07:41:59 | FromDiscord | <Z3NTL3> sent a code paste, see https://play.nim-lang.org/#ix=4u9w |
07:41:59 | FromDiscord | <Rika> seqs are openarrays |
07:42:00 | FromDiscord | <Z3NTL3> bcs i want to use this proc |
07:42:03 | FromDiscord | <Z3NTL3> In reply to @Rika "seqs are openarrays": AHH |
07:42:06 | FromDiscord | <Z3NTL3> oke ty |
07:42:09 | FromDiscord | <Rika> arrays are openarrays too |
07:42:27 | FromDiscord | <Z3NTL3> k |
07:42:29 | FromDiscord | <Z3NTL3> didnt know |
07:42:48 | FromDiscord | <Z3NTL3> so openarray is just the base ref for all kind of arrays |
07:42:51 | FromDiscord | <Z3NTL3> seqs, and normal arr |
07:43:19 | FromDiscord | <Rika> pretty much |
07:43:28 | FromDiscord | <Rika> its more complex than that but for now you can think of it that way |
07:48:09 | FromDiscord | <Z3NTL3> sent a code paste, see https://play.nim-lang.org/#ix=4u9y |
07:48:10 | FromDiscord | <Z3NTL3> i am trying something to test |
07:48:16 | FromDiscord | <Z3NTL3> but i cant grab the returned value from the thread |
07:48:31 | FromDiscord | <Z3NTL3> the dt in the for loop gives me an err |
07:48:59 | FromDiscord | <Z3NTL3> "message": "expected: ':', but got: 'keyword var'", |
07:49:26 | FromDiscord | <Z3NTL3> nvm works |
07:49:32 | FromDiscord | <Z3NTL3> sent a code paste, see https://play.nim-lang.org/#ix=4u9z |
07:49:39 | FromDiscord | <Z3NTL3> bruh i didnt see that i missed the semi colon on the .pairs()<> |
08:09:03 | FromDiscord | <ricky> In reply to @Rika "direct memory access i": yeh i'm on that life 😎 |
08:09:19 | FromDiscord | <ricky> `ring -666` shit |
08:38:49 | FromDiscord | <Z3NTL3> when I do spawnX i get gcsafe call expression |
08:38:57 | FromDiscord | <Z3NTL3> spawnX(test()) |
08:39:00 | FromDiscord | <Z3NTL3> whats wrong with this |
08:48:55 | FromDiscord | <Z3NTL3> fixed it by making it gc safe |
09:06:12 | * | kenran joined #nim |
09:24:25 | * | kenran quit (Ping timeout: 240 seconds) |
09:24:29 | * | Notxor quit (Remote host closed the connection) |
09:26:30 | * | Notxor joined #nim |
09:30:29 | * | fredrikhr92 is now known as fredrikhr |
10:01:39 | FromDiscord | <Chronos [She/Her]> I'm gonna be making a `DataProvider` type, but I want it so I don't need to know the exact type, how does the streams API do it? |
10:07:58 | FromDiscord | <Rika> Streams uses OOP |
10:07:59 | FromDiscord | <Rika> well |
10:08:07 | FromDiscord | <Rika> Some weird form of it IIRC |
10:21:02 | * | derpydoo quit (Quit: derpydoo) |
10:23:29 | * | om3ga_ is now known as om3ga |
10:36:15 | FromDiscord | <Chronos [She/Her]> Hm |
10:49:35 | * | droidrage joined #nim |
13:04:40 | * | Notxor quit (Remote host closed the connection) |
13:06:19 | * | Notxor joined #nim |
13:07:48 | FromDiscord | <Chronos [She/Her]> Okay... Not sure how to abstract the data provider? |
13:08:27 | FromDiscord | <Chronos [She/Her]> A data provider should be a simple abstraction layer over multiple types of data storage (Example: JSON, MongoDB, Sqlite3) |
13:12:29 | FromDiscord | <Rika> you need a standardised form of accessing this data from the provider by abstraction |
13:12:39 | FromDiscord | <Rika> think about the format you want to receive the data in |
13:12:46 | FromDiscord | <Rika> make these providers return this standard format |
13:20:41 | FromDiscord | <pysan> sent a code paste, see https://play.nim-lang.org/#ix=4uaK |
13:21:28 | FromDiscord | <pysan> I would like to somehow simplify the repetitive pattern. Is there a way to accomplish? |
13:34:00 | * | jmdaemon quit (Ping timeout: 260 seconds) |
13:36:25 | FromDiscord | <Chronos [She/Her]> Any up-to-date MongoDB drivers? :p |
14:01:41 | FromDiscord | <auxym> In reply to @pysan "I would like to": what exactly would you like to simply? One thing I see is you could define an enum type for your `t` field and set constants that can be reused for each case |
14:01:47 | FromDiscord | <auxym> (edit) "simply?" => "simplify?" |
14:03:54 | FromDiscord | <pysan> In reply to @auxym "what exactly would you": I would like to define in such way like |
14:05:17 | FromDiscord | <pysan> (edit) "In reply to @auxym "what exactly would you": I would like to define in such way like" => "sent a code paste, see https://play.nim-lang.org/#ix=4uaZ" |
14:11:04 | FromDiscord | <auxym> a macro could do that. I'm not aware of an existing lib to do exactly that though, so you'll have to write it yourself |
14:17:23 | FromDiscord | <pysan> Could you guide me how to implement that? I'm afraid I'm not very used to macros... |
14:33:11 | FromDiscord | <auxym> here's a good tutorial: https://dev.to/beef331/demystification-of-macros-in-nim-13n8 |
14:35:23 | FromDiscord | <auxym> the idea is that macros allow AST manipulation. You have the desired "DSL" (the short code you posted second), you can use `dumpTree` to see what kind of AST that creates. Then you have the desired target AST, which is your original code above (also use dumptree on that). Your macro will be nim code that transforms the short code AST into the target "long" AST. |
14:35:43 | * | arkurious joined #nim |
14:35:48 | * | arkurious quit (Remote host closed the connection) |
14:40:46 | FromDiscord | <xTrayambak> Hello everyone, I have a small question -- How can I make a function that takes an int as an argument and if the int is 1, returns an int, if the int is 2, returns a string and if the int is 3, returns a bool? I tried the auto keyword but that doesn't seem to help. |
14:43:40 | FromDiscord | <demotomohiro> You probably can do that if an argument was static[int] and use `when` instead of if. |
14:48:39 | FromDiscord | <demotomohiro> If the argument was runtime value, you cannot change return time at runtime.↵https://internet-of-tomohiro.netlify.app/nim/faq.en.html#procedures-how-to-vary-a-return-type-of-procedure-at-runtimeqmark |
14:49:28 | FromDiscord | <demotomohiro> you cannot change return type at runtime. |
15:03:21 | FromDiscord | <Andreas> In reply to @xTrayambak "Hello everyone, I have": return a `JsonNode` with a `.value` -field that carries your `int/string/bool`. |
15:04:56 | FromDiscord | <xTrayambak> Alright, thank you both of you, for now I am going to just use seperate functions for seperate types, as that seems the easiest (and laziest) way out of it. I've been using Nim for around 1.5 years now (1 year if you minus the learning time) and it feels great to use! |
15:07:38 | * | fredrikhr quit (Quit: Disconnecting...) |
15:20:23 | * | progranner joined #nim |
15:37:23 | * | beholders_eye quit (Ping timeout: 264 seconds) |
15:38:10 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
15:40:00 | * | progranner joined #nim |
15:50:59 | FromDiscord | <Nerve> In Nim you cannot have multiple return types, only input types. To emulate multiple return types, you can either use an object variant or a JsonNode, and JsonNode is pretty easy to use. |
15:51:06 | FromDiscord | <Nerve> (edit) "input" => "parameter" |
15:51:25 | FromDiscord | <Nerve> That's just the nutshell of what Tray said |
15:51:37 | FromDiscord | <Nerve> (edit) "nutshell" => "why/how" |
15:51:44 | FromDiscord | <Nerve> (edit) "why/how" => "why part" |
15:51:51 | FromDiscord | <Nerve> Andreas |
15:51:59 | FromDiscord | <Nerve> (edit) "Tray" => "Andreas" |
16:05:26 | NimEventer | New thread by alexeypetrushin: Why astToStr doesn't work inside template?, see https://forum.nim-lang.org/t/10130 |
16:09:45 | FromDiscord | <michaelb.eth> I have a seq[X] whose length I can only know at runtime, and an imported C function that takes as an argument a C array (od type X) of undetermined size |
16:10:28 | FromDiscord | <michaelb.eth> how can I convert the seq[X], using UncheckedArray in some manner? |
16:11:20 | FromDiscord | <michaelb.eth> (edit) "seq[X]," => "seq[X] for calling the C function?" |
16:11:32 | FromDiscord | <michaelb.eth> (edit) "(od" => "(of" |
16:15:19 | FromDiscord | <Z3NTL3> when i use socket module and use sock stream iprototcp and after words when i do setSockOpt IPPROTO raw it says unsupported protocol..? |
16:16:21 | FromDiscord | <Z3NTL3> (edit) "words" => "wards" |
16:16:28 | FromDiscord | <demotomohiro> In reply to @michaelb.eth "I have a seq[X]": `if myseq.len != 0: cast[ptr UncheckedArray[X]](myseq[0].addr) else: nil`. |
16:16:49 | FromDiscord | <michaelb.eth> In reply to @demotomohiro "`if myseq.len != 0:": cool, thanks! |
16:44:49 | NimEventer | New thread by Angluca: Can I quick get table last key value use like at(idx) function?, see https://forum.nim-lang.org/t/10131 |
16:57:44 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
16:59:30 | * | rockcavera joined #nim |
16:59:51 | * | progranner joined #nim |
17:04:36 | * | beholders_eye joined #nim |
17:05:45 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
17:06:26 | * | progranner joined #nim |
17:17:10 | * | xet7_ joined #nim |
17:17:27 | * | xet7_ quit (Client Quit) |
17:18:07 | * | xet7_ joined #nim |
17:20:05 | * | xet7 quit (Ping timeout: 240 seconds) |
17:22:01 | * | xet7_ is now known as xet7 |
17:28:32 | * | xet7 quit (Quit: Leaving) |
17:28:58 | * | xet7 joined #nim |
17:32:50 | * | xet7 quit (Remote host closed the connection) |
17:35:28 | * | xet7 joined #nim |
17:45:50 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
17:46:14 | * | lucasta joined #nim |
17:48:36 | * | xet7 quit (Remote host closed the connection) |
17:49:27 | * | Goodbye_Vincent quit (Read error: Connection reset by peer) |
17:50:40 | * | Goodbye_Vincent joined #nim |
17:53:18 | * | progranner joined #nim |
17:54:05 | * | rockcavera quit (Read error: Connection reset by peer) |
17:54:51 | * | xet7 joined #nim |
17:55:05 | * | rockcavera joined #nim |
17:55:05 | * | rockcavera quit (Changing host) |
17:55:05 | * | rockcavera joined #nim |
18:10:06 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
18:12:45 | * | progranner joined #nim |
18:24:12 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
18:25:57 | * | progranner joined #nim |
18:26:53 | * | Goodbye_Vincent quit (Remote host closed the connection) |
18:27:38 | * | Goodbye_Vincent joined #nim |
18:31:54 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
18:32:46 | * | progranner joined #nim |
18:38:40 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
18:39:23 | * | progranner joined #nim |
18:41:15 | * | beholders_eye quit (Quit: WeeChat 3.6) |
18:43:31 | FromDiscord | <Andreas> howto gracefully shutdown AsyncHttpServer ? A simple `server.close()` results in a error ? Is that possible when the server was started like so :↵`waitFor server.serve( Port( options.port ), cb )` |
19:04:28 | * | Goodbye_Vincent quit (Remote host closed the connection) |
19:05:14 | * | Goodbye_Vincent joined #nim |
19:10:58 | * | krux02 joined #nim |
19:15:50 | FromDiscord | <Require Support> TIL nim can be compiled for android, this is amazing |
19:32:55 | FromDiscord | <demotomohiro> Running Nim code on android using termux is easy. |
19:37:52 | FromDiscord | <ElegantBeef> oh boy is the bridge behind |
19:39:40 | FromDiscord | <Yardanico> In reply to @ElegantBeef "oh boy is the": discord specifically breaking the bridge so beef uses discord |
19:39:48 | FromDiscord | <ElegantBeef> Wouldnt doubt it |
19:40:08 | FromDiscord | <Yardanico> and right now I'm trying to figure out nimbus-eth2 with just a `nim` command, disregarding all the shell scripts |
19:40:15 | FromDiscord | <Elegantbeef> undefined |
19:40:22 | FromDiscord | <Yardanico> lol |
19:40:29 | FromDiscord | <Yardanico> did you actually send that or it's really freaking out |
19:40:32 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1100144258377334834/image.png |
19:40:33 | FromDiscord | <Yardanico> like what is this |
19:40:41 | FromDiscord | <ElegantBeef> I deleted the message before the bridge sent it |
19:40:48 | FromDiscord | <ElegantBeef> Assuming it'd send nothing, but nope JS land probably |
19:40:58 | FromDiscord | <Yardanico> yeah |
19:41:35 | FromDiscord | <Q-Master> e.x. https://github.com/Q-Master/nimongo not so up-to-date, but anyways \:) |
19:41:55 | FromDiscord | <Elegantbeef> The matrix bridge is like 8 hours behind 😄 |
19:42:03 | * | Goodbye_Vincent quit (Remote host closed the connection) |
19:42:07 | FromDiscord | <Elegantbeef> Oh there we go it's one way time is fast now |
19:42:17 | FromDiscord | <Yardanico> aaaaaaaa |
19:42:19 | FromDiscord | <Yardanico> 123 |
19:42:25 | FromDiscord | <Yardanico> you should use irc as god intended |
19:42:34 | FromDiscord | <ElegantBeef> Nah we should just close discord and use matrix |
19:42:49 | * | Goodbye_Vincent joined #nim |
19:42:54 | FromDiscord | <Yardanico> i will use matrix once it has a good client comparable to tdesktop that's not based on electron :) |
19:42:57 | FromDiscord | <Yardanico> also hopefully voice |
19:43:05 | FromDiscord | <Yardanico> yes i know it has voice, but it's quite bad |
19:43:13 | FromDiscord | <ElegantBeef> It has 1:1 voip 😛 |
19:43:30 | FromDiscord | <Yardanico> but does it have desktop streaming that can handle 1080p60fps :P |
19:43:37 | FromDiscord | <Yardanico> (telegram doesn't either though) |
19:43:52 | FromDiscord | <ElegantBeef> No clue I've actually never used voip on matrix |
19:47:50 | FromDiscord | <Yardanico> finally https://media.discordapp.net/attachments/371759389889003532/1100146099513212968/image.png |
19:47:54 | FromDiscord | <Yardanico> it is building |
19:49:29 | FromDiscord | <Yardanico> damn nimbus is indeed very rough with compile times |
19:49:46 | FromDiscord | <Yardanico> the nim step itself (no C compiler) takes 1 minute 6 seconds |
19:50:03 | FromDiscord | <Yardanico> surely PGO will speed it up at least 2x |
19:50:20 | FromDiscord | <Yardanico> although I will first just compile the pgo compiler from status' fork without using nimbus itself for profiling pgo |
19:50:22 | FromDiscord | <ElegantBeef> I'd guess something like a 30% speed up 😄 |
19:50:58 | FromDiscord | <Yardanico> also not sure what version to build |
19:51:04 | FromDiscord | <Yardanico> do i do danger clang pgo or release clang, since that's more realistic |
19:51:08 | FromDiscord | <Yardanico> (edit) "clang," => "clang pgo," |
19:51:18 | FromDiscord | <Yardanico> well let's do danger for now |
19:51:59 | FromDiscord | <Yardanico> ah right, and I'll not build with orc since it's useless for nimbus |
19:52:33 | FromDiscord | <Yardanico> ah lol |
19:52:35 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1100147294533328966/image.png |
19:52:39 | FromDiscord | <Yardanico> since I have the status' nim in path |
19:52:45 | FromDiscord | <Yardanico> wait no |
19:52:45 | FromDiscord | <Yardanico> huh |
19:52:55 | FromDiscord | <Yardanico> ah right yeah It should use the status 'nim |
19:54:50 | FromDiscord | <Yardanico> oh, right, and the repos I'm using for profiling might not compile with 1.6.11 anymore, we'll see |
19:57:36 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
19:58:45 | * | krux02 quit (Remote host closed the connection) |
19:59:04 | * | krux02 joined #nim |
20:01:03 | FromDiscord | <Yardanico> noo https://media.discordapp.net/attachments/371759389889003532/1100149424916795463/image.png |
20:01:14 | FromDiscord | <Yardanico> ah makes sense, stupid me |
20:01:27 | * | progranner joined #nim |
20:04:50 | FromDiscord | <Yardanico> finally, nimium |
20:04:52 | FromDiscord | <Yardanico> /home/dian/Projects/NimExperiments/status/nim-status/bin/nim_pgo_clang |
20:06:50 | FromDiscord | <Yardanico> what |
20:07:09 | FromDiscord | <Yardanico> it took longer than without pgo lol 🤔 did i actually build a pgo compiler correctly? |
20:07:34 | FromDiscord | <ElegantBeef> Did you bench against the actual status Nim or the other Nim? |
20:07:50 | FromDiscord | <Yardanico> I compiled normal status nim and pgo'd status nim with clang with danger |
20:07:52 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
20:07:58 | FromDiscord | <Yardanico> but yeah, lemme try to do it again but also profile nimbus itself |
20:08:31 | * | krux02 quit (Quit: Leaving) |
20:10:00 | FromDiscord | <Yardanico> maybe it's ORC that magically gets much faster with PGO? 🤔 |
20:10:15 | FromDiscord | <Yardanico> since status' nim fork uses refc |
20:10:31 | FromDiscord | <ElegantBeef> Perhaps |
20:10:55 | FromDiscord | <ElegantBeef> That actually would make some sense given it has a bit of overhead to insert destructors |
20:11:46 | FromDiscord | <Yardanico> but 1.7x? |
20:12:13 | FromDiscord | <Yardanico> but yeah I'm rebuilding with same profiling repos right now just to make sure I didn't make a mistake somewhere |
20:14:25 | * | progranner joined #nim |
20:18:26 | * | progranner quit (Client Quit) |
20:18:51 | FromDiscord | <Yardanico> yeah @ElegantBeef I think that orc is generally much better suited for PGO, not just because of overhead |
20:19:11 | FromDiscord | <Yardanico> for comparison, building the status' nim compiler (which is basically 1.6.12 with some stuff changed) takes 6 seconds with default-built -d:release nim compiler |
20:19:14 | FromDiscord | <Yardanico> and 5 with pgo'd clang |
20:19:23 | FromDiscord | <Yardanico> while for devel it takes around the same 6 seconds with default -d:release gcc and 3.5 with clang'd pgo |
20:19:39 | * | Goodbye_Vincent quit (Remote host closed the connection) |
20:19:49 | FromDiscord | <ElegantBeef> I mean that destructor insertion logic might be capable of being optimised better with PGO information |
20:19:55 | FromDiscord | <Yardanico> yeah that's what I think too |
20:19:57 | FromDiscord | <Yardanico> very good ;) |
20:20:23 | * | Goodbye_Vincent joined #nim |
20:28:50 | * | progranner joined #nim |
21:00:39 | * | Goodbye_Vincent quit (Remote host closed the connection) |
21:01:24 | * | Goodbye_Vincent joined #nim |
21:16:16 | FromDiscord | <Oscour> In reply to @sOkam! "i dont understand your": Ok, I know it's a bit late from when we had that conversion but I just understood what you meant and i'm completely going to discard the nammed tuple and go for an array with enums as keys |
21:16:42 | FromDiscord | <ElegantBeef> Using good features of the language, nice |
21:18:07 | FromDiscord | <Oscour> (edit) "keys" => "indexes" |
21:18:37 | FromDiscord | <sOkam!> In reply to @Oscour "Ok, I know it's": pretty much, yep. no worries↵coming from python (i had the same issue) where literally everything is a string, its a big mindshift to think in nim types instead |
21:20:40 | FromDiscord | <Oscour> Yeah but I actuallyu love it. Yesterday once I got going it was great. Just some issues with uint16, int16, int8, uint8 sometimes because I'm programming an MPU for a microcontroller and I must use both type... |
21:22:05 | FromDiscord | <Oscour> I have a question about enums, I have seen multiple time things like this for example: |
21:22:29 | FromDiscord | <sOkam!> i find it faster to write than python, simply because the compiler has you covered with plenty of error messages↵while in python everything silently works |
21:22:30 | FromDiscord | <Oscour> (edit) "I have" => "sent" | "question about enums, I have seen multiple time things like this for example:" => "code paste, see https://play.nim-lang.org/#ix=4ucz" |
21:22:35 | FromDiscord | <Oscour> And i don't understand what it means |
21:22:47 | FromDiscord | <ElegantBeef> You certainly did not see ` = 0` twice |
21:22:58 | FromDiscord | <ElegantBeef> You give the enum an ordinal value is all that means |
21:22:59 | FromDiscord | <sOkam!> yeah, 0 twice doesn't make sense |
21:23:08 | FromDiscord | <ElegantBeef> Imagining you mean `= 9` |
21:23:16 | FromDiscord | <ElegantBeef> `ord(Enum5) == 9` |
21:23:19 | FromDiscord | <ElegantBeef> Is all it really means |
21:23:24 | FromDiscord | <Oscour> In reply to @sOkam! "i find it faster": Yes and no. I am clearly not experienced enough but having a realtime linter like pylint is actually a huuge time saver |
21:24:32 | FromDiscord | <sOkam!> In reply to @Oscour "Yes and no. I": i used pyright in python. and while that is a big timesaver, it still doesn't stop you from shooting yourself in the foot with incorrect data types, unless you hardcode the types and even then it becomes more of a pain than a feature 😔 |
21:24:39 | FromDiscord | <Oscour> I didn't see enums with multiple zero but I saw some with values, then no value, then another zero |
21:24:51 | FromDiscord | <huantian> In reply to @sOkam! "i used pyright in": pyright != pylint |
21:24:51 | FromDiscord | <ElegantBeef> Yea it just give them values |
21:25:14 | * | beholders_eye joined #nim |
21:25:18 | FromDiscord | <ElegantBeef> so it's 0, 1, 2, 3, 9 |
21:25:33 | FromDiscord | <ElegantBeef> So internally your enum is actually `9` assuming you do `MyEnum = 9` |
21:25:44 | FromDiscord | <ElegantBeef> Then `ord(Enum6) == 10` |
21:25:52 | FromDiscord | <Oscour> In reply to @huantian "pyright != pylint": To be fair, Pylint isn't better in that regard sadly :/ |
21:26:11 | FromDiscord | <huantian> yeah but you'd use both tools in conjunction |
21:26:31 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4ucB |
21:26:31 | FromDiscord | <huantian> so while neither are perfect, and both together aren't perfect, it's unfair to compare only using one to using both |
21:27:19 | FromDiscord | <Oscour> In reply to @ElegantBeef "Yea it just give": Ok I Think I see what you mean. When I saw that I was confused because I couldn't get the value in the enum |
21:27:35 | FromDiscord | <Oscour> And it is not explained in the tutorials I watched |
21:28:09 | FromDiscord | <Oscour> Never used pyright, I will surely take a look at it! |
21:28:19 | FromDiscord | <Oscour> But sadly, I can't even install pylint at work lmao |
21:30:11 | FromDiscord | <Oscour> I'm stuck with jedi I believe. is there a way to have a realtime linter for Nim in vscode? I would guess no because it's a compile language... |
21:30:25 | FromDiscord | <ElegantBeef> Enable auto save and there you go |
21:31:03 | FromDiscord | <huantian> it's definitely possible but nobody has made an actual linter for nim iirc |
21:31:14 | FromDiscord | <ElegantBeef> Isnt nim check a linter |
21:31:48 | FromDiscord | <Oscour> In reply to @ElegantBeef "Enable auto save and": https://tenor.com/view/hacker-hackerman-kung-fury-gif-7953536 |
21:31:50 | FromDiscord | <huantian> I thought nim check just checked if it compiles |
21:31:55 | FromDiscord | <Yardanico> In reply to @huantian "I thought nim check": it shows you all errors |
21:31:56 | FromDiscord | <ElegantBeef> Isnt that what a linter is for |
21:31:57 | FromDiscord | <Yardanico> and warnings and hints |
21:32:22 | FromDiscord | <ElegantBeef> > lint-like tools have also evolved to detect an even wider variety of suspicious constructs. These include "warnings about syntax errors, uses of undeclared variables, calls to deprecated functions, spacing and formatting conventions, misuse of scope, implicit fallthrough in switch statements, missing license headers, [and]...dangerous language features".[6] |
21:32:31 | FromDiscord | <ElegantBeef> So literally what Nim does out of the box |
21:32:42 | FromDiscord | <huantian> ig |
21:32:52 | FromDiscord | <Oscour> well, i'm just gonna enable autosave lmao |
21:32:55 | FromDiscord | <huantian> I usually expect a linter to have more than what is built into the nim compiler |
21:33:05 | FromDiscord | <ElegantBeef> I mean we already have the best linter thanks to term rewriting macros |
21:33:11 | FromDiscord | <ElegantBeef> And I will die on this hill |
21:33:11 | FromDiscord | <Yardanico> oh right @Beef Broccoli pgo'd compiler is also ~1.7x faster at nim check which makes sense |
21:33:17 | FromDiscord | <Yardanico> what |
21:33:18 | FromDiscord | <ElegantBeef> Semantic linting is wonderful |
21:33:18 | FromDiscord | <huantian> wrong beef |
21:33:19 | FromDiscord | <Yardanico> who is that |
21:33:26 | FromDiscord | <ElegantBeef> No clue but do not ping me on discord please |
21:33:27 | FromDiscord | <ElegantBeef> Thanks |
21:33:30 | FromDiscord | <Yardanico> okay |
21:33:38 | FromDiscord | <Yardanico> do you get pinged by @beef on matrix |
21:33:41 | FromDiscord | <huantian> In reply to @ElegantBeef "Semantic linting is wonderful": yeah I agree, it's just not being taken advantage of |
21:33:48 | FromDiscord | <ElegantBeef> `beef` or `elegantbeef` both work |
21:33:54 | FromDiscord | <Yardanico> In reply to @huantian "yeah I agree, it's": did you see the thing beef's referring to? :P |
21:34:14 | FromDiscord | <ElegantBeef> Fuuuck my Ps3's FTP server died after copying 1.3gb, i swear these servers are prograrmmed on a potato |
21:34:29 | FromDiscord | <ElegantBeef> Using TRM for linting is genious |
21:34:33 | FromDiscord | <ElegantBeef> genius even |
21:35:01 | FromDiscord | <ElegantBeef> https://forum.nim-lang.org/t/9739#64098 here's what yard considers cursed |
21:35:17 | FromDiscord | <Yardanico> it's not cursed, it's good ;) |
21:36:13 | FromDiscord | <huantian> but what I'm not talking about is exactly how it's done, but rather pointing out linting as another aspect of nim tooling not up to snuff |
21:36:29 | FromDiscord | <Beef Broccoli> In reply to @Yardanico "who is that": one of the hundreds on users in this discord. |
21:36:36 | FromDiscord | <Beef Broccoli> (edit) "on" => "of" |
21:36:39 | FromDiscord | <Yardanico> yeah, but you mean thousands |
21:37:02 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1100173577367593192/image.png |
21:37:11 | FromDiscord | <huantian> like for example, there could be a lint rule to prevent manually setting enum values to powers of two |
21:37:22 | FromDiscord | <huantian> and instead recommends you to use sets |
21:37:31 | FromDiscord | <Yardanico> In reply to @huantian "like for example, there": but again, you can probably do that with what beef showed, no? |
21:37:39 | FromDiscord | <huantian> yeah I'm not saying you can't |
21:37:48 | FromDiscord | <huantian> I'm just pointing out nobody has done it |
21:37:51 | FromDiscord | <ElegantBeef> Well be the change you want to see |
21:37:51 | FromDiscord | <Yardanico> also regarding sets, we finally got https://github.com/nim-lang/Nim/pull/21659 |
21:38:02 | FromDiscord | <Yardanico> which also fixed some cases where stdlib used big sets |
21:38:06 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
21:38:38 | FromDiscord | <huantian> ugh why the heck is my xdg desktop portal not using my default browser |
21:39:22 | * | ehmry joined #nim |
21:40:16 | FromDiscord | <huantian> In reply to @ElegantBeef "Well be the change": probably the correct course of action |
21:41:33 | FromDiscord | <ElegantBeef> Thanks to TRMs a linter really can be as simple as `nimble install linterProject` and include `--import:"linterproject"` |
21:41:51 | FromDiscord | <Yardanico> and you can of course just add that import to your global nim config |
21:41:54 | * | Goodbye_Vincent quit (Read error: Connection reset by peer) |
21:42:21 | FromDiscord | <huantian> and it shouldn't be too hard to make a config for the linter right |
21:42:29 | FromDiscord | <huantian> with categories and fun stuff |
21:42:39 | * | Goodbye_Vincent joined #nim |
21:42:43 | FromDiscord | <ElegantBeef> I'd just make each category a module |
21:42:51 | FromDiscord | <ElegantBeef> then you can just import that specific module |
21:43:13 | FromDiscord | <Yardanico> I mean, a linter with TRMs will still be limited |
21:43:24 | FromDiscord | <Yardanico> there are some things you won't be able to do with them for linting |
21:43:30 | FromDiscord | <huantian> In reply to @ElegantBeef "then you can just": well you'd still want to be able to disable specific lints too |
21:43:53 | FromDiscord | <ElegantBeef> Then you'd need to have a `when defined(linterNameLinterThing):...` |
21:44:02 | FromDiscord | <huantian> yeah you'd have to do that for each one hm |
21:44:35 | FromDiscord | <huantian> In reply to @Yardanico "there are some things": yeah it might be ideal to work on concrete syntax trees instead of ASTs |
21:44:45 | FromDiscord | <ElegantBeef> In reply to @Yardanico "there are some things": Well if you want to get real hacky you can always fetch the line information |
21:44:53 | FromDiscord | <Yardanico> just like nimib? :P |
21:44:58 | FromDiscord | <ElegantBeef> Yea |
21:45:25 | FromDiscord | <ElegantBeef> In reply to @huantian "yeah it might be": Bleh AST has more meaning in it |
21:45:52 | FromDiscord | <ElegantBeef> It's semantically checked code so you can much more easily lint semantics |
21:46:12 | FromDiscord | <huantian> perhaps you'd want to be able to use both then |
21:46:21 | FromDiscord | <huantian> because the ast doesn't include things like comments |
21:46:39 | FromDiscord | <ElegantBeef> Excuse me, why do comments matter |
21:46:57 | FromDiscord | <huantian> what if I uh want to make it so people can't write comments |
21:47:06 | FromDiscord | <huantian> because they're evil |
21:47:07 | FromDiscord | <Yardanico> yeah for normal comments that won't work |
21:47:22 | FromDiscord | <Yardanico> but that's a niche case |
21:47:22 | FromDiscord | <ElegantBeef> Lol |
21:47:48 | FromDiscord | <ElegantBeef> Yea I'm too unprofessional to care about stylistic linting |
21:47:55 | FromDiscord | <huantian> I wonder if you oculd use `{.push.}` and `{.pop.}` to temporarially disable rules |
21:48:10 | FromDiscord | <ElegantBeef> You can do `{.define` in code but there is no `{.undefine` |
21:48:52 | FromDiscord | <huantian> you can define it to true then false though |
21:49:01 | FromDiscord | <huantian> I'd assume? |
21:49:11 | FromDiscord | <Yardanico> but will you be able to fetch that information with TRMs? |
21:49:19 | FromDiscord | <huantian> yeah that I'm not sure |
21:49:32 | FromDiscord | <Yardanico> I mean it might work, but you'd have to emit a lot of code in a TRM macro |
21:49:40 | FromDiscord | <Yardanico> since you'd have to check for a lot of rules |
21:51:34 | FromDiscord | <ElegantBeef> Huh? |
21:52:43 | FromDiscord | <Yardanico> In reply to @ElegantBeef "Huh?": if you're using define you can't check then in the macro itself, you'd have to make the macro emit the checks for defines, right? |
21:55:50 | FromDiscord | <ElegantBeef> Yea probably |
21:56:42 | FromDiscord | <ElegantBeef> Likely just easier to disable user warnings for a bit |
21:56:56 | FromDiscord | <ElegantBeef> But that infects all other code aswell ofc |
21:57:35 | FromDiscord | <huantian> could you make a warning for each lint rule lol |
21:57:48 | FromDiscord | <huantian> and disable each individually |
21:57:50 | FromDiscord | <ElegantBeef> Nah the compiler only has a single warning type |
21:57:56 | FromDiscord | <huantian> oh really? |
21:58:03 | FromDiscord | <huantian> I never actually use warnings so I didn't know that |
21:58:07 | FromDiscord | <ElegantBeef> All `{.warning: ...}` emits `User` |
21:58:25 | FromDiscord | <ElegantBeef> As does `warning(string, NimNode)` from macros |
21:58:50 | FromDiscord | <ElegantBeef> We could just use the macro system to have like `lint("lintName", on)` |
21:59:02 | FromDiscord | <ElegantBeef> Which would add the key to a table |
21:59:26 | FromDiscord | <ElegantBeef> Then inside the trm you could fetch a specific key and check if it is on |
21:59:36 | FromDiscord | <Yardanico> oh right |
22:00:22 | FromDiscord | <ElegantBeef> The downside is there is no CLI way of doing it aside from parsing something like `--define:lintersOn:"bleh, blue, bloh, blag, blos"` |
22:02:09 | FromDiscord | <huantian> it might also be worth to add both a configurable warn level and an error level for lints |
22:02:44 | FromDiscord | <huantian> that would be fairly simple with the table |
22:02:51 | FromDiscord | <huantian> but makes cli usage more annoying |
22:03:12 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
22:03:29 | FromDiscord | <Yardanico> can't you just have another nim file as your linter config and import it in your project that'll set all options |
22:03:42 | FromDiscord | <ElegantBeef> You could indeed |
22:04:03 | FromDiscord | <huantian> that'd probably the general use case |
22:04:48 | FromDiscord | <huantian> but it would be nice to also have the cli config |
22:05:18 | FromDiscord | <ElegantBeef> The only important lints are performance ones 😛 |
22:05:23 | FromDiscord | <Yardanico> have a program that generates that nim config file from CLI options |
22:05:28 | FromDiscord | <ElegantBeef> `for x in a[b..c]` |
22:05:45 | FromDiscord | <Yardanico> `gen_lint_config --noComments:true` just replaces the config in the current project or whatever |
22:09:10 | * | advesperacit quit () |
22:09:25 | FromDiscord | <huantian> a rule for void returns on procs could be useful |
22:09:41 | FromDiscord | <Yardanico> or a rule for `var ref T` |
22:09:50 | FromDiscord | <Yardanico> sometimes people do that because they don't know ref is already mutable |
22:09:53 | FromDiscord | <Yardanico> double pointer indirection :(( |
22:10:06 | FromDiscord | <Yardanico> <https://github.com/Yardanico/nim-snippets/blob/master/var_ref.diff> |
22:10:07 | FromDiscord | <ElegantBeef> In reply to @huantian "a rule for void": Sokam shudders |
22:10:44 | FromDiscord | <huantian> I already do that whenever I look at their code 🙃 |
22:11:07 | FromDiscord | <huantian> hmm how hard would it be for the lint to suggest a fix |
22:11:14 | FromDiscord | <ElegantBeef> See this is why AST is nice 😄 |
22:11:30 | FromDiscord | <ElegantBeef> You can look for all `var T` and check if the `T` is a ref and then emit a warning |
22:11:36 | FromDiscord | <Yardanico> yeah |
22:13:01 | * | Notxor quit (Remote host closed the connection) |
22:16:26 | FromDiscord | <Elegantbeef> I think you can also semantically catch `void` on a proc def |
22:16:35 | FromDiscord | <Elegantbeef> Hey we're back! |
22:17:09 | FromDiscord | <Elegantbeef> But yea anything semantically should be catchable assuming the compiler likes how you use the TRM |
22:17:42 | FromDiscord | <Yardanico> time to clone all nim packages again |
22:17:52 | FromDiscord | <Elegantbeef> You brave brave soul |
22:18:01 | * | progranner joined #nim |
22:18:07 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1100183921796317205/image.png |
22:18:18 | FromDiscord | <Elegantbeef> Are you not doing it async? |
22:18:21 | FromDiscord | <Elegantbeef> Or is that async |
22:18:23 | * | progranner quit (Client Quit) |
22:18:27 | FromDiscord | <Yardanico> i'm doing it with `execProcesses` |
22:18:32 | FromDiscord | <Yardanico> so it's doing 16 parallel git clones |
22:18:37 | FromDiscord | <Elegantbeef> Ah ok |
22:19:04 | FromDiscord | <Elegantbeef> Meanwhile me over here dumping 1 file at a time from a PS3 game cause the PS3 ftp server crashes if you even breath in the same room as the PS3 |
22:19:19 | FromDiscord | <Elegantbeef> 12000 files and it stops/freezes every 300 or so files |
22:19:39 | * | Goodbye_Vincent quit (Remote host closed the connection) |
22:20:25 | * | Goodbye_Vincent joined #nim |
22:20:43 | FromDiscord | <Elegantbeef> It's only 4gb but it's going to take like 20 minutes on a local download with ethernet on both ends, it's not a good server |
22:21:30 | FromDiscord | <Elegantbeef> Does this mean you're going to get more statistics |
22:21:53 | FromDiscord | <Yardanico> too lazy to do the neo4j stuff, I can just run some code searches over all nimble repos |
22:22:23 | * | azimut quit (Ping timeout: 255 seconds) |
22:23:54 | FromDiscord | <Yardanico> someone has some big vendored packages https://media.discordapp.net/attachments/371759389889003532/1100185372689961080/image.png |
22:24:02 | FromDiscord | <Yardanico> i'm cloning with --recursive this time, since status uses it in nimbus |
22:24:31 | FromDiscord | <Elegantbeef> What are you going to be doing with all of these? |
22:24:46 | FromDiscord | <Elegantbeef> This isnt apart of a large test suite is it |
22:24:49 | FromDiscord | <Yardanico> search funny stuff |
22:25:02 | FromDiscord | <Yardanico> its all in <https://github.com/Yardanico/nim-snippets/tree/master/pkgraph> |
22:25:09 | FromDiscord | <Elegantbeef> Ah thought you were contemplating testing PGO on a large breadth of code 😄 |
22:25:18 | FromDiscord | <Yardanico> the code here can just parse all nimble files into graphviz/cypher (neo4j) |
22:25:22 | FromDiscord | <Yardanico> with npeg |
22:25:32 | FromDiscord | <Elegantbeef> Right i remember the graphs |
22:26:22 | FromDiscord | <Yardanico> i think it's almost done - only cloning nimbus' submodules now |
22:31:09 | FromDiscord | <Nlits (Ping on reply)> Is there a good way to generate JavaScript from nim code run-time? I can run a command but then I would have to use templating or smth and I have no idea how |
22:31:29 | FromDiscord | <Yardanico> if you mean compile nim to js, you'd have to bundle the compiler, but you can do that, yes |
22:31:38 | FromDiscord | <Yardanico> if you want to compile nim to js at runtime |
22:31:59 | FromDiscord | <Yardanico> okay cloning done, had to kill one git clone because the submodule was stuck |
22:32:08 | FromDiscord | <Yardanico> its just 16GB |
22:32:24 | * | azimut joined #nim |
22:32:25 | FromDiscord | <Yardanico> 2083 folders |
22:34:48 | FromDiscord | <Yardanico> what did I just stumble upon https://media.discordapp.net/attachments/371759389889003532/1100188119950704730/image.png |
22:35:09 | FromDiscord | <Yardanico> ah, it's juan's contra |
22:40:30 | FromDiscord | <Nlits (Ping on reply)> In reply to @Yardanico "if you mean compile": how |
22:40:39 | FromDiscord | <Yardanico> In reply to @not logged in "how": by using the compiler as a library |
22:41:12 | FromDiscord | <Yardanico> there was a repo that simplified it a bit, forgot the name |
22:41:45 | FromDiscord | <Nlits (Ping on reply)> In reply to @Yardanico "there was a repo": great |
22:46:54 | FromDiscord | <Nlits (Ping on reply)> let me try to find it |
22:47:18 | FromDiscord | <Nlits (Ping on reply)> In reply to @Yardanico "there was a repo": wait, nimble package? |
22:57:24 | * | Goodbye_Vincent quit (Remote host closed the connection) |
22:58:10 | * | Goodbye_Vincent joined #nim |
23:03:12 | FromDiscord | <Chronos [She/Her]> In reply to @Yardanico "if you mean compile": Does Nim (the compiler) compile to the JS backend? |
23:03:52 | FromDiscord | <Yardanico> In reply to @Hourglass, When the Hour Strikes "Does Nim (the compiler)": no |
23:04:02 | FromDiscord | <Yardanico> you probably can make it in theory, but doing that with wasm will be much simpler |
23:04:10 | FromDiscord | <Chronos [She/Her]> Yeah makes sense |
23:04:41 | * | azimut quit (Ping timeout: 255 seconds) |
23:07:24 | * | lucasta quit (Remote host closed the connection) |
23:15:30 | * | jmdaemon joined #nim |
23:36:12 | * | beholders_eye quit (Quit: WeeChat 3.6) |
23:43:54 | FromDiscord | <Nlits (Ping on reply)> In reply to @not logged in "wait, nimble package?": is it a nimble pkg? |
23:48:16 | * | Goodbye_Vincent quit (Remote host closed the connection) |
23:49:01 | * | Goodbye_Vincent joined #nim |