00:01:09 | * | jmdaemon joined #nim |
00:04:21 | * | wyrd joined #nim |
00:05:14 | NimEventer | New question by itil memek cantik: Convert array type to boolean, see https://stackoverflow.com/questions/71096881/convert-array-type-to-boolean |
00:10:42 | FromDiscord | <Elegantbeef> Also madprops where did you see that package? 😛 |
00:10:51 | madprops | scrolling on github |
00:11:28 | madprops | the feed or whatever it's called |
00:34:40 | FromDiscord | <Elegantbeef> Ah right people follow me |
00:37:53 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
00:37:54 | FromDiscord | <Hel> sent a code paste, see https://play.nim-lang.org/#ix=3Pr8 |
00:38:01 | FromDiscord | <Hel> sent a code paste, see https://play.nim-lang.org/#ix=3Pr9 |
00:38:13 | FromDiscord | <Hel> is it a bug? |
00:38:17 | FromDiscord | <Elegantbeef> No |
00:38:36 | FromDiscord | <Elegantbeef> test is looking for `int, float` not \`Thing[int], Thing[float]\`\` |
00:39:37 | FromDiscord | <Elegantbeef> That example has a converter |
00:39:48 | FromDiscord | <Elegantbeef> The converter is required for this example to make sense |
00:40:43 | FromDiscord | <Elegantbeef> It's just a general converter issue on dispatch, Nim doesnt use converters on ambiguity |
00:41:21 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#type-relations-convertible-relation there is a whole blurb about it, it's relatively complex |
00:43:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/7J8 |
00:44:17 | FromDiscord | <Elegantbeef> Atleast i'd say that's why it doesnt work |
00:44:32 | FromDiscord | <Hel> yeah my bad forgot the converter in my example |
00:44:50 | FromDiscord | <Hel> wrote it in like 2 seconds and missed the issue |
00:49:10 | FromDiscord | <Elegantbeef> There is a chance i'm wrong and it's just a bug with converter dispatch 😀 |
00:54:29 | FromDiscord | <Hel> i was just confused cause my brain just saw `converter` as another proc |
00:54:41 | FromDiscord | <Hel> also i didnt know about that feature |
00:55:39 | FromDiscord | <Hel> not something you see a lot |
00:56:22 | FromDiscord | <Elegantbeef> Ah there are some use cases that make it quite nice |
01:01:27 | FromDiscord | <Hel> yeah looks like they can have some nice uses |
01:25:16 | * | arkurious quit (Quit: Leaving) |
02:14:04 | * | fowl quit (Quit: cya pals) |
02:14:45 | * | fowl joined #nim |
03:16:38 | FromDiscord | <treeform> In reply to @ynfle "<@!107140179025735680> is hottie supposed": Sort of, it requires so many steps I don't know if I want to subject pplz to them |
03:17:03 | FromDiscord | <treeform> You need mess with certs a ton |
03:32:02 | * | vicecea quit (Remote host closed the connection) |
03:32:30 | * | vicecea joined #nim |
03:36:36 | FromDiscord | <Elegantbeef> @demotomohiro\: btw for https://internet-of-tomohiro.netlify.app/nim/faq.en.html#community-is-there-game-created-with-nimqmark you can link https://itch.io/c/1064082/games-made-with-nico and https://store.steampowered.com/app/1444480/Turing_Complete/ |
03:37:35 | FromDiscord | <Elegantbeef> Ah turing complete is on the github page |
03:37:40 | FromDiscord | <Rika> Lol |
03:59:42 | * | fowl quit (Quit: cya pals) |
04:00:21 | * | fowl joined #nim |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.4) |
04:06:30 | * | supakeen joined #nim |
04:53:02 | FromDiscord | <Hel> got a question |
04:53:23 | FromDiscord | <Elegantbeef> I got a possible answer |
04:53:31 | FromDiscord | <Hel> sent a code paste, see https://play.nim-lang.org/#ix=3PrR |
04:53:45 | FromDiscord | <Hel> why does delete remove wl1 from both data/original and the copy |
04:53:46 | FromDiscord | <Elegantbeef> you dont need the `%` multiple times |
04:54:00 | FromDiscord | <Hel> it's just a test ik |
04:54:04 | FromDiscord | <Hel> (edit) "ik" => "doesnt matter" |
04:54:12 | FromDiscord | <Rika> JsonNode is a ref |
04:54:23 | FromDiscord | <Rika> Copies are shallow unless specified as deep |
04:54:48 | FromDiscord | <Rika> Beef why are ya slow today smh |
04:54:51 | FromDiscord | <Elegantbeef> Yea this is just reference semantics |
04:55:00 | FromDiscord | <Hel> true |
04:55:07 | FromDiscord | <Elegantbeef> Rotting my brain thinking about traitor 😛 |
04:55:07 | FromDiscord | <Rika> Not false |
04:55:07 | FromDiscord | <Hel> just checked json docs |
04:55:12 | FromDiscord | <Hel> missed the ref |
04:55:17 | FromDiscord | <Rika> 👌 |
04:55:20 | FromDiscord | <Elegantbeef> Just documented all the macros in it |
04:55:25 | FromDiscord | <Elegantbeef> Questioning if i need anything else |
04:55:25 | FromDiscord | <Rika> Nice |
04:55:33 | FromDiscord | <Hel> best brain rot is brain rot after 9 hours of coding |
04:55:49 | FromDiscord | <Rika> Worst brain rot is brain rot after 9 months of not coding |
04:56:03 | FromDiscord | <Hel> that's the funny brain rot |
04:56:08 | FromDiscord | <Hel> funny cause code no work |
04:56:56 | FromDiscord | <Elegantbeef> Json does have a `copy` proc so you can do `jsonCopy = copy jsonData` |
04:58:41 | FromDiscord | <Hel> i needed to copy json but exclude a key |
04:59:00 | FromDiscord | <Hel> doesnt matter anymore found a workaround |
04:59:15 | FromDiscord | <Hel> just make the dude that's gonna work on the api backend format it |
04:59:22 | FromDiscord | <Rika> Lol amazing |
04:59:47 | FromDiscord | <Hel> working on low power cpus |
04:59:56 | FromDiscord | <Hel> i shouldnt even be formatting this stuff |
05:17:47 | FromDiscord | <Elegantbeef> @Hel\: if you're after very good performance you may consider other json implementions, the stdlib json is a bit slow comparatively |
05:19:40 | FromDiscord | <Hel> yeah i know |
05:19:55 | FromDiscord | <Hel> right now the program is just proof of concept |
05:20:58 | FromDiscord | <ajusa> Is Jason faster than jsony? Or just old benchmarks |
05:21:12 | FromDiscord | <Elegantbeef> No clue, benchmark yourself to see |
05:21:32 | FromDiscord | <sOkam!> is there a way to exit a nimscript early? something like bash's `exit` of sorts |
05:22:36 | FromDiscord | <ajusa> Fair point, I assumed you knew everything 😄 |
05:23:02 | FromDiscord | <sOkam!> In reply to @ajusa "Fair point, I assumed": he almost does though, you are not too far from reality 🙈 |
05:29:37 | FromDiscord | <Elegantbeef> I know nothing! |
05:29:46 | FromDiscord | <Elegantbeef> That's a reference that'll probably not land for 99.9% of people |
05:39:58 | FromDiscord | <Rika> I don’t get it |
05:40:42 | FromDiscord | <Elegantbeef> It's a hogan's heroes' reference which is a sitcom from the 60/70s iirc |
05:42:34 | FromDiscord | <abdu> How is coder mean to exit or quit in nim syntax ? |
05:43:13 | FromDiscord | <Rika> In reply to @sOkam! "is there a way": Quit? |
05:43:24 | FromDiscord | <Rika> Does os.quit work in script? |
05:43:38 | FromDiscord | <abdu> (edit) "is" => "if" | "mean" => "means" |
05:53:02 | FromDiscord | <sOkam!> In reply to @Rika "Does os.quit work in": maybe not? https://media.discordapp.net/attachments/371759389889003532/942297295603499028/unknown.png |
05:53:24 | FromDiscord | <Rika> Import not include… |
05:53:30 | FromDiscord | <sOkam!> oh sry |
05:54:14 | FromDiscord | <sOkam!> hmmm nvm https://media.discordapp.net/attachments/371759389889003532/942297598251917362/unknown.png |
06:03:12 | FromDiscord | <Rika> Well I wasn’t too sure about it either |
06:18:50 | FromDiscord | <JSONBash> has anyone gotten https://github.com/wltsmrz/nimler working on M1? |
06:23:06 | FromDiscord | <haolian9 (高浩亮)> i'd say have you googled before asking? |
06:26:01 | FromDiscord | <JSONBash> yeah, couldn't find anything outside an issue on the repo for macOS |
06:29:14 | FromDiscord | <Elegantbeef> Seems it just needs so defines for arch, could be wrong |
06:31:00 | FromDiscord | <JSONBash> any resources on how I could do that? |
06:33:02 | FromDiscord | <Elegantbeef> https://github.com/wltsmrz/nimler/blob/56c08c22db49c2986a05866ee0d274042946314b/nimler/bindings/erl_nif.nim#L171 atleast i think this maps to the procedure in question |
06:34:09 | FromDiscord | <Elegantbeef> perhaps elxir might not have it named the same on arm |
06:35:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Ps3 |
06:36:21 | FromDiscord | <JSONBash> This might be a bit over my head for now... |
06:37:02 | FromDiscord | <Elegantbeef> I mean i think you just need to check if the OS is arm and if so give the procedure the proper name, it's an odd discrepancy i'd wager with x86 and arm |
06:37:06 | FromDiscord | <Elegantbeef> Though it could also just be clang |
06:38:31 | FromDiscord | <Elegantbeef> Ship me a m1 mac and i'll look at it 😛 |
06:40:01 | FromDiscord | <Elegantbeef> Actually what's your `erl_nif.h` look like? |
06:47:40 | FromDiscord | <JSONBash> https://media.discordapp.net/attachments/371759389889003532/942311042875293716/erl_nih.h |
06:49:04 | FromDiscord | <Elegantbeef> Ah there is an `erl_nif_api_funcs.h` apparently 😀 |
06:50:03 | FromDiscord | <JSONBash> https://media.discordapp.net/attachments/371759389889003532/942311644258795580/erl_nif_api_funcs.h |
06:50:07 | FromDiscord | <JSONBash> there is |
06:50:41 | FromDiscord | <Elegantbeef> Eh it's defined there, so yea perhaps just need a flag to clang |
06:51:40 | FromDiscord | <Elegantbeef> Thought it does have an added `_` so perhaps removing the `cdecl` here https://github.com/wltsmrz/nimler/blob/develop/nimler/bindings/erl_nif.nim#L8 might help |
06:52:20 | FromDiscord | <Elegantbeef> I'm just wildly throwing stuff and seeing if anything sticks |
06:53:45 | FromDiscord | <JSONBash> not super experienced with C so I am not sure what that even means |
06:54:00 | FromDiscord | <Elegantbeef> What means? |
06:54:23 | FromDiscord | <Elegantbeef> I'm tired that's a calling convention |
06:54:29 | FromDiscord | <Elegantbeef> Disregard the cdecl comment |
06:54:30 | FromDiscord | <JSONBash> how to add flag, and what cdecl does |
06:55:01 | FromDiscord | <Elegantbeef> well to add a flag you just do `--passC:"cCompilerFlagHere"` but the issue is i dont know if i'm write with that assumption |
06:55:30 | FromDiscord | <Elegantbeef> I'm just guessing that it's lacking a flag which causes it to improperly compile this code, i'm probably 120% wrong |
06:57:41 | FromDiscord | <JSONBash> could this be it? http://erlang.org/pipermail/erlang-questions/2011-June/059679.html |
06:58:06 | FromDiscord | <JSONBash> although it usses gcc i think |
06:58:58 | FromDiscord | <Elegantbeef> well you can try `--passC:"-bundle -flat_namespace -undefined suppress"` and see if that works |
06:59:34 | FromDiscord | <Elegantbeef> That's also 2011 so rather dated 😛 |
07:00:23 | FromDiscord | <JSONBash> nah i still got the same errors 😦 |
07:02:14 | FromDiscord | <Elegantbeef> Shared isnt passed that i can see from Nim, so yea not a clue |
07:03:03 | FromDiscord | <JSONBash> ah oh well, I got a spare x86 linux box lying around |
07:03:29 | FromDiscord | <Elegantbeef> Try it with clang on the linux box as a test for shits and giggles |
07:05:06 | FromDiscord | <Rika> Gits and shiggles |
07:05:59 | FromDiscord | <JSONBash> whats the falg for choosing compiler again? |
07:06:19 | FromDiscord | <Elegantbeef> `--cc:clang` |
07:06:34 | FromDiscord | <ynfle> In reply to @treeform "Sort of, it requires": Is it just cers? |
07:06:38 | FromDiscord | <ynfle> (edit) "cers?" => "certs?" |
07:06:39 | FromDiscord | <Rika> I was wondering what “falg” meant |
07:06:43 | FromDiscord | <ynfle> I don't mind |
07:06:55 | FromDiscord | <JSONBash> yeah it works fine for clang lol |
07:07:16 | FromDiscord | <JSONBash> In reply to @Rika "I was wondering what": it means I got fat fingers |
07:07:37 | FromDiscord | <haolian9 (高浩亮)> sorry for the timing i input, i wasnt meant to say that to your question↵(@JSONBash) |
07:08:33 | FromDiscord | <Elegantbeef> How dare you! They're so offended they didnt even mention it! Big old sarcasm indicator here |
07:09:20 | FromDiscord | <treeform> In reply to @ynfle "Is it just certs?": You need to follow all of the steps in this article to get hottie to work on mac. |
07:09:24 | FromDiscord | <treeform> http://os-tres.net/blog/2010/02/17/mac-os-x-and-task-for-pid-mach-call/ |
07:09:55 | FromDiscord | <JSONBash> In reply to @haolian9 (高浩亮) "sorry for the timing": ah no problem! |
07:10:37 | FromDiscord | <Elegantbeef> Json perhaps make a forum post, something more permanent is better |
07:14:35 | FromDiscord | <ynfle> In reply to @treeform "You need to follow": It doesn't even compile for me |
07:15:57 | FromDiscord | <ynfle> Same compiler error as on your CI |
07:17:30 | FromDiscord | <JSONBash> Yeah I will do that, probably best for other if it gets solved |
09:21:32 | * | mjsir911 quit (Quit: Goodbye, World!) |
09:21:47 | * | mjsir911 joined #nim |
09:22:52 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
09:22:59 | FromDiscord | <DevNugget> are there any places that have good learning resources for Nim? I really like how Nim works but I am having a very hard time to try and learn things or see how some program would be written in NIm unlike C or Python which has a bunch of tutorials online |
09:23:31 | * | jjido joined #nim |
09:25:07 | * | jmdaemon joined #nim |
09:34:35 | nrds | <Prestige99> I'd say just look through https://nim-lang.org/documentation.html |
09:55:55 | FromDiscord | <demotomohiro> After you read an official tutorial, my Nim FAQ might help learning Nim. https://internet-of-tomohiro.netlify.app/nim/faq.en.html |
09:58:56 | nrds | <Prestige99> oh cool page |
09:59:03 | FromDiscord | <evoalg> there are also books, like\: https://www.manning.com/books/nim-in-action?query=nim%20in%20action and http://ssalewski.de/nimprogramming.html |
10:07:14 | NimEventer | New Nimble package! crowncalc - Basic calculator in Nim, see https://github.com/RainbowAsteroids/crowncalc |
10:58:09 | * | pro joined #nim |
11:17:16 | NimEventer | New question by itil memek cantik: Move to usage of nre from that of re, see https://stackoverflow.com/questions/71100123/move-to-usage-of-nre-from-that-of-re |
11:25:04 | FromDiscord | <untoreh> is the long term plan of nimscript to reach full nim support? |
11:26:22 | FromDiscord | <Abi> <@&371760044473319454> hey, I'm being sent bitcoin spams by someone I've only got this server in common with↵ID is 940906321035788308 https://media.discordapp.net/attachments/371759389889003532/942381180240678932/Screenshot_20220213-112517_Discord.png |
11:28:08 | FromDiscord | <Trixarian> https://media.discordapp.net/attachments/371759389889003532/942381625403117618/Screenshot_20220213_132730_com.discord.jpg |
11:28:10 | FromDiscord | <Trixarian> Same |
11:28:30 | FromDiscord | <T-taku> I got spam↵↵940908652242550834 https://media.discordapp.net/attachments/371759389889003532/942381715400314911/IMG_1786.png |
11:29:47 | FromDiscord | <Sh1be> Same |
11:30:46 | FromDiscord | <jakkn> Same here |
11:32:21 | FromDiscord | <Schelz> ay yo just to know <@!940903397626900491> is scammer and message person like me saying they win 5 eth |
11:32:32 | FromDiscord | <Schelz> dont click on that link its a scam |
11:32:49 | FromDiscord | <Schelz> https://media.discordapp.net/attachments/371759389889003532/942382799195865098/unknown.png |
11:33:18 | FromDiscord | <Yardanico> banned them all already |
11:39:14 | FromDiscord | <Rika> In reply to @untoreh "is the long term": Not that I know of, no |
11:51:22 | * | pro quit (Quit: pro) |
11:52:52 | * | pro joined #nim |
12:00:42 | FromDiscord | <enthus1ast> Does someone has a strong feeling about, changeing mimetypes from a OrderedTableRef to a OrderedTable? (so that it works on compile time) |
12:04:07 | FromDiscord | <noow> it's also important to report all such incoming messages |
12:04:14 | FromDiscord | <noow> after blocking them you can report them as spam |
12:04:29 | FromDiscord | <Rika> You can just report and afaik it will also block |
12:04:55 | FromDiscord | <noow> i just hope discord won't start mandating phone numbers for everyone because of these spammers |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.4) |
12:06:07 | FromDiscord | <Rika> Is there a solution to spam other than personal identification and captcha? Just wondered |
12:06:55 | * | supakeen joined #nim |
12:08:21 | FromDiscord | <mratsim> In reply to @Rika "Is there a solution": You can have captcha that bots can't solve unless authors put efforts that aren't worth it. |
12:08:59 | FromDiscord | <mratsim> personally I just disable messages unless from servers I'm mod for |
12:09:09 | FromDiscord | <mratsim> (because bots don't message mods ;)) |
12:09:55 | FromDiscord | <Rika> Same here, except I do it for all servers I’m not closely integrated with, since bots DO message mods, as long as they’re named weirdly |
12:12:41 | FromDiscord | <demotomohiro> In reply to @Elegantbeef "<@288750616510201856>\: btw for https://internet-of": Thank you! I will add the link. |
12:23:45 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
12:33:31 | * | arkurious joined #nim |
12:41:59 | FromDiscord | <noow> In reply to @Rika "Is there a solution": autodeleting old accounts not logged in for 3+ months |
12:42:05 | FromDiscord | <noow> or 6+ |
12:42:50 | FromDiscord | <noow> mandatory 2FA |
12:43:01 | FromDiscord | <noow> these could reduce reuse of hacked accounts i guess |
12:44:08 | FromDiscord | <noow> and what servers can do is to set up a welcome room which prevents bots from seeing the member list |
12:49:38 | FromDiscord | <exelotl> I remember hearing that welcome rooms don't work because the API still gives them the member list |
12:49:40 | FromDiscord | <haxscramper> Most servers use welcom room |
12:49:48 | FromDiscord | <haxscramper> (edit) "welcom" => "welcome" |
12:50:06 | FromDiscord | <exelotl> I might be wrong though |
13:03:40 | * | jjido joined #nim |
13:04:02 | FromDiscord | <noow> what about honeypots |
13:04:35 | FromDiscord | <noow> userbots that are not visible in the userlist to real people but visible through the API |
13:04:45 | FromDiscord | <noow> of course discord probably would have a say |
13:04:51 | FromDiscord | <noow> they don't seem to appreciate userbots |
13:05:16 | FromDiscord | <Rika> They do not |
13:05:36 | FromDiscord | <noow> but it does sound like a theoretical solution |
13:05:37 | * | jmdaemon quit (Ping timeout: 240 seconds) |
13:05:39 | FromDiscord | <Rika> In reply to @noow "autodeleting old accounts not": They auto ban them already pm |
13:05:48 | FromDiscord | <Rika> In reply to @noow "mandatory 2FA": Prolly a nice idew |
13:05:51 | FromDiscord | <Rika> Idea |
13:06:17 | FromDiscord | <exelotl> The most regular attack I've experienced is: 50 bots join the server, they each DM a random person |
13:06:43 | FromDiscord | <exelotl> So honeypots wouldn't help much there I guess |
13:07:03 | FromDiscord | <noow> ah, they probably don't want to trigger discord's checks with DM'ing many people at once |
13:07:43 | FromDiscord | <noow> yeah you're right |
13:10:16 | FromDiscord | <noow> what if there was another kind of captcha, which worked on the basis of computational power needing to be used to perform actions such as joining servers or DM'ing people |
13:10:21 | FromDiscord | <noow> instead of bothering the user |
13:10:46 | FromDiscord | <Rika> So now it's just like bitcoin and everyone's gonna get mad at it being wasteful |
13:11:17 | FromDiscord | <noow> i was thinking more like a password key derivation function |
13:11:37 | FromDiscord | <noow> from invite link or user ID to the actual server/user DM api path or something |
13:12:53 | FromDiscord | <noow> In reply to @Rika "So now it's just": captchas sound more wasteful |
13:13:03 | FromDiscord | <Rika> In terms of what |
13:13:10 | FromDiscord | <Rika> Energy? No, time? Yes |
13:13:20 | FromDiscord | <noow> human time translates to computers being turned on longer |
13:13:35 | FromDiscord | <Rika> Computers have sleep states you know |
13:13:42 | FromDiscord | <Rika> Sleep and reduced power states |
13:14:14 | FromDiscord | <noow> i guess |
13:14:37 | FromDiscord | <noow> also, all energy consumed by home computers is converted to heat, which lowers heating costs |
13:14:53 | FromDiscord | <noow> so useless computations on my PC do not actually increase my energy bill I think |
13:15:21 | * | pro quit (Quit: pro) |
13:15:22 | FromDiscord | <noow> except for people living in areas of the world where the outside temperature is above room temperature |
13:17:27 | FromDiscord | <Rika> Which is a good portion of the world haha |
13:17:34 | FromDiscord | <Rika> Also doesn't account for summers |
13:17:48 | FromDiscord | <Rika> Very nice nim discussion were having here |
13:30:35 | * | pro joined #nim |
13:41:37 | * | PMunch joined #nim |
14:26:30 | * | pro quit (Quit: pro) |
14:27:50 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
14:32:59 | FromDiscord | <Waldecir Santos> How can I unpack a seq and use its valus in a proc that has a `varargs` ? I can do this in. python with ``, thanks in advance |
14:35:43 | FromDiscord | <demotomohiro> https://play.nim-lang.org/#ix=3PtM |
14:37:00 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/manual.html#types-varargs |
14:37:28 | FromDiscord | <Waldecir Santos> It should work automagically right ? |
14:37:44 | FromDiscord | <demotomohiro> yes |
14:38:15 | FromDiscord | <Waldecir Santos> Ok let me check why it's not working here, I'm creating a macro I have a seq[NimNode] and if I pass that to newTree it complains |
14:38:20 | FromDiscord | <demotomohiro> A varargs parameter is an openarray parameter that additionally allows to pass a variable number of arguments to a procedure. |
14:39:28 | PMunch | @Waldecir_Santos, macros can be a bit odd if you aren't used to them. What are you actually trying to do, and how are you calling your macro? |
14:40:35 | FromDiscord | <Waldecir Santos> I'm playing with Macro and AST generation, this is the error `src/playground2.nim(66, 29) Error: expected type, but got: newTree(nnkPragma, node)` |
14:40:47 | FromDiscord | <Waldecir Santos> https://media.discordapp.net/attachments/371759389889003532/942430103693066300/unknown.png |
14:41:16 | PMunch | (Note that macros can take types, but that is the type they will have on runtime, if you want an argument of that type during compile-time you need to use `static`. Ie. `macro test(arg: string)`, `arg` will still be a NimNode, but it is a NimNode that will somehow hold a string when it is compiled. If you do `macro test(arg: static[string])` then it is an actual string type in the body of `test`. |
14:42:06 | FromDiscord | <Waldecir Santos> Yeap I got the static thing. |
14:42:12 | PMunch | Hard to tell without knowing what the `static` part is |
14:42:24 | PMunch | Please try to share a minimal example on the playground |
14:42:51 | FromDiscord | <Waldecir Santos> Sure I'll try to extract it, thank you ! |
14:43:51 | FromDiscord | <Waldecir Santos> I got the error lol |
14:44:03 | FromDiscord | <Waldecir Santos> let me explain |
14:45:08 | FromDiscord | <Waldecir Santos> here we go |
14:45:09 | FromDiscord | <Waldecir Santos> https://media.discordapp.net/attachments/371759389889003532/942431205020815390/unknown.png |
14:45:18 | * | Gustavo6046 quit (Ping timeout: 250 seconds) |
14:45:29 | FromDiscord | <Waldecir Santos> replacing `:` to `=` was the fix, 🤦 |
14:45:37 | PMunch | Haha :P |
14:45:40 | PMunch | Easy mistake to make |
14:45:45 | FromDiscord | <Waldecir Santos> It's learning 😄 I'll get used to it |
14:46:10 | PMunch | Don't worry, I did the exact same mistake a couple days ago and I've been using Nim for years :P |
14:47:33 | FromDiscord | <fowl> Is that code inside a macro? |
14:47:43 | FromDiscord | <Waldecir Santos> Hhaha, the errors messages some still to crypt to me |
14:47:49 | FromDiscord | <Waldecir Santos> @fowl it is. |
14:48:15 | FromDiscord | <fowl> I need to go look at the new stuff I haven’t played with Nim macros in years |
14:48:39 | FromDiscord | <Waldecir Santos> I just started with Nim and Macros haha |
14:48:48 | FromDiscord | <fowl> assertMatch, a dsl for validating AST? |
14:49:20 | FromDiscord | <fowl> That was one of the pain points back in the day |
14:49:48 | FromDiscord | <Waldecir Santos> https://nim-lang.github.io/fusion/src/fusion/matching.html#tree-matching |
14:51:20 | FromDiscord | <fowl> This looks awesome, thank you |
14:51:58 | PMunch | I believe this is the probably more up to date non-fusion version: https://github.com/haxscramper/hmatching |
14:52:12 | FromDiscord | <Waldecir Santos> Yeah I was having huge lines of `if result.matches(` and during my studies found it, and helped alot with verbosity |
14:52:14 | FromDiscord | <DevNugget> In reply to @demotomohiro "After you read an": Thanks! thats very epic! |
14:52:59 | FromDiscord | <Waldecir Santos> In reply to @PMunch "I believe this is": are they the "same" ? what is the diference ? |
14:53:22 | FromDiscord | <Waldecir Santos> at least the doc/readme seems to be the same |
14:54:42 | PMunch | Fusion is basically just a collection of packages from the community which are bundled together and shipped as a sort of extended standard library |
14:55:10 | PMunch | The idea is nice, but it's gotten some critique for being slow to update I believe |
14:59:11 | FromDiscord | <Waldecir Santos> got it, so I should be better served from `hmatching`. ? |
15:00:17 | PMunch | Maybe |
15:11:51 | FromDiscord | <haxscramper> In reply to @Waldecir Santos "are they the "same"": fusion/matching is unmaintained unless araq finds someone who is willing to put up with the fusion bullshit |
15:12:24 | FromDiscord | <haxscramper> the package has ~6 months of patches/fixes that weren't merged in because he "didn't get notification emails" or something like that |
15:13:20 | FromDiscord | <haxscramper> I basically copied the last PR that was left to rot in the fusion and put it into my own repo |
15:17:27 | FromDiscord | <haxscramper> In reply to @Waldecir Santos "got it, so I": Depending on, but yes, if there is an interest in this I will continue to provide support for the package |
15:18:21 | FromDiscord | <Waldecir Santos> Perfect, I'll move to hmatching, thank you ! |
15:22:45 | FromDiscord | <haxscramper> PMunch: if you are planning to work on json support for documentation genration for `nim doc` you can take a look at the https://github.com/nim-works/nimskull/pull/224, specifically https://github.com/haxscramper/nimskull/blob/docgen3/compiler/tools/docgen_types.nim and https://github.com/haxscramper/nimskull/blob/docgen3/compiler/tools/docgen_sqlite.nim - I think that sqlite database can be more useful in general, and serialization |
15:24:19 | PMunch | Thanks |
15:24:24 | FromDiscord | <haxscramper> If you are interested in example database generated https://media.discordapp.net/attachments/371759389889003532/942441078278225940/tfile.sqlite |
15:24:40 | PMunch | I already have a pretty good idea on how I would achieve this, but its quite a lot of work |
15:24:42 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3Pvi |
15:24:43 | FromDiscord | <haxscramper> this is the code this was generated from |
15:25:07 | FromDiscord | <haxscramper> my PR also (re)implements support for sourcetrail, so I track usage information as well |
15:25:13 | FromDiscord | <haxscramper> aka "rank procs by usage count" |
15:25:25 | FromDiscord | <haxscramper> "find all calls between thos two files" |
15:25:56 | FromDiscord | <haxscramper> "is this optional argument really used anywhere?" |
15:25:58 | FromDiscord | <haxscramper> and so on |
15:26:46 | PMunch | Oh that's pretty cool |
15:26:49 | FromDiscord | <Waldecir Santos> What is nimskull 🤔 |
15:27:24 | FromDiscord | <haxscramper> In reply to @PMunch "I already have a": docgen3.nim is a place for the analysis pass, `use_registration` and `file_tracking` is for sourcetrail/usage |
15:27:43 | FromDiscord | <haxscramper> they should be pretty self-contained, at least I tried to make them so as much as possible |
15:28:04 | FromDiscord | <haxscramper> if you want you can just take docgen3.nim verbatim and hack on top of it |
15:28:09 | FromDiscord | <haxscramper> In reply to @Waldecir Santos "What is nimskull 🤔": nim fork |
15:30:14 | PMunch | I mean my idea was to simply remove json and latex generation, then rewrite every part of the HTML output to JSON output. While doing that I would write a program which converted the JSON back into HTML, and make sure that `nim doc` would call that program with all arguments related to documentation generation |
15:30:23 | FromDiscord | <Waldecir Santos> Sure I'm just not sure what is is trying to solve, and why is it in a fork and not in the main |
15:31:02 | PMunch | It's made by a loose collective of contributors who didn't like how Nim was managed, especially in regards to contributions and planning |
15:31:54 | PMunch | They wanted to do things differently, so they forked Nim as NimSkull and do their own thing there. Haven't really looked into how much they've actually gotten done since the fork though |
15:32:04 | FromDiscord | <haxscramper> that would be a N+20th iteration of the same rant, so for the sake of keeping it short - PMunch is mostly correct |
15:32:43 | FromDiscord | <haxscramper> Mostly because we care about things that are completely neglected in the mainline |
15:33:25 | FromDiscord | <Waldecir Santos> Got it, no worries, just trying to understand the ecosystem |
15:33:56 | FromDiscord | <haxscramper> Such as quality error messages (aka "I give up and accept I'm the only one left who doesn't like clang's / Rust's / Elm's error messages."), refactoring the decade-old pile of garbage, thinking ahead about tooling UX, having actual spec and so on. |
15:36:01 | FromDiscord | <haxscramper> In reply to @PMunch "I mean my idea": that might be easier to implement, although I'm not sure if that is what will be beneficial for the long-term improvements. Maybe I just don't really like use of json as an IR format for this. If things are kept in types you can serialize them in different ways, but with json you are mostly going to do tree trasnforms |
15:36:26 | FromDiscord | <haxscramper> although if the objective is simply to enable different html frontends then it is probably fine |
15:37:21 | FromDiscord | <b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3Pvn |
15:37:38 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3Pvo |
15:37:41 | FromDiscord | <b4mbus> oh boy oh boy |
15:37:43 | FromDiscord | <b4mbus> that looks handsome |
15:37:45 | FromDiscord | <b4mbus> thanks |
15:45:05 | PMunch | Blocks and scopes can be used for lots of fun stuff: https://peterme.net/tips-and-tricks-with-implicit-return-in-nim.html |
15:49:18 | PMunch | Hmm fun, someone shared an presentation about website page bloat. So I got curious. Apparently my page is quite light, the above article is only 627kB |
15:49:23 | PMunch | Most of that is fonts though |
15:50:17 | FromDiscord | <haxscramper> just serve `.txt` |
16:01:31 | * | jjido joined #nim |
16:04:23 | PMunch | But that's boring |
16:32:57 | * | [R] quit (Ping timeout: 240 seconds) |
16:33:15 | FromDiscord | <b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3PvG |
16:34:24 | * | [R] joined #nim |
16:35:00 | FromDiscord | <b4mbus> (I'm using WSL2, `Linux stacjonarny 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 GNU/Linux`, shell `fish`) |
16:35:07 | FromDiscord | <haxscramper> `import std/unicode` |
16:35:18 | FromDiscord | <haxscramper> `for rune in runes(<your text here>)` |
16:35:56 | FromDiscord | <haxscramper> I think it would be `toCounTable(mapIt(runes(text)))` |
16:36:08 | FromDiscord | <haxscramper> (edit) "`toCounTable(mapIt(runes(text)))`" => "`toCounTable(toSeq(runes(text)))`" |
16:36:15 | FromDiscord | <haxscramper> `toSeq` is from `sequtils` |
16:36:52 | FromDiscord | <b4mbus> that indeed does work |
16:36:54 | FromDiscord | <b4mbus> thank you sir |
16:37:20 | FromDiscord | <b4mbus> what is the choice for nim to not support unicode by default? I understand it's quite hard to get right, but there are languages that do it right |
16:37:56 | FromDiscord | <b4mbus> or maybe the strings are utf-8, but iterating over the characters returns bytes and not codepoints? |
16:37:59 | FromDiscord | <haxscramper> nim supports unicode |
16:38:13 | FromDiscord | <haxscramper> just string is an array of utf-8 bytes |
16:38:21 | FromDiscord | <b4mbus> oh that makes sense |
16:38:24 | FromDiscord | <b4mbus> and `rune` is a codepoint? |
16:38:44 | FromDiscord | <haxscramper> rune is a codepoint, yes |
16:39:11 | FromDiscord | <b4mbus> Im sorry for asking questions instead of asking, but my internet connection is basically dead for a few days now and it's 10x faster for me to ask a question instead of simply googling it |
16:39:16 | FromDiscord | <b4mbus> In reply to @haxscramper "rune is a codepoint,": 🙏 |
16:39:25 | FromDiscord | <b4mbus> (edit) "asking," => "googling," |
16:40:13 | FromDiscord | <haxscramper> https://nim-lang.org/docs/lib.html read module links from here, most of the google searches will point to one of these pages anyway |
16:40:32 | FromDiscord | <haxscramper> also IIRC there is a prebuilt HTML documentation somewhere, but I don't really remember where it was |
16:42:22 | anddam | howdy nimfolks |
16:42:40 | FromDiscord | <b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3PvI |
16:43:29 | FromDiscord | <b4mbus> (edit) "https://play.nim-lang.org/#ix=3PvI" => "https://play.nim-lang.org/#ix=3PvJ" |
16:43:41 | FromDiscord | <b4mbus> (edit) "https://play.nim-lang.org/#ix=3PvJ" => "https://play.nim-lang.org/#ix=3PvK" |
16:44:11 | FromDiscord | <haxscramper> because `runes` is an inlien iterator that can only be called in the `for` loop context |
16:44:18 | FromDiscord | <b4mbus> (edit) "https://play.nim-lang.org/#ix=3PvK" => "https://play.nim-lang.org/#ix=3PvL" |
16:44:30 | FromDiscord | <haxscramper> I'm pretty sure this message has more lines in it, like "found iterator XX" |
16:44:35 | FromDiscord | <haxscramper> but yeah, it is not really readable |
16:45:06 | FromDiscord | <b4mbus> Cool, I guess should just read up more on the docs but they load forever for me, I can barely read discord's chat |
16:45:20 | FromDiscord | <b4mbus> In reply to @haxscramper "but yeah, it is": It's fine, the language is amazing anyway, but it surely would be cool if the compiler was more helpful |
16:45:45 | FromDiscord | <haxscramper> well, I"m the wrong person to talk about compiler messages, but I can certainly relate |
16:47:31 | FromDiscord | <b4mbus> thanks |
17:03:34 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
17:10:18 | FromDiscord | <abdu> sent a long message, see http://ix.io/3PvW |
17:10:40 | * | jjido joined #nim |
17:15:10 | FromDiscord | <haxscramper> `import re` is deprecated, use `import std/re` |
17:15:28 | FromDiscord | <haxscramper> they are equivalent, but importing without `std/` prefix is deprecated |
17:40:59 | FromDiscord | <huantian> Why did they delete their message? |
17:43:24 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
17:50:03 | FromDiscord | <haolian9 (高浩亮)> are there resources for learning FFI of nim? something like data type translation between nim and c which is missing in the official manual |
17:59:38 | FromDiscord | <b4mbus> sent a long message, see http://ix.io/3Pwg |
17:59:44 | FromDiscord | <b4mbus> Im talking an idiomatic way, not a plain for loop |
17:59:49 | FromDiscord | <b4mbus> unless there aint such a way? |
18:03:02 | FromDiscord | <huantian> I’d say for loop modifying a string is the best |
18:05:11 | FromDiscord | <b4mbus> well that sucks |
18:05:30 | FromDiscord | <b4mbus> but aight, hand-implementation |
18:06:24 | Amun-Ra | endians still fails to build on js target in 1.6.4 |
18:06:59 | anddam | I canno make sense of https://github.com/nimgl/nimgl the install instructions are just "nimble install nimgl" |
18:07:13 | anddam | yet I cannot use any of the examples I tried with "nim c -r somexample.nim" |
18:07:45 | Amun-Ra | do you have nimble and nimgl installed? |
18:08:03 | anddam | I do |
18:08:21 | Amun-Ra | what's the error? |
18:08:22 | anddam | I just updated nim to 1.6.4, cleaned all nimble packages, installed nimgl with "nimble install nimgl" |
18:08:52 | anddam | also I cloned nimgl/nimgl , updated its submodules for good measure and moved into examples/ |
18:09:44 | anddam | oh twait, twebgl does work, floating green window |
18:10:10 | anddam | topengl says /home/anddam/Development/nim/nimgl-nimgl-git/examples/topengl.nim(5, 8) Error: cannot open file: glm |
18:10:28 | anddam | timgui says could not load: cimgui.so |
18:10:52 | anddam | this I stumbled on already and Yardanico_ helped building cimgui lib |
18:11:20 | anddam | but what I gather from then was that I needed to do that because I was trying to use nimgl/imgui repo, that was not packaged for nimble |
18:11:51 | anddam | now I am installing a nimble package, I somehow expected things to work, or at least to tell me "you need to install this and this other library as well" someplace |
18:23:14 | FromDiscord | <b4mbus> In reply to @b4mbus "what would be the": ok I got it with `string.reversed().insertSep(' ', 2)` |
18:26:43 | FromDiscord | <rishav> For options, is it possible to pack something in the none return? I want both the success and failure states to pass some extra information.↵For example, i really want to return something like `none(42)` instead of `none(int)`.↵Anyway to achieve this? |
18:27:37 | Amun-Ra | nope, none is none |
18:28:24 | FromDiscord | <demotomohiro> How about to return tuple? like `return (none, 42)` |
18:28:37 | Amun-Ra | looks like you need a tagged union or sth |
18:29:40 | FromDiscord | <rishav> sent a code paste, see https://play.nim-lang.org/#ix=3Pwp |
18:33:35 | * | jjido joined #nim |
18:33:45 | FromDiscord | <auxym> Consider this? https://github.com/arnetheduck/nim-result |
18:34:50 | FromDiscord | <auxym> In reply to @haolian9 (高浩亮) "are there resources for": not aware of anything except manual or c2nim docs. You're right though that extra docs would be needed. Do feel free to ask questions here. |
18:42:32 | FromDiscord | <Waldecir Santos> @haxscramper the matched variable is passed by ref if not how should I do it ? I'm matching identdefs looping and changing some values but it get lost after I leave the if matches context |
18:44:05 | * | jmdaemon joined #nim |
18:44:39 | FromDiscord | <haxscramper> there is no "pass by ref" in nim, there is a `ref` type, it is different from C++ `&` ref. And match branch creates a number of `var matchedName` placeholders that get assigned to it |
18:45:13 | FromDiscord | <haxscramper> `if matches()`'s scope is created by `if`, so all variables injected by `matches` are available only in `if` scope |
18:45:34 | FromDiscord | <Waldecir Santos> This is what I did, basically "replaces" a Ident Node with a PragmaExpr: |
18:45:41 | FromDiscord | <Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3Pwz |
18:46:12 | FromDiscord | <haxscramper> there is no matching call here |
18:46:17 | FromDiscord | <Waldecir Santos> Got it any advice for using the match and replace the body part in a macro |
18:46:45 | FromDiscord | <Waldecir Santos> https://media.discordapp.net/attachments/371759389889003532/942492007295746108/unknown.png |
18:46:51 | FromDiscord | <Waldecir Santos> Here it's the full test code. |
18:47:01 | FromDiscord | <haxscramper> https://nim-lang.org/blog/2021/03/10/fusion-and-pattern-matching.html |
18:47:17 | FromDiscord | <haxscramper> this is an article I wrote for use of the library in pattern matching |
18:47:21 | FromDiscord | <haxscramper> in macros |
18:47:50 | FromDiscord | <Waldecir Santos> sure, thank you |
18:48:08 | FromDiscord | <haxscramper> well, you are using it correctly, at least as far as matching is concerned |
18:48:22 | FromDiscord | <Waldecir Santos> Glad to hear it, thank you |
18:48:44 | FromDiscord | <haxscramper> also https://www.youtube.com/watch?v=GJpn6SfR_1M |
18:49:17 | FromDiscord | <Waldecir Santos> Is that you ? Thanks for sharing it. |
18:49:57 | FromDiscord | <haxscramper> no, someone else made a series of videos on nim, and one of them was about pattern matching |
19:08:21 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
19:10:58 | * | rockcavera joined #nim |
19:10:58 | * | rockcavera quit (Changing host) |
19:10:58 | * | rockcavera joined #nim |
19:16:10 | FromDiscord | <haolian9 (高浩亮)> i almost have no concept about FFI, in which case i hardly can ask question using accurate keywords; but thanks to mention c2nim that shows me a light!↵(@auxym) |
19:20:35 | FromDiscord | <auxym> In reply to @haolian9 (高浩亮) "i almost have no": Check this out for FFI against a dynamic library: https://xmonader.github.io/nimdays/day03_libmagic.html |
19:21:37 | FromDiscord | <auxym> static library is similar but you'd use the `header` pragma instead of `dynlib`. And somehow link the lib in your build |
19:23:17 | FromDiscord | <auxym> eg using `--clib` or `{.link.}` or `{.compile.}` |
19:28:44 | * | jjido joined #nim |
19:33:48 | * | vicfred joined #nim |
19:34:14 | * | vicfred quit (Remote host closed the connection) |
19:34:37 | * | vicfred joined #nim |
19:37:23 | * | PMunch quit (Quit: leaving) |
19:59:23 | * | vicfred quit (Quit: Leaving) |
20:14:56 | * | Gustavo6046 joined #nim |
21:39:49 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
21:51:43 | * | arkurious quit (Quit: Leaving) |
22:21:45 | * | jjido joined #nim |
22:33:30 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
23:16:22 | FromDiscord | <abdu> What this error solution :↵Error: unhandled exception: Can't obtain a value from a `none` [UnpackDefect] |
23:17:20 | nrds | <Prestige99> Need to check if yourOption.isSome first? |
23:17:39 | nrds | <Prestige99> https://nim-lang.org/docs/options.html#isNone%2COption%5BT%5D isNone and isSome |
23:19:42 | * | Gustavo6046 quit (Quit: Leaving) |
23:23:26 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
23:24:34 | FromDiscord | <Elegantbeef> TO elaborate `Defect` s are logical issues which can easily be resolved with checks like prestige eluded to |
23:27:14 | * | jmdaemon joined #nim |
23:35:13 | arkanoid | how can I write and get a list with parsecfg? |
23:35:20 | arkanoid | it seems only key:value |
23:35:58 | FromDiscord | <Elegantbeef> The jovial side of me cannot help but say "use toml" 😀 |
23:36:18 | FromDiscord | <Arathanis> or yaml |
23:37:05 | FromDiscord | <Arathanis> i think config files which are generally `ini` files are pretty strictly key:value (as string). But if you know its a string representation of a list it shouldn't be too hard to parse your sequence our using split, etc |
23:37:17 | FromDiscord | <Arathanis> (edit) "our" => "out" |
23:37:21 | arkanoid | yeah but it is ugly |
23:37:30 | arkanoid | well, let's move to yaml |
23:37:58 | FromDiscord | <Arathanis> well if you make a nice proc to parse the sequence out you can make it beautiful but i like yaml a lot better anyway so I cant say I disagree with you |
23:42:56 | * | xet7 quit (Read error: Connection reset by peer) |
23:54:15 | FromDiscord | <huantian> to misquote a youtuber, I use yaml because I love myself |
23:58:30 | * | xet7 joined #nim |