00:05:36 | FromDiscord | <rainbowasteroids> sent a code paste, see https://play.nim-lang.org/#ix=3PaW |
00:14:34 | FromDiscord | <Elegantbeef> prestige spent some time to progress the `impl` macro even further if you're around https://play.nim-lang.org/#ix=3PaX |
00:14:44 | FromDiscord | <Elegantbeef> Now have somewhat of runtime interfaces |
00:15:05 | FromDiscord | <Elegantbeef> No clue rainbow, if you want it catchable inherit from the `CatchableError` dont see why you wouldnt |
00:15:38 | FromDiscord | <rainbowasteroids> I'm just curious, because `CatchableError` is defined as `object of Exception` |
00:22:12 | FromDiscord | <huantian> it's merely for organizational purposes |
00:26:19 | * | jmdaemon quit (Ping timeout: 256 seconds) |
00:40:39 | * | vicfred quit (Quit: Leaving) |
00:45:35 | FromDiscord | <JSONBash> been a while since I created it but for those who care I created a website a couple of months ago that gives nim related GitHub pages a shorter domain (`<page>.nim.wiki`). I never advertised it but I updated it today and thought it could be useful: https://www.nim.wiki/ |
00:52:43 | nrds | <Prestige99> @Elegantbeef thanks I'll check it out |
00:58:06 | FromDiscord | <b4mbus> Does nim have some kind of RAII? |
00:58:28 | FromDiscord | <b4mbus> or actually any kind of automatic resource handling at the end of scope |
00:58:32 | FromDiscord | <Elegantbeef> `arc` |
00:58:32 | FromDiscord | <Elegantbeef> Yes |
00:58:33 | FromDiscord | <Elegantbeef> `--gc:arc` does it |
00:58:39 | FromDiscord | <b4mbus> oh |
00:58:40 | FromDiscord | <b4mbus> gc |
00:58:53 | FromDiscord | <Elegantbeef> I mean in modern nim it's `mm` |
00:58:57 | FromDiscord | <b4mbus> wait, there are different gc's? |
00:58:59 | FromDiscord | <b4mbus> (edit) "gc's?" => "gcs?" |
00:59:10 | FromDiscord | <Elegantbeef> Yes there are different memory management featurees |
00:59:30 | FromDiscord | <b4mbus> https://nim-lang.github.io/Nim/mm.html |
00:59:31 | FromDiscord | <b4mbus> oh I see |
00:59:47 | FromDiscord | <b4mbus> so does that mean that I dont actually have to `defer close(file)`? |
01:01:37 | * | jmdaemon joined #nim |
01:03:39 | * | vicfred joined #nim |
01:04:26 | FromDiscord | <huantian> if you make a =destroy for files |
01:07:23 | FromDiscord | <Elegantbeef> Nim-sys uses them but it's not fully on par with the Nim stdlib afaik |
01:07:57 | NimEventer | New Nimble package! mdlldk - Dynamic-link libraries (DLLs) Development Kit for mIRC., see https://github.com/rockcavera/nim-mdlldk |
01:08:24 | FromDiscord | <Elegantbeef> Yes you do cause the stdlib hasnt been updated to use them |
01:09:07 | FromDiscord | <sharpcdf> dont know who the mods are but @Inc1usive is a scammer btw |
01:09:16 | FromDiscord | <sharpcdf> dont know for sure but pretty sure they are |
01:10:01 | FromDiscord | <sharpcdf> told me they accidentally reported my steam account and then told me to friend a bunch of people that were "steam mods" |
01:12:36 | FromDiscord | <huantian> can confirm |
01:13:22 | FromDiscord | <sharpcdf> 👍 |
01:14:18 | FromDiscord | <huantian> dmed yard but ig I'll ping @PMunch too |
01:14:46 | FromDiscord | <Iapetus11> Are there mods here? Someone is trying to pull a steam scam on me lol https://media.discordapp.net/attachments/371759389889003532/941140102380400651/unknown.png |
01:14:51 | FromDiscord | <Elegantbeef> Prestige I made it a tinge nicer(albeit more likely to crash) https://play.nim-lang.org/#ix=3Pb5 |
01:15:00 | FromDiscord | <Iapetus11> This is their discord id: 941098341658419281 |
01:15:22 | FromDiscord | <Elegantbeef> Aw shit dude your account is going to go buh bye, you best send me the login credentials so i can stop it! |
01:19:33 | * | arkurious quit (Quit: Leaving) |
01:20:06 | nrds | <Prestige99> :o |
01:22:19 | FromDiscord | <huantian> don't worry this is legit |
01:42:24 | FromDiscord | <Nightshade 🌙> Hey everyone, I was wondering if anyone could point me to some resources for how to create a Windows based device driver in Nim. Are there specific packages and compiler flags I need? |
01:47:01 | * | jmdaemon quit (Ping timeout: 256 seconds) |
01:47:04 | FromDiscord | <Elegantbeef> They have a bunch of samples here https://github.com/Microsoft/Windows-driver-samples seems like you could use their buildsystem mixed with nim's C output |
01:52:22 | FromDiscord | <Nightshade 🌙> In reply to @Elegantbeef "They have a bunch": Ahh awesome idea thank you so much! |
01:54:02 | FromDiscord | <Elegantbeef> I do something similar for the RPI pico and it works ok |
01:54:17 | FromDiscord | <Elegantbeef> Some issues like having to manually include stuff, but no clue if that matters here |
01:54:21 | FromDiscord | <Elegantbeef> Didnt look much into it |
01:58:06 | * | jmdaemon joined #nim |
02:04:31 | FromDiscord | <nekojes> I have a `nim.cfg` with `--app:lib` in it, and I'm trying to compile something in a random subdirectory as a normal executable and for whatever reason `--app:console` doesn't seem to override the earlier `lib`? |
02:05:02 | * | vicfred quit (Quit: Leaving) |
02:05:31 | FromDiscord | <nekojes> am just trying with `nim r --app:console <file` |
02:05:53 | FromDiscord | <Elegantbeef> I think app might not be overridable after a config loads |
02:06:35 | FromDiscord | <nekojes> ...even if it's specified on the cli? |
02:07:18 | FromDiscord | <Elegantbeef> replace that `nim.cfg` with `file.nims` then you shouldnt have a problem |
02:13:31 | FromDiscord | <nekojes> what do you mean? |
02:13:44 | FromDiscord | <rainbowasteroids> there are no scams on matrix yet 😉↵(@Iapetus11) |
02:14:04 | FromDiscord | <Iapetus11> lol |
02:14:14 | FromDiscord | <nekojes> seemslegit |
02:14:44 | FromDiscord | <rainbowasteroids> come to the slightly less spooky side |
02:15:10 | FromDiscord | <Elegantbeef> I mean there are scams it's just easy to block since you have to accept a DM 😀 |
02:15:42 | FromDiscord | <rainbowasteroids> I haven't used matrix enough to get any scams 😆 |
02:15:53 | FromDiscord | <rainbowasteroids> I'm just in the Nim channels and some small community |
02:16:12 | FromDiscord | <Elegantbeef> I mean we've had some scammers here but they post and then get banned |
02:16:35 | FromDiscord | <Nightshade 🌙> In reply to @Elegantbeef "I do something similar": Is there anyway you could share the repo? I'm going through the Microsoft Docs but this definitely seems like uncharted territory |
02:17:02 | FromDiscord | <Elegantbeef> https://github.com/beef331/picostdlib it's nothing overly fancy |
02:18:19 | FromDiscord | <Nightshade 🌙> In reply to @Elegantbeef "https://github.com/beef331/picostdlib it's nothing ": Thank you! |
02:27:26 | * | jmdaemon quit (Ping timeout: 250 seconds) |
02:49:32 | * | rockcavera quit (Remote host closed the connection) |
02:54:40 | * | rockcavera joined #nim |
02:54:40 | * | rockcavera quit (Changing host) |
02:54:40 | * | rockcavera joined #nim |
03:00:59 | FromDiscord | <noow> In reply to @rainbowasteroids "there are no scams": matrix has midov.pl spammers |
03:08:40 | * | jmdaemon joined #nim |
03:13:56 | * | typoholic is now known as tinystoat |
03:39:36 | FromDiscord | <Arathanis> @ElegantBeef can you explain why I need to do this: https://media.discordapp.net/attachments/371759389889003532/941176550148153395/unknown.png |
03:39:40 | FromDiscord | <Arathanis> to make this work: https://media.discordapp.net/attachments/371759389889003532/941176568951234560/unknown.png |
03:40:02 | FromDiscord | <Arathanis> it seems like they are just called `:tmp` w/o an explicit identifier and thus you run into redefinition |
03:40:07 | FromDiscord | <Arathanis> want to make sure i didnt miss anything obvious |
03:45:55 | FromDiscord | <Elegantbeef> I think it might just be the lack of name |
03:46:06 | FromDiscord | <Elegantbeef> i'd just do `nskParam.genSym("message")` and same for `number` |
03:59:08 | FromDiscord | <Elegantbeef> I think `genSym` is a thing that happens after the macro is released so it doesnt increment the `genSym` number for the `""` string |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.4) |
04:06:31 | * | supakeen joined #nim |
04:10:49 | * | Gustavo6046 joined #nim |
04:11:59 | * | Gustavo6046 quit (Max SendQ exceeded) |
04:12:38 | * | Gustavo6046 joined #nim |
04:13:56 | * | Gustavo6046 quit (Remote host closed the connection) |
04:17:20 | FromDiscord | <Arathanis> im playing with making the macro for variable, so i will ultimately need to generate an arbitrary number of symbols |
04:17:45 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3Pbp |
04:17:53 | FromDiscord | <Arathanis> In reply to @Elegantbeef "I think `genSym` is": the number does seem to go up but the identifier doesn't seem to be different |
04:18:53 | FromDiscord | <Elegantbeef> Damn it |
04:18:54 | FromDiscord | <Elegantbeef> sent a long message, see http://ix.io/3Pbq |
04:18:59 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Pbr |
04:20:45 | FromDiscord | <Arathanis> even if they have the same name will it tolerate it? |
04:20:52 | FromDiscord | <Arathanis> guess i can go test that right now |
04:22:32 | FromDiscord | <Elegantbeef> So i guess congrats you found a bug with `genSym` |
04:22:56 | FromDiscord | <Arathanis> oh lol |
04:23:02 | FromDiscord | <Arathanis> well that is neat i guess |
04:23:25 | FromDiscord | <Arathanis> should an issue be made on the git repo? |
04:25:23 | FromDiscord | <Elegantbeef> If one doesnt already exist |
04:25:51 | FromDiscord | <Elegantbeef> So odd i cannot replicate it minimally |
04:27:20 | FromDiscord | <Elegantbeef> Ah nvm it's just when it's used for proc parameters |
04:28:30 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Pbs |
04:29:56 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/issues/17851 this is related |
04:30:18 | FromDiscord | <Elegantbeef> Might be easy to fix, need to look at it |
04:32:52 | FromDiscord | <Elegantbeef> Yep it's a super easy fix |
04:37:55 | * | Gustavo6046 joined #nim |
04:37:58 | * | Gustavo6046 quit (Remote host closed the connection) |
04:48:23 | * | Gustavo6046 joined #nim |
05:01:39 | FromDiscord | <Elegantbeef> I was wrong, it causes C gen issues 😀 |
05:46:23 | FromDiscord | <Arathanis> In reply to @Elegantbeef "I was wrong, it": that sounds... less easy to fix :P |
05:50:14 | FromDiscord | <Elegantbeef> Yea i dont know how to fix it, i stay far away from generator code |
05:54:44 | * | Gustavo6046 quit (Remote host closed the connection) |
05:55:10 | * | Gustavo6046 joined #nim |
05:55:27 | * | Gustavo6046 quit (Client Quit) |
06:11:23 | * | droidrage joined #nim |
07:27:58 | * | PMunch joined #nim |
07:37:48 | * | jjido joined #nim |
08:09:35 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
08:31:10 | * | FromDiscord quit (Remote host closed the connection) |
08:31:22 | * | FromDiscord joined #nim |
08:37:23 | FromDiscord | <Elegantbeef> There we go matrix spam |
08:37:48 | FromDiscord | <Elegantbeef> For otherly located it's a nice long meme name about bitcoin |
08:39:20 | PMunch | There's unfortunately a bug in the Element client I believe so dom96 can't add anyone else as admins in the group :( |
08:41:53 | PMunch | There where some talk about a scammer in the Discord. But by the time I got up I couldn't see the messages any longer |
08:46:12 | FromDiscord | <Elegantbeef> This interface stuff i've been toying with is rather cool, the more I add the niftier it gets |
08:46:54 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3Pc6 though this doesnt allow an interface object created before all the types are added to be interoperable so i guess i'm doing that wrong |
08:56:28 | NimEventer | New Nimble package! nyml - Stupid simple YAML-like implementation from YAML to JsonNode, see https://github.com/openpeep/nyml |
09:01:45 | FromDiscord | <Rika> Wow that’s a nice read me |
09:03:42 | FromDiscord | <Elegantbeef> Yea all their readme's are like that |
09:06:00 | FromDiscord | <Rika> Is it a company or what |
09:06:18 | FromDiscord | <Elegantbeef> It's only a single committer so i think not but i could be wrong |
09:07:56 | FromDiscord | <Elegantbeef> It's weird to see people not active here or on the forums using Nim |
09:12:22 | PMunch | I think it's a very good sign |
09:13:11 | FromDiscord | <Elegantbeef> Yea it's, means either they're lurking or Nim is sufficiently stable that they can use it and learn it without much issue 😀 |
09:13:59 | PMunch | I talked about it a bit with Treeform during FOSDEM. When I started using Nim the community was small enough that everyone know what everyone else was doing. But nowadays I'm constantly surprised by people/companies using Nim whom I've never heard of |
09:14:33 | FromDiscord | <Elegantbeef> Yea you're like "Who the fuck is ElegantBeef, that nobody" 😛 |
09:17:31 | PMunch | That feeling when Ratel which I've spent a lot of time and effort in creating has 22 stars on GitHub, and superlog which I wrote as a PoC for Araq in some random forum post has 15 stars already :P |
09:30:16 | FromDiscord | <Elegantbeef> When do we merge ratel with picostdlib under a single organization 😛 |
09:31:04 | FromDiscord | <evoalg> in bash I can do `echo -e "\033[31;1mHello\033[0m"` to get a red "Hello", and in python I can do `print("\033[31;1mHello\033[0m")` to get the same red "Hello" ... but it doesn't work in Nim (I get a "Warning\: octal escape sequences do not exist; leading zero is ignored [OctalEscape]") |
09:31:21 | FromDiscord | <Elegantbeef> We do have a module to make it more wonderful |
09:33:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Pck |
09:33:20 | FromDiscord | <Elegantbeef> the real solution is just to drop `0` |
09:34:06 | FromDiscord | <Elegantbeef> I dont recall what the actual characters are 😀 |
09:34:46 | FromDiscord | <Elegantbeef> Should note you could invoke the above with `"Hello".writeColoured(fgRed)` |
09:35:08 | FromDiscord | <Rika> Is that not an octal escape? |
09:35:15 | FromDiscord | <Rika> It says that in the error |
09:35:25 | FromDiscord | <Rika> So you have to convert it into decimal or whichever |
09:35:41 | FromDiscord | <Rika> In reply to @Elegantbeef "Should note you could": Just use this instead really |
09:35:55 | FromDiscord | <Elegantbeef> Manually adding colour is for nerds |
09:36:54 | FromDiscord | <Elegantbeef> It's kinda odd that there is `writeStyled` but not a `writeStyle` that takes in a color |
09:38:04 | FromDiscord | <Elegantbeef> Oh there is styled write |
09:38:11 | FromDiscord | <Elegantbeef> so you can do `stdout.styledWrite(fgRed, "hello")` |
09:38:17 | FromDiscord | <evoalg> Thank you beefy that works \:) |
09:38:50 | FromDiscord | <Elegantbeef> Can even do `stdout.styledWrite(fgRed, styleBright, "Hello")` |
09:39:02 | FromDiscord | <Elegantbeef> Never seen that macro before, i feel dumb now |
09:40:13 | FromDiscord | <evoalg> ohhhh ok I didn't try the 2nd one... |
09:40:29 | FromDiscord | <Rika> I still can’t recognise Evo with his new avatar image |
09:41:08 | FromDiscord | <evoalg> hehe |
09:41:32 | FromDiscord | <evoalg> Nice I can to bgRed too |
09:41:40 | * | Gustavo6046 joined #nim |
09:41:42 | FromDiscord | <Elegantbeef> Yep it's the way to do it |
09:41:48 | FromDiscord | <Elegantbeef> I've always manually done it so i feel dumb now |
09:42:30 | FromDiscord | <evoalg> super brains code everything manually |
09:42:37 | FromDiscord | <evoalg> \:w |
09:42:43 | FromDiscord | <evoalg> opps |
09:42:43 | FromDiscord | <Elegantbeef> This isnt vim |
09:43:58 | FromDiscord | <evoalg> Nice, now I can draw some colored squares like `stdout.styledWrite(bgRed, " ")` |
09:44:45 | FromDiscord | <Elegantbeef> Sounds like someone is about to make a TUI game |
09:47:04 | FromDiscord | <evoalg> hehe no I want to draw some simple colored grids |
09:47:16 | FromDiscord | <evoalg> the simplest way possible |
09:49:30 | * | qwestion joined #nim |
10:05:16 | NimEventer | New question by itil memek cantik: To insert a Nim variable into its PCRE regex, see https://stackoverflow.com/questions/71063081/to-insert-a-nim-variable-into-its-pcre-regex |
10:09:53 | FromDiscord | <evoalg> Oh I can also do `echo "\e[31;1mHello"` instead of "\\033[31;1mHello" |
10:11:49 | * | jmdaemon quit (Ping timeout: 240 seconds) |
10:13:33 | Amun-Ra | yes |
10:14:12 | Amun-Ra | \033 is my only usage of octal notation (apart from writing PDP emulators) |
10:15:03 | FromDiscord | <evoalg> \\033 doesn't work but \\e works? |
10:15:08 | FromDiscord | <evoalg> in Nim |
10:15:21 | Amun-Ra | yes |
10:16:26 | FromDiscord | <Elegantbeef> in nim `\033` is taken as the 33rd character, but you want the 27th |
10:16:53 | Amun-Ra | there are no octal literals in nim |
10:16:58 | Amun-Ra | \033 is 33 in dec |
10:17:14 | Amun-Ra | "\e" == "\031" == "\x1f" |
10:18:04 | Amun-Ra | but… I wonder who came up with \c and \L… |
10:19:53 | FromDiscord | <planetis> cariage return and line feed? pbl the ascii guys \:) |
10:20:27 | Amun-Ra | I mean what was the reason to pick \c and \L instead of the standard \r and \n |
10:23:09 | supakeen | both work |
10:23:15 | Amun-Ra | yes |
10:23:32 | supakeen | but why it has both, i don't know either :) |
10:23:51 | supakeen | i'm at least not familiar with any other language that uses \c and \l. |
10:25:31 | FromDiscord | <evoalg> why did \\r and \\n because standard when \\c and \\l makes more sense for carriage return and line feed? |
10:26:25 | * | m5zs7k quit (Ping timeout: 256 seconds) |
10:26:50 | FromDiscord | <Elegantbeef> `return` `newLine` 😀 |
10:26:55 | Amun-Ra | line feed aka new line |
10:27:03 | FromDiscord | <evoalg> ohh |
10:27:28 | * | m5zs7k joined #nim |
10:31:54 | * | kayabaNerve_ joined #nim |
10:34:06 | * | [RMS] joined #nim |
10:34:46 | PMunch | Amun-Ra, well on windows a proper newline is carriage return + linefeed |
10:35:22 | Amun-Ra | and on old macs (~m68k ones) it was CR only |
10:35:23 | PMunch | Earlier versions of Nim used \n to mean linefeed on Linux and carriage return + linefeed on Windows |
10:35:33 | PMunch | You couldn't eg. use \n in a character literal |
10:36:53 | PMunch | That's why two different values where chosen for linefeed and carriage return, in order to ensure they weren't confused with those from other languages. |
10:36:56 | PMunch | I believe |
10:37:08 | Amun-Ra | that makes sense |
10:37:10 | PMunch | Might be wrong though |
10:37:58 | arkanoid | when I run nimble tests the nimble dependency verification output it too verbose and is 90% of the terminal output, it completely hides the test results |
10:39:04 | * | mahlon_ joined #nim |
10:41:02 | * | droidrage quit (*.net *.split) |
10:41:02 | * | [R] quit (*.net *.split) |
10:41:02 | * | systemdsucks quit (*.net *.split) |
10:41:02 | * | blackbeard420 quit (*.net *.split) |
10:41:03 | * | kayabaNerve quit (*.net *.split) |
10:41:03 | * | mahlon quit (*.net *.split) |
10:41:03 | * | syl quit (*.net *.split) |
10:41:03 | * | drewr quit (*.net *.split) |
10:41:03 | * | def- quit (*.net *.split) |
10:41:03 | * | tinystoat quit (*.net *.split) |
10:41:03 | * | flynn quit (*.net *.split) |
10:46:13 | * | systemdsucks joined #nim |
10:46:13 | * | blackbeard420 joined #nim |
10:46:13 | * | syl joined #nim |
10:46:13 | * | def- joined #nim |
10:46:13 | * | tinystoat joined #nim |
10:46:13 | * | flynn joined #nim |
10:46:19 | PMunch | The dependency verification? |
10:48:42 | * | drewr joined #nim |
11:06:23 | * | PMunch quit (Quit: leaving) |
11:14:04 | * | droidrage joined #nim |
11:38:50 | * | PMunch joined #nim |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.4) |
12:06:54 | * | supakeen joined #nim |
12:09:52 | arkanoid | talking about nim error patterns, would you go exceptions + raises pragma, or Result/Opt + exceptions for defects only? |
12:10:41 | FromDiscord | <Rika> I would not use defects |
12:10:55 | FromDiscord | <Rika> Option + exceptions, I’m still torn on results and exceptions |
12:12:28 | arkanoid | Rika, could you please expand a but more your opinion? I'm trying to wrap my head around the consequences here. It is the moment where I'd like a good read on this before betting on this or that code refactor |
12:13:58 | FromDiscord | <Rika> Well exceptions is okay when you don’t really want to think about them, you can just ignore them and let your program blow up whenever |
12:14:15 | FromDiscord | <Rika> Results is very explicit and you have to handle everything if you like it or not |
12:15:18 | arkanoid | sure, but you said that you would go Options + exceptions and not Results |
12:16:28 | FromDiscord | <Rika> Yes |
12:16:37 | FromDiscord | <Rika> Options isn’t really an error indicator |
12:16:57 | FromDiscord | <Rika> I wouldn’t recommend returning none on error… |
12:17:04 | FromDiscord | <Rika> Doesn’t really indicate what the error is |
12:17:42 | FromDiscord | <Rika> Use it when you have a distinct difference between the zeroed value and “none” |
12:17:58 | FromDiscord | <Rika> So basically “nullable” imo |
12:20:09 | arkanoid | ok |
12:21:00 | PMunch | The problem with Result is that if you just want something done quick and dirty I think you'd end up just putting `discard`, `echo`, or perhaps a `quit 1` in the error handling part. The first two would just silently eat your errors and could cause problems for you if those over errored out, and `quit 1` basically means there is no possible way you can recover from it. |
12:21:48 | PMunch | It's fine if you have code going through a code review, no good reviewer would allow those above hacks, but when you're just developing by yourself I think it's easier to cause problems for yourself later on |
12:21:58 | FromDiscord | <Rika> Basically you’d just have a lot of unwrap like in rust lol |
12:22:15 | PMunch | With exceptions you can silently ignore them, and should they ever blow up you will get a nice stack-trace telling the user exactly where the error occured. |
12:23:11 | arkanoid | makes sense |
12:23:22 | PMunch | Results are technically the better solution, you should always handle your errors, but just in case you're not planning on writing rigorously correct code I believe it might cause more problems than you benefit from them |
12:23:59 | FromDiscord | <Rika> And anyways you have raises… |
12:24:11 | FromDiscord | <Rika> Great pragma imo |
12:24:33 | PMunch | Oh yeah, raises is cool |
12:24:51 | PMunch | Nice way to make sure you handle all your error scenarios |
12:25:09 | PMunch | I really wish there was a way to define our own "procedure types" in Nim |
12:25:23 | FromDiscord | <Rika> What? |
12:25:28 | PMunch | Essentially `func` but implemented in user code |
12:25:47 | FromDiscord | <Rika> Ah |
12:25:48 | PMunch | So func would be something like `type func = proc {.noSideEffects.}` |
12:25:48 | FromDiscord | <Rika> Eh |
12:25:56 | FromDiscord | <Rika> You can half ass it with a macro pragma |
12:26:03 | PMunch | But you could throw your own pragmas in there (of course also those based on macros) |
12:26:17 | PMunch | So I could define `type safe = proc {.raises: [].}` |
12:26:36 | PMunch | And then I could write `safe tryParse(x: string): Option[int]` for example |
12:26:43 | FromDiscord | <Rika> Eh I don’t know it edges to “too much magic” for me |
12:26:44 | arkanoid | safe = func {.raises: [].} maybe |
12:28:48 | PMunch | I just think it could clean up some syntax |
12:29:03 | PMunch | For example we could have `type async = proc {.async.}` |
12:29:16 | FromDiscord | <evoalg> Rika you've done something with your hair again |
12:29:28 | PMunch | And write `async myAsyncProc(x: int): Future[string]` |
12:29:47 | PMunch | I think it would be a neat feature |
12:30:03 | arkanoid | PMunch: I agree, it would be nice, but it seems just another kind of sugar |
12:30:13 | arkanoid | but if func is a thing, why not |
12:30:21 | arkanoid | func is already a built in sugar |
12:30:32 | PMunch | Exactly, I mean Nim has plenty of sugar |
12:31:03 | PMunch | And it's not like it would be unclear, if you hover over the `async` keyword it would show you the type definition for it. |
12:32:19 | arkanoid | I have a question about preferring exceptions over result. How do you deal with exception details? Do you just create meaningful string based exceptions, or you create new types with fields that contains exception data? |
12:33:11 | arkanoid | for example I'm bubbling up error if http requests is not 200 or timeout, I want the catcher to know also response time and other info |
12:33:55 | arkanoid | so far I'm just logging string, but I was considering turning exception into Result to pass an HttpResponse instead |
12:34:06 | supakeen | I usually put the response object in the exception. |
12:34:48 | arkanoid | supakeen: so you mean you create your own exception and not use "newException" template? |
12:35:56 | FromDiscord | <Rika> In reply to @evoalg "Rika you've done something": What |
12:36:05 | FromDiscord | <Rika> You guys can see it? |
12:36:07 | FromDiscord | <Rika> Crazy |
12:36:51 | FromDiscord | <Rika> In reply to @arkanoid "<@688097059290873923>: so you mean": Yes |
12:37:13 | FromDiscord | <Rika> raise (ref MyError)(msg: "", field: …) |
12:37:29 | supakeen | correct |
12:37:40 | arkanoid | thanks. I think I'll take this path |
12:43:35 | arkanoid | why `raises` here wants Exception instead of TimeoutError? https://play.nim-lang.org/#ix=3PcQ |
12:52:37 | arkanoid | also skipping newException trigger same issue: https://play.nim-lang.org/#ix=3PcS |
12:57:48 | Amun-Ra | arkanoid: I guess withTimeout or sth similar may raise an Exception |
12:59:21 | Amun-Ra | Error: withTimeoutErrorNimAsyncContinue_436207705() can raise an unlisted exception: Exception |
13:00:09 | arkanoid | Amun-Ra: nope --> https://play.nim-lang.org/#ix=3PcX |
13:01:14 | PMunch | I guess the rewrite `async` does can throw an exception |
13:01:30 | Amun-Ra | arkanoid: I've never used async in Nim but it looks like an Exception can be raised by async itself |
13:03:44 | PMunch | If you pass -d:nimDumpAsync you can see what it is rewritten to |
13:04:10 | PMunch | Your proc becomes this http://ix.io/3Pd3/nim |
13:05:41 | PMunch | I posted this RFC by the way: https://github.com/nim-lang/RFCs/issues/448 |
13:05:43 | Amun-Ra | nimDumpAsync, nice |
13:06:17 | FromDiscord | <Clonkk> Wouldn't this be redundant with using push / pop pragma and writing proc ?↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
13:06:54 | PMunch | Well, not really |
13:07:43 | PMunch | If I use gotoDefinition in my editor and gets sent to the middle of a file it would be much more obvious that the procedure I was looking at was in fact async for example |
13:08:11 | PMunch | And if you only define one or a couple of these you wouldn't use `push`/`pop` |
13:09:38 | PMunch | I was thinking of using this for creating interrupts in Ratel for example: https://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html |
13:10:22 | PMunch | Would be nice to be able to do `interrupt myInterrupt(<something>)` |
13:14:14 | FromDiscord | <Clonkk> Ah okay it's syntaxic sugar |
13:14:35 | PMunch | Currently you'd have to do this: http://ix.io/3Pd8/nim but how neat wouldn't it be to write http://ix.io/3Pda/nim instead? |
13:14:50 | PMunch | Oh yeah, it's purely syntactic sugar |
13:15:33 | PMunch | But essentially it's just realising that `func` is nice syntactic sugar, maybe other stuff could benefit from the same kind of sugarization? |
13:15:40 | FromDiscord | <Clonkk> I was just confused because you wanted to replace a language keyword by a custom implementation↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
13:15:56 | PMunch | What do you mean? |
13:17:27 | FromDiscord | <Clonkk> Conceptually `proc` is a reserved keyword so when you read the code and look for "custom" information attached to it, you read the pragma |
13:18:04 | FromDiscord | <Clonkk> AKA if something looks like a proc, my brain might just skip the first word because I already assume it will be proc or func (and TBH I don't use much the sideffect system so mostly proc) |
13:18:20 | FromDiscord | <Clonkk> Maybe it's just me being bad at reading |
13:18:44 | PMunch | Sure, but `proc {.noSideEffect.}` is the same as `func`. This means that reading that it goes "this is a procedure. Sike! It's actually a pure function!" |
13:19:00 | PMunch | Oftentimes I find that `proc` seems to lie when you attach custom pragmas |
13:19:25 | FromDiscord | <Clonkk> That's true, maybe I'm not confronted to the problem because I don't have much use for the sideEffect stuff↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
13:19:58 | PMunch | I mean this could be used for anything, that's the beauty of it |
13:20:12 | FromDiscord | <Clonkk> And also the danger of it \:D↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
13:20:23 | PMunch | Haha, of course :P |
13:20:40 | PMunch | But it's not like we're adding more features here, we're just making syntax a bit nicer |
13:21:24 | PMunch | As I said, it's just realising that `func` was a useful addition to the syntax, and that maybe users would want to be able to define similarly useful additions |
13:22:07 | FromDiscord | <Clonkk> Having a few more keyword like `func` for example `async` for `proc {.async.}` etc.. is nice, but I'm not sure it's something I would want open to modification; I fear you'd end up with conflicting keyword |
13:22:35 | PMunch | And as I've said before, metaprogramming in Nim is to programming what a chainsaw is to a saw. You can be much more efficient with it, but it will also take your foot of if you're not careful |
13:22:45 | PMunch | Well conflicting keyword wouldn't be an issue |
13:23:00 | PMunch | Since these are just types you would have normal type collisions |
13:23:56 | PMunch | Let's say you implemented two async libraries, then you would have to do `asynclib1.async myAsyncProc(): Future[string]` or `import asynclib2 except async` |
13:24:30 | FromDiscord | <Clonkk> But it's not really a type ?↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
13:25:09 | PMunch | Maybe not, but it could be handled the same way none-the-less |
13:25:55 | PMunch | Of course if it was a type-like thing you would be able to write the same kind of things you can today with `proc myProc(x: int, callback: proc)` which turns into a generic that takes any procedure as the callback argument. |
13:26:26 | PMunch | But replace `proc` with `async` and voila now it's a `proc {.async.}` that is expected as the callback |
13:26:49 | PMunch | Saves on typing, less line noise, and generally just nicer |
13:27:25 | PMunch | Besides, typing {..} on a Norwegian keyboard is a pain, and the whole pragma syntax feels a bit tacked on. |
13:27:41 | FromDiscord | <Clonkk> So conceptually you'd introduce python-like decorator↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
13:27:59 | FromDiscord | <Clonkk> Haha I have the same issue wiith azerty keyboard↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
13:28:36 | PMunch | I mean pragmas are already akin to Python decorators |
13:28:46 | PMunch | I just want to sprinkle some sugar on it |
13:28:54 | FromDiscord | <Rika> I don’t like it. It will fuck with my recognition |
13:30:10 | FromDiscord | <Clonkk> Yeah I could see it being useful↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
13:30:27 | FromDiscord | <Clonkk> Especially if you start playing with heavy oragma such as `Raise` list and so on |
13:30:30 | PMunch | @Rika, how so? These are likely to still be a callable thing, and we already have five(?) keywords that can go there |
13:30:33 | FromDiscord | <konsumlamm> if anything i'd prefer something like `safe proc example(...)` over `safe example(...)` |
13:30:45 | PMunch | @Clonkk, exactly |
13:30:55 | FromDiscord | <Clonkk> Yeah I was about to suggest something like this↵(@konsumlamm) |
13:31:00 | FromDiscord | <Rika> In reply to @konsumlamm "if anything i'd prefer": Same here. I commented just that |
13:31:01 | FromDiscord | <konsumlamm> not using func/proc doesn't make it obvious that you're defining a function |
13:31:09 | PMunch | @konsumlamm, but what if the output isn't a procedure? |
13:31:15 | PMunch | Now we're just lying to the user again.. |
13:31:17 | FromDiscord | <Rika> Why would it not be… |
13:31:25 | FromDiscord | <Rika> Just use a macro by then |
13:31:29 | PMunch | @Rika, it could be a pure function? |
13:31:37 | FromDiscord | <Rika> Ah that’s what you mean |
13:31:38 | arkanoid | PMunch: thanks for the nimDumpAsync check, damn line 37 :D http://ix.io/3Pd3/nim |
13:32:06 | FromDiscord | <konsumlamm> isn't the point to define custom function types though? |
13:32:40 | FromDiscord | <konsumlamm> tbh, i think just using pragmas works fine |
13:32:52 | FromDiscord | <Rika> Then why not allow it for either func or proc, they stay the same (magic or so) and you can define custom words for them |
13:33:00 | FromDiscord | <Rika> I think so too |
13:33:11 | PMunch | Well it's to allow the user or library author to use the `proc`-like syntax (which is currently impossible) without having to attach pragmas everywhere.. |
13:33:39 | FromDiscord | <Rika> I don’t see what’s wrong with pragmas |
13:33:47 | FromDiscord | <Rika> “It’s a pain to type” sounds like a non-issue |
13:33:47 | PMunch | @konsumlamm, and you're free to use pragmas, I'm not saying we should do away with pragmas |
13:34:10 | FromDiscord | <Clonkk> Let"s say you have a long list of pragma you want to use as an umbrella identifier↵(@Rika) |
13:34:12 | PMunch | @Rika, Nim in general is fairly easy to type, and I believe that has been one of the core focuses of the language.. |
13:34:17 | FromDiscord | <Clonkk> It imporves readability |
13:34:26 | FromDiscord | <Rika> In reply to @Clonkk "Let"s say you have": You can define a pragma that combines pragmas, you know |
13:34:28 | PMunch | @Clonkk, you could define a pragma pragma, |
13:34:45 | PMunch | But its still not super nice |
13:35:02 | FromDiscord | <Clonkk> yes of course, the point is just to provide syntaxic sugar on a proc↵(@Rika) |
13:35:30 | FromDiscord | <Rika> I think this is too sweet. |
13:35:30 | FromDiscord | <Clonkk> Is `customProc foo() = #...` better than `proc foo() {.custom.} = ...` |
13:35:33 | FromDiscord | <Clonkk> ? |
13:35:42 | FromDiscord | <Rika> No. |
13:36:23 | * | Gustavo6046 quit (Remote host closed the connection) |
13:36:48 | FromDiscord | <Clonkk> Personnaly I think there are cases where it's justified and read better |
13:36:58 | FromDiscord | <Rika> I don’t know, you’re saving what four characters for what? I really really really do not see the readability benefit |
13:37:01 | FromDiscord | <Clonkk> The exmaple of interrupt was a good one for instance |
13:38:29 | FromDiscord | <Clonkk> Perhaps it's just because typing a pragma is annoying because of different keyboard layout that doesn't let you acces symbol easily |
13:38:56 | PMunch | async is another one, Typing `proc <blah blah> {.async.}` is tedious, just `async <blah blah>` is much nicer |
13:39:02 | FromDiscord | <Rika> There’s no solution to that |
13:39:06 | PMunch | And now I only have to scan the left column to identify the async procedures |
13:39:19 | FromDiscord | <Clonkk> Syntaxic sugar or me changing keyboard \:D↵(@Rika) |
13:39:27 | PMunch | @Rika, yes there is, to not use those weird symbols.. |
13:39:37 | FromDiscord | <Rika> Keyboard layouts being unfriendly to certain syntax |
13:40:03 | PMunch | Well if your keyboard layout is unfriendly to typing words then you might want to consider switching layouts.. |
13:40:08 | FromDiscord | <Rika> So are we limiting the whole syntax to alphanumeric |
13:40:22 | PMunch | We're limiting it to Nim identifiers |
13:40:26 | PMunch | Obviously |
13:40:35 | arkanoid | I already have a `morepure` pragma that combines {.noSideEffects,raises:[]}, so `proc {.morepure.}` would be like `func {.raises:[].}`, and moving function types like this is not so elegant |
13:40:59 | FromDiscord | <abisxir> Guys do you know a dead simple C library for graphic programming? Not something like SDL or a game engine. |
13:41:09 | PMunch | @abisxir, imlib? |
13:41:23 | FromDiscord | <abisxir> Humm, let me check it |
13:41:42 | arkanoid | https://github.com/raysan5/raylib ? |
13:41:45 | PMunch | Depends on what you mean by dead simple though |
13:42:02 | PMunch | What do you actually need it for? |
13:42:25 | FromDiscord | <abisxir> imlib is complicated enough |
13:43:14 | FromDiscord | <abisxir> Do you remeber old time graphics.h? easy like circle(x, y, radius) draw(....) line(...) etc |
13:43:28 | FromDiscord | <enthus1ast> raylib |
13:44:14 | FromDiscord | <enthus1ast> or even pixie |
13:44:32 | FromDiscord | <konsumlamm> In reply to @PMunch "async is another one,": you're not defining "an async" though, you're defining "an async function/procedure" |
13:44:55 | FromDiscord | <abisxir> Humm, I know raylib but I was thinking maybe there is something even much more simpler. As I see raylib is most simple one. |
13:45:12 | FromDiscord | <konsumlamm> so i don't think `type async = proc {.async.}` is desirable, even if it was possiblr |
13:45:36 | FromDiscord | <enthus1ast> even simpler than raylib is pixie, but its not accelerated |
13:46:42 | arkanoid | PMunch: if async implicitly adds a `raises` of type Exception, this means that the {.raises.} pragma is not usable in async context, as {.raises: [Exception].} is a catch-all |
13:47:00 | * | arkurious joined #nim |
13:47:19 | PMunch | @konsumlamm, maybe not, and you'd be free to write {.async.} in your code if you think that is cleaner. But take my AVR interrupts example then, `interrupt myInterrupt()` is definitely not a procedure |
13:47:48 | PMunch | @arkanoid, seems like it unfortunately |
13:48:11 | PMunch | Maybe raise an issue about that in the Nim repo, seems like those features should compose better |
13:48:39 | FromDiscord | <Rika> In reply to @PMunch "<@312654963694108674>, maybe not, and": Interrupt handlers are not procedures? Since when |
13:49:05 | arkanoid | PMunch: yes I think so |
13:50:43 | PMunch | @Rika, well I guess they might fall under the procedure umbrella |
13:50:51 | FromDiscord | <Clonkk> I assume in the sense that there are things you would like to forbid in ISR↵(@Rika) |
13:51:22 | FromDiscord | <Rika> In reply to @Clonkk "I assume in the": That doesn’t disqualify them from being procedures |
13:51:47 | PMunch | By that logic `func` is also a `proc` |
13:51:58 | PMunch | As it is also a sub-specialisation of a procedure |
13:52:06 | FromDiscord | <Rika> I would say that. |
13:52:12 | PMunch | So then it should be `func proc()`.. |
13:52:12 | arkanoid | PMunch: it has already been issued https://github.com/nim-lang/Nim/issues/6639 |
13:52:16 | FromDiscord | <Rika> pure proc …(…) |
13:52:18 | FromDiscord | <Clonkk> Well a `func` is a procedure with some limitation. So an interrupt is a proc with some limitation like forbidding calling `ælloc` for example. If that could be checked at compile time it'd be useful |
13:53:51 | FromDiscord | <Clonkk> You'd prefer `pure proc()` over `func` ?↵(@Rika) |
13:54:40 | PMunch | I'm just saying that he same way `func` is nice syntactic sugar I believe there are other instances that would be nice syntactic sugar |
13:55:34 | FromDiscord | <Clonkk> so UFCS for pragma \:D ? |
13:59:09 | PMunch | Yeah I guess :) |
13:59:28 | PMunch | I mean that is another way of implementing this |
13:59:46 | PMunch | Just allowing any pragma to take the place of `proc` |
14:00:00 | PMunch | It makes sense, they're applying a transformation on the proc |
14:00:28 | PMunch | Well, maybe only those which doesn't take arguments.. |
14:00:56 | PMunch | `raises:[Exception] myThing(x: int, y: int): string` looks a bit meh |
14:03:08 | Amun-Ra | ufc'ed pragma would be ugly as |
14:05:02 | FromDiscord | <Rika> In reply to @Clonkk "You'd prefer `pure proc()`": ... yes? |
15:07:29 | * | PMunch quit (Quit: Leaving) |
15:47:45 | * | Gustavo6046 joined #nim |
15:52:39 | FromDiscord | <Elegantbeef> I agree pmunch, I think macros should explicitly say `pDef: ProcDef` as their only parameter then be usable in place of `proc` as it enables much more concise code |
15:54:37 | FromDiscord | <lantos> sent a code paste, see https://play.nim-lang.org/#ix=3PdT |
15:54:54 | FromDiscord | <Rika> `a.len div c` returns an int |
15:55:14 | FromDiscord | <Rika> use div instead of / and youll remove a lot of the "noise" |
15:55:42 | FromDiscord | <lantos> (edit) "https://play.nim-lang.org/#ix=3PdT" => "https://play.nim-lang.org/#ix=3PdU" |
15:59:18 | FromDiscord | <Waldecir Santos> I have a weird question, in a macro I receive a NimNode correct, my question is can I traverse up and do changes or just traverse down ? |
16:00:19 | FromDiscord | <Rika> down only |
16:00:50 | FromDiscord | <lantos> sent a code paste, see https://play.nim-lang.org/#ix=3PdY |
16:01:15 | FromDiscord | <Rika> In reply to @lantos "any downside you can": we're not python; use if over try |
16:01:33 | FromDiscord | <lantos> >,< |
16:11:21 | * | Gustavo6046 quit (Quit: Leaving) |
16:11:39 | * | Gustavo6046 joined #nim |
16:11:57 | * | Gustavo6046 quit (Client Quit) |
16:16:24 | FromDiscord | <Waldecir Santos> is it possible to overwrite this `:` operator here: |
16:16:24 | FromDiscord | <Waldecir Santos> https://media.discordapp.net/attachments/371759389889003532/941367007922774126/unknown.png |
16:16:39 | FromDiscord | <Waldecir Santos> (edit) "here:" => "here?:" |
16:17:01 | FromDiscord | <Elegantbeef> "overwrite"? |
16:17:29 | FromDiscord | <Waldecir Santos> Overflow |
16:17:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Peb |
16:17:42 | FromDiscord | <Waldecir Santos> Bad example sorry 1 sec |
16:18:08 | FromDiscord | <Elegantbeef> The answer is probably "no" |
16:18:13 | FromDiscord | <Waldecir Santos> https://media.discordapp.net/attachments/371759389889003532/941367462530797669/unknown.png |
16:18:30 | FromDiscord | <Elegantbeef> What are you after? |
16:18:55 | FromDiscord | <Waldecir Santos> Trying to inject pragmas dynamically |
16:19:14 | FromDiscord | <Waldecir Santos> (edit) "dynamically" => ""dynamically" during compile time" |
16:19:17 | FromDiscord | <Elegantbeef> You want a typedef macro |
16:19:40 | FromDiscord | <Elegantbeef> https://github.com/beef331/constructor/#defaults for instance |
16:19:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Pef |
16:22:35 | FromDiscord | <Waldecir Santos> Ty I'll check I still fighting to find a way to "mimic" how we declare models in django, that is my big goal right now |
16:22:49 | FromDiscord | <Waldecir Santos> I've some ideas and I'm using it to also learn nim, lol |
16:23:15 | * | audiophile_ joined #nim |
16:56:02 | FromDiscord | <Waldecir Santos> Ty @ElegantBeef I think this will do the trick |
17:01:04 | * | Gustavo6046 joined #nim |
17:01:49 | * | Gustavo6046 quit (Client Quit) |
18:15:11 | * | vicfred joined #nim |
18:18:20 | * | jjido joined #nim |
18:22:52 | * | dtomato quit (Quit: The Lounge - https://thelounge.chat) |
18:23:43 | * | dtomato joined #nim |
18:52:10 | FromDiscord | <eyecon> @KatrinaKitten is there a way to specify number of times from and to, at the same time in honeycomb? Say, 2 to 3 digits |
19:00:43 | FromDiscord | <eyecon> And: can we have a "validate" function which causes parser to fail if it doesn't satisfy some condition? |
19:01:07 | FromDiscord | <eyecon> I can also create an issue if that's better |
19:27:07 | * | anddam quit (Quit: WeeChat 3.4) |
19:28:45 | * | anddam joined #nim |
19:39:10 | * | jmdaemon joined #nim |
19:45:11 | NimEventer | New Nimble package! uuid4 - UUIDs in pure Nim, see https://github.com/vtbassmatt/nim-uuid4 |
20:05:21 | FromDiscord | <KatrinaKitten> In reply to @eyecon "<@!204718116020682753> is there a": You can pass a range to `times` / ``, and it will treat the lower bound as minimum and upper bound as maximum (though it still always greedily consumes as many as possible up to that maximum). |
20:06:06 | FromDiscord | <KatrinaKitten> In reply to @eyecon "And: can we have": I'm not quite sure what you mean. A feature request issue with more detail would be perfect 🙂 |
20:06:48 | FromDiscord | <KatrinaKitten> (edit) "In reply to @eyecon "<@!204718116020682753> is there a": You can pass a range to `times` / ``, ... and" added "i.e. `parser.times(2..4)`," |
20:10:35 | FromDiscord | <eyecon> In reply to @KatrinaKitten "You can pass a": Thanks! |
20:10:47 | FromDiscord | <eyecon> In reply to @KatrinaKitten "I'm not quite sure": Sure, will do that with an example |
20:16:01 | * | audiophile_ quit (Quit: Default Quit Message) |
20:43:23 | * | Jjp137_ joined #nim |
20:43:37 | * | Jjp137 quit (Ping timeout: 240 seconds) |
20:43:52 | * | Jjp137_ quit (Client Quit) |
20:45:01 | * | Jjp137 joined #nim |
20:52:04 | FromDiscord | <carpal> a way to `except XError as e`? |
20:52:20 | FromDiscord | <carpal> (edit) "XError" => "XError, YError" |
21:03:16 | NimEventer | New Nimble package! klymene - Create beautiful command line interfaces in Nim. Based on docopt., see https://github.com/georgelemon/clymene |
21:03:16 | NimEventer | New Nimble package! psy - A fast, multi-threading and disk space efficient package manager for PHP development and production environments, see https://github.com/psypac/psypac |
21:10:48 | * | neurocyte0917090 joined #nim |
21:17:19 | FromDiscord | <Elegantbeef> Carpal you cannot you have to do exclusive trees |
21:28:13 | * | jmdaemon quit (Ping timeout: 240 seconds) |
21:33:16 | * | Guest^^ joined #nim |
21:35:16 | * | Guest^^ quit (Client Quit) |
21:47:58 | FromDiscord | <federico3> Nim 1.6.4 is uploaded in Debian Sid \:) |
22:25:46 | FromDiscord | <Waldecir Santos> does nim have a similar kwards from python in procs ? I see varargs but that dosen't covert for key params |
22:25:50 | FromDiscord | <Waldecir Santos> (edit) "covert" => "cover" |
22:26:11 | FromDiscord | <Elegantbeef> key params? |
22:27:13 | FromDiscord | <evoalg> no substitute for kwargs↵(@Waldecir Santos) |
22:27:50 | FromDiscord | <Elegantbeef> That's not 100% true, but yea 😀 |
22:28:05 | FromDiscord | <Elegantbeef> Would require macros to support |
22:28:19 | FromDiscord | <evoalg> I was quoting what Solitude said, and I believed them |
22:28:28 | FromDiscord | <Elegantbeef> Well you can do it with macros |
22:28:35 | FromDiscord | <Elegantbeef> But it's not advised |
22:28:40 | FromDiscord | <evoalg> ahh that's because macros can do anything |
22:28:55 | FromDiscord | <evoalg> can macros write macros? |
22:29:02 | FromDiscord | <Elegantbeef> Yes |
22:29:10 | FromDiscord | <evoalg> gosh |
22:29:11 | FromDiscord | <Elegantbeef> Well macros cant do anything they can simulate many things |
22:30:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Pg8 |
22:30:32 | * | jmdaemon joined #nim |
22:31:09 | FromDiscord | <Elegantbeef> Or one could make a macro for it, but i'd question what you need names for given you can just you know have parameters 😛 |
22:32:59 | FromDiscord | <evoalg> and can use a Table |
22:34:09 | FromDiscord | <Elegantbeef> Could also use a tuple |
22:34:12 | FromDiscord | <Elegantbeef> `(hello: "world", other: "planets", otherer: 10)` |
22:34:16 | FromDiscord | <Elegantbeef> Would be the closes i'd imagine |
22:34:37 | FromDiscord | <Elegantbeef> Allows you to have heterogeneous types with a name -\> val |
22:37:10 | FromDiscord | <Elegantbeef> So i guess @Waldecir Santos there you go 😛 |
22:38:52 | FromDiscord | <Waldecir Santos> Awesome, ty ! |
22:39:25 | FromDiscord | <evoalg> The tuple would need to be defined at compiled time right? |
22:39:29 | FromDiscord | <Elegantbeef> Of course |
22:39:49 | FromDiscord | <Elegantbeef> but the procedure can be `proc doThing(tup: tuple)` so then you have a generic procedure that operates on any tuple |
22:42:18 | FromDiscord | <evoalg> to see if one of the args is an int, could `typeof` be used? ... or should a `try` `except` be used? |
22:42:38 | FromDiscord | <Elegantbeef> The former |
22:42:58 | FromDiscord | <evoalg> and it should use `when` instead of `if` for `typeof` ? |
22:43:22 | FromDiscord | <Elegantbeef> Yep |
22:43:25 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Pgc |
22:43:38 | FromDiscord | <evoalg> nice, thank you! |
22:43:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Pgd |
22:43:47 | FromDiscord | <Elegantbeef> fieldPairs is important 😛 |
22:44:16 | FromDiscord | <evoalg> ahhhh ok! |
22:44:17 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
22:47:05 | FromDiscord | <evoalg> so why are macros discouraged for this sort of thing? |
22:47:30 | FromDiscord | <Elegantbeef> Well the simplest tool is the best tool |
22:47:57 | FromDiscord | <Elegantbeef> If you can do it with a procedure it's the best |
22:48:59 | FromDiscord | <evoalg> makes sense 🙂 |
22:49:30 | FromDiscord | <evoalg> I can't just do \:) in matrix, but I have to click on the smiley icons |
22:50:00 | FromDiscord | <Elegantbeef> You can |
22:50:07 | FromDiscord | <Elegantbeef> it's a setting but you do also have to hit space after 🙂 |
22:51:23 | FromDiscord | <evoalg> 🙂 works! |
22:56:14 | FromDiscord | <Elegantbeef> Yea element has some oddities |
22:56:23 | FromDiscord | <Elegantbeef> I just learned they implemented SMS-like chat |
23:01:53 | * | jjido joined #nim |
23:27:45 | * | jmdaemon quit (Ping timeout: 250 seconds) |
23:58:12 | * | jmdaemon joined #nim |