<< 10-02-2022 >>

00:05:36FromDiscord<rainbowasteroids> sent a code paste, see https://play.nim-lang.org/#ix=3PaW
00:14:34FromDiscord<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:44FromDiscord<Elegantbeef> Now have somewhat of runtime interfaces
00:15:05FromDiscord<Elegantbeef> No clue rainbow, if you want it catchable inherit from the `CatchableError` dont see why you wouldnt
00:15:38FromDiscord<rainbowasteroids> I'm just curious, because `CatchableError` is defined as `object of Exception`
00:22:12FromDiscord<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:35FromDiscord<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:43nrds<Prestige99> @Elegantbeef thanks I'll check it out
00:58:06FromDiscord<b4mbus> Does nim have some kind of RAII?
00:58:28FromDiscord<b4mbus> or actually any kind of automatic resource handling at the end of scope
00:58:32FromDiscord<Elegantbeef> `arc`
00:58:32FromDiscord<Elegantbeef> Yes
00:58:33FromDiscord<Elegantbeef> `--gc:arc` does it
00:58:39FromDiscord<b4mbus> oh
00:58:40FromDiscord<b4mbus> gc
00:58:53FromDiscord<Elegantbeef> I mean in modern nim it's `mm`
00:58:57FromDiscord<b4mbus> wait, there are different gc's?
00:58:59FromDiscord<b4mbus> (edit) "gc's?" => "gcs?"
00:59:10FromDiscord<Elegantbeef> Yes there are different memory management featurees
00:59:30FromDiscord<b4mbus> https://nim-lang.github.io/Nim/mm.html
00:59:31FromDiscord<b4mbus> oh I see
00:59:47FromDiscord<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:26FromDiscord<huantian> if you make a =destroy for files
01:07:23FromDiscord<Elegantbeef> Nim-sys uses them but it's not fully on par with the Nim stdlib afaik
01:07:57NimEventerNew Nimble package! mdlldk - Dynamic-link libraries (DLLs) Development Kit for mIRC., see https://github.com/rockcavera/nim-mdlldk
01:08:24FromDiscord<Elegantbeef> Yes you do cause the stdlib hasnt been updated to use them
01:09:07FromDiscord<sharpcdf> dont know who the mods are but @Inc1usive is a scammer btw
01:09:16FromDiscord<sharpcdf> dont know for sure but pretty sure they are
01:10:01FromDiscord<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:36FromDiscord<huantian> can confirm
01:13:22FromDiscord<sharpcdf> 👍
01:14:18FromDiscord<huantian> dmed yard but ig I'll ping @PMunch too
01:14:46FromDiscord<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:51FromDiscord<Elegantbeef> Prestige I made it a tinge nicer(albeit more likely to crash) https://play.nim-lang.org/#ix=3Pb5
01:15:00FromDiscord<Iapetus11> This is their discord id: 941098341658419281
01:15:22FromDiscord<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:06nrds<Prestige99> :o
01:22:19FromDiscord<huantian> don't worry this is legit
01:42:24FromDiscord<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:04FromDiscord<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:22FromDiscord<Nightshade 🌙> In reply to @Elegantbeef "They have a bunch": Ahh awesome idea thank you so much!
01:54:02FromDiscord<Elegantbeef> I do something similar for the RPI pico and it works ok
01:54:17FromDiscord<Elegantbeef> Some issues like having to manually include stuff, but no clue if that matters here
01:54:21FromDiscord<Elegantbeef> Didnt look much into it
01:58:06*jmdaemon joined #nim
02:04:31FromDiscord<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:31FromDiscord<nekojes> am just trying with `nim r --app:console <file`
02:05:53FromDiscord<Elegantbeef> I think app might not be overridable after a config loads
02:06:35FromDiscord<nekojes> ...even if it's specified on the cli?
02:07:18FromDiscord<Elegantbeef> replace that `nim.cfg` with `file.nims` then you shouldnt have a problem
02:13:31FromDiscord<nekojes> what do you mean?
02:13:44FromDiscord<rainbowasteroids> there are no scams on matrix yet 😉↵(@Iapetus11)
02:14:04FromDiscord<Iapetus11> lol
02:14:14FromDiscord<nekojes> seemslegit
02:14:44FromDiscord<rainbowasteroids> come to the slightly less spooky side
02:15:10FromDiscord<Elegantbeef> I mean there are scams it's just easy to block since you have to accept a DM 😀
02:15:42FromDiscord<rainbowasteroids> I haven't used matrix enough to get any scams 😆
02:15:53FromDiscord<rainbowasteroids> I'm just in the Nim channels and some small community
02:16:12FromDiscord<Elegantbeef> I mean we've had some scammers here but they post and then get banned
02:16:35FromDiscord<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:02FromDiscord<Elegantbeef> https://github.com/beef331/picostdlib it's nothing overly fancy
02:18:19FromDiscord<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:59FromDiscord<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:36FromDiscord<Arathanis> @ElegantBeef can you explain why I need to do this: https://media.discordapp.net/attachments/371759389889003532/941176550148153395/unknown.png
03:39:40FromDiscord<Arathanis> to make this work: https://media.discordapp.net/attachments/371759389889003532/941176568951234560/unknown.png
03:40:02FromDiscord<Arathanis> it seems like they are just called `:tmp` w/o an explicit identifier and thus you run into redefinition
03:40:07FromDiscord<Arathanis> want to make sure i didnt miss anything obvious
03:45:55FromDiscord<Elegantbeef> I think it might just be the lack of name
03:46:06FromDiscord<Elegantbeef> i'd just do `nskParam.genSym("message")` and same for `number`
03:59:08FromDiscord<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:20FromDiscord<Arathanis> im playing with making the macro for variable, so i will ultimately need to generate an arbitrary number of symbols
04:17:45FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3Pbp
04:17:53FromDiscord<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:53FromDiscord<Elegantbeef> Damn it
04:18:54FromDiscord<Elegantbeef> sent a long message, see http://ix.io/3Pbq
04:18:59FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Pbr
04:20:45FromDiscord<Arathanis> even if they have the same name will it tolerate it?
04:20:52FromDiscord<Arathanis> guess i can go test that right now
04:22:32FromDiscord<Elegantbeef> So i guess congrats you found a bug with `genSym`
04:22:56FromDiscord<Arathanis> oh lol
04:23:02FromDiscord<Arathanis> well that is neat i guess
04:23:25FromDiscord<Arathanis> should an issue be made on the git repo?
04:25:23FromDiscord<Elegantbeef> If one doesnt already exist
04:25:51FromDiscord<Elegantbeef> So odd i cannot replicate it minimally
04:27:20FromDiscord<Elegantbeef> Ah nvm it's just when it's used for proc parameters
04:28:30FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Pbs
04:29:56FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/issues/17851 this is related
04:30:18FromDiscord<Elegantbeef> Might be easy to fix, need to look at it
04:32:52FromDiscord<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:39FromDiscord<Elegantbeef> I was wrong, it causes C gen issues 😀
05:46:23FromDiscord<Arathanis> In reply to @Elegantbeef "I was wrong, it": that sounds... less easy to fix :P
05:50:14FromDiscord<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:23FromDiscord<Elegantbeef> There we go matrix spam
08:37:48FromDiscord<Elegantbeef> For otherly located it's a nice long meme name about bitcoin
08:39:20PMunchThere's unfortunately a bug in the Element client I believe so dom96 can't add anyone else as admins in the group :(
08:41:53PMunchThere 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:12FromDiscord<Elegantbeef> This interface stuff i've been toying with is rather cool, the more I add the niftier it gets
08:46:54FromDiscord<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:28NimEventerNew Nimble package! nyml - Stupid simple YAML-like implementation from YAML to JsonNode, see https://github.com/openpeep/nyml
09:01:45FromDiscord<Rika> Wow that’s a nice read me
09:03:42FromDiscord<Elegantbeef> Yea all their readme's are like that
09:06:00FromDiscord<Rika> Is it a company or what
09:06:18FromDiscord<Elegantbeef> It's only a single committer so i think not but i could be wrong
09:07:56FromDiscord<Elegantbeef> It's weird to see people not active here or on the forums using Nim
09:12:22PMunchI think it's a very good sign
09:13:11FromDiscord<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:59PMunchI 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:33FromDiscord<Elegantbeef> Yea you're like "Who the fuck is ElegantBeef, that nobody" 😛
09:17:31PMunchThat 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:16FromDiscord<Elegantbeef> When do we merge ratel with picostdlib under a single organization 😛
09:31:04FromDiscord<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:21FromDiscord<Elegantbeef> We do have a module to make it more wonderful
09:33:12FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Pck
09:33:20FromDiscord<Elegantbeef> the real solution is just to drop `0`
09:34:06FromDiscord<Elegantbeef> I dont recall what the actual characters are 😀
09:34:46FromDiscord<Elegantbeef> Should note you could invoke the above with `"Hello".writeColoured(fgRed)`
09:35:08FromDiscord<Rika> Is that not an octal escape?
09:35:15FromDiscord<Rika> It says that in the error
09:35:25FromDiscord<Rika> So you have to convert it into decimal or whichever
09:35:41FromDiscord<Rika> In reply to @Elegantbeef "Should note you could": Just use this instead really
09:35:55FromDiscord<Elegantbeef> Manually adding colour is for nerds
09:36:54FromDiscord<Elegantbeef> It's kinda odd that there is `writeStyled` but not a `writeStyle` that takes in a color
09:38:04FromDiscord<Elegantbeef> Oh there is styled write
09:38:11FromDiscord<Elegantbeef> so you can do `stdout.styledWrite(fgRed, "hello")`
09:38:17FromDiscord<evoalg> Thank you beefy that works \:)
09:38:50FromDiscord<Elegantbeef> Can even do `stdout.styledWrite(fgRed, styleBright, "Hello")`
09:39:02FromDiscord<Elegantbeef> Never seen that macro before, i feel dumb now
09:40:13FromDiscord<evoalg> ohhhh ok I didn't try the 2nd one...
09:40:29FromDiscord<Rika> I still can’t recognise Evo with his new avatar image
09:41:08FromDiscord<evoalg> hehe
09:41:32FromDiscord<evoalg> Nice I can to bgRed too
09:41:40*Gustavo6046 joined #nim
09:41:42FromDiscord<Elegantbeef> Yep it's the way to do it
09:41:48FromDiscord<Elegantbeef> I've always manually done it so i feel dumb now
09:42:30FromDiscord<evoalg> super brains code everything manually
09:42:37FromDiscord<evoalg> \:w
09:42:43FromDiscord<evoalg> opps
09:42:43FromDiscord<Elegantbeef> This isnt vim
09:43:58FromDiscord<evoalg> Nice, now I can draw some colored squares like `stdout.styledWrite(bgRed, " ")`
09:44:45FromDiscord<Elegantbeef> Sounds like someone is about to make a TUI game
09:47:04FromDiscord<evoalg> hehe no I want to draw some simple colored grids
09:47:16FromDiscord<evoalg> the simplest way possible
09:49:30*qwestion joined #nim
10:05:16NimEventerNew 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:53FromDiscord<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:33Amun-Rayes
10:14:12Amun-Ra\033 is my only usage of octal notation (apart from writing PDP emulators)
10:15:03FromDiscord<evoalg> \\033 doesn't work but \\e works?
10:15:08FromDiscord<evoalg> in Nim
10:15:21Amun-Rayes
10:16:26FromDiscord<Elegantbeef> in nim `\033` is taken as the 33rd character, but you want the 27th
10:16:53Amun-Rathere are no octal literals in nim
10:16:58Amun-Ra\033 is 33 in dec
10:17:14Amun-Ra"\e" == "\031" == "\x1f"
10:18:04Amun-Rabut… I wonder who came up with \c and \L…
10:19:53FromDiscord<planetis> cariage return and line feed? pbl the ascii guys \:)
10:20:27Amun-RaI mean what was the reason to pick \c and \L instead of the standard \r and \n
10:23:09supakeenboth work
10:23:15Amun-Rayes
10:23:32supakeenbut why it has both, i don't know either :)
10:23:51supakeeni'm at least not familiar with any other language that uses \c and \l.
10:25:31FromDiscord<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:50FromDiscord<Elegantbeef> `return` `newLine` 😀
10:26:55Amun-Raline feed aka new line
10:27:03FromDiscord<evoalg> ohh
10:27:28*m5zs7k joined #nim
10:31:54*kayabaNerve_ joined #nim
10:34:06*[RMS] joined #nim
10:34:46PMunchAmun-Ra, well on windows a proper newline is carriage return + linefeed
10:35:22Amun-Raand on old macs (~m68k ones) it was CR only
10:35:23PMunchEarlier versions of Nim used \n to mean linefeed on Linux and carriage return + linefeed on Windows
10:35:33PMunchYou couldn't eg. use \n in a character literal
10:36:53PMunchThat'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:56PMunchI believe
10:37:08Amun-Rathat makes sense
10:37:10PMunchMight be wrong though
10:37:58arkanoidwhen 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:19PMunchThe 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:52arkanoidtalking about nim error patterns, would you go exceptions + raises pragma, or Result/Opt + exceptions for defects only?
12:10:41FromDiscord<Rika> I would not use defects
12:10:55FromDiscord<Rika> Option + exceptions, I’m still torn on results and exceptions
12:12:28arkanoidRika, 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:58FromDiscord<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:15FromDiscord<Rika> Results is very explicit and you have to handle everything if you like it or not
12:15:18arkanoidsure, but you said that you would go Options + exceptions and not Results
12:16:28FromDiscord<Rika> Yes
12:16:37FromDiscord<Rika> Options isn’t really an error indicator
12:16:57FromDiscord<Rika> I wouldn’t recommend returning none on error…
12:17:04FromDiscord<Rika> Doesn’t really indicate what the error is
12:17:42FromDiscord<Rika> Use it when you have a distinct difference between the zeroed value and “none”
12:17:58FromDiscord<Rika> So basically “nullable” imo
12:20:09arkanoidok
12:21:00PMunchThe 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:48PMunchIt'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:58FromDiscord<Rika> Basically you’d just have a lot of unwrap like in rust lol
12:22:15PMunchWith 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:11arkanoidmakes sense
12:23:22PMunchResults 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:59FromDiscord<Rika> And anyways you have raises…
12:24:11FromDiscord<Rika> Great pragma imo
12:24:33PMunchOh yeah, raises is cool
12:24:51PMunchNice way to make sure you handle all your error scenarios
12:25:09PMunchI really wish there was a way to define our own "procedure types" in Nim
12:25:23FromDiscord<Rika> What?
12:25:28PMunchEssentially `func` but implemented in user code
12:25:47FromDiscord<Rika> Ah
12:25:48PMunchSo func would be something like `type func = proc {.noSideEffects.}`
12:25:48FromDiscord<Rika> Eh
12:25:56FromDiscord<Rika> You can half ass it with a macro pragma
12:26:03PMunchBut you could throw your own pragmas in there (of course also those based on macros)
12:26:17PMunchSo I could define `type safe = proc {.raises: [].}`
12:26:36PMunchAnd then I could write `safe tryParse(x: string): Option[int]` for example
12:26:43FromDiscord<Rika> Eh I don’t know it edges to “too much magic” for me
12:26:44arkanoidsafe = func {.raises: [].} maybe
12:28:48PMunchI just think it could clean up some syntax
12:29:03PMunchFor example we could have `type async = proc {.async.}`
12:29:16FromDiscord<evoalg> Rika you've done something with your hair again
12:29:28PMunchAnd write `async myAsyncProc(x: int): Future[string]`
12:29:47PMunchI think it would be a neat feature
12:30:03arkanoidPMunch: I agree, it would be nice, but it seems just another kind of sugar
12:30:13arkanoidbut if func is a thing, why not
12:30:21arkanoidfunc is already a built in sugar
12:30:32PMunchExactly, I mean Nim has plenty of sugar
12:31:03PMunchAnd 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:19arkanoidI 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:11arkanoidfor 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:55arkanoidso far I'm just logging string, but I was considering turning exception into Result to pass an HttpResponse instead
12:34:06supakeenI usually put the response object in the exception.
12:34:48arkanoidsupakeen: so you mean you create your own exception and not use "newException" template?
12:35:56FromDiscord<Rika> In reply to @evoalg "Rika you've done something": What
12:36:05FromDiscord<Rika> You guys can see it?
12:36:07FromDiscord<Rika> Crazy
12:36:51FromDiscord<Rika> In reply to @arkanoid "<@688097059290873923>: so you mean": Yes
12:37:13FromDiscord<Rika> raise (ref MyError)(msg: "", field: …)
12:37:29supakeencorrect
12:37:40arkanoidthanks. I think I'll take this path
12:43:35arkanoidwhy `raises` here wants Exception instead of TimeoutError? https://play.nim-lang.org/#ix=3PcQ
12:52:37arkanoidalso skipping newException trigger same issue: https://play.nim-lang.org/#ix=3PcS
12:57:48Amun-Raarkanoid: I guess withTimeout or sth similar may raise an Exception
12:59:21Amun-RaError: withTimeoutErrorNimAsyncContinue_436207705() can raise an unlisted exception: Exception
13:00:09arkanoidAmun-Ra: nope --> https://play.nim-lang.org/#ix=3PcX
13:01:14PMunchI guess the rewrite `async` does can throw an exception
13:01:30Amun-Raarkanoid: I've never used async in Nim but it looks like an Exception can be raised by async itself
13:03:44PMunchIf you pass -d:nimDumpAsync you can see what it is rewritten to
13:04:10PMunchYour proc becomes this http://ix.io/3Pd3/nim
13:05:41PMunchI posted this RFC by the way: https://github.com/nim-lang/RFCs/issues/448
13:05:43Amun-RanimDumpAsync, nice
13:06:17FromDiscord<Clonkk> Wouldn't this be redundant with using push / pop pragma and writing proc ?↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
13:06:54PMunchWell, not really
13:07:43PMunchIf 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:11PMunchAnd if you only define one or a couple of these you wouldn't use `push`/`pop`
13:09:38PMunchI 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:22PMunchWould be nice to be able to do `interrupt myInterrupt(<something>)`
13:14:14FromDiscord<Clonkk> Ah okay it's syntaxic sugar
13:14:35PMunchCurrently 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:50PMunchOh yeah, it's purely syntactic sugar
13:15:33PMunchBut essentially it's just realising that `func` is nice syntactic sugar, maybe other stuff could benefit from the same kind of sugarization?
13:15:40FromDiscord<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:56PMunchWhat do you mean?
13:17:27FromDiscord<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:04FromDiscord<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:20FromDiscord<Clonkk> Maybe it's just me being bad at reading
13:18:44PMunchSure, 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:00PMunchOftentimes I find that `proc` seems to lie when you attach custom pragmas
13:19:25FromDiscord<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:58PMunchI mean this could be used for anything, that's the beauty of it
13:20:12FromDiscord<Clonkk> And also the danger of it \:D↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
13:20:23PMunchHaha, of course :P
13:20:40PMunchBut it's not like we're adding more features here, we're just making syntax a bit nicer
13:21:24PMunchAs 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:07FromDiscord<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:35PMunchAnd 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:45PMunchWell conflicting keyword wouldn't be an issue
13:23:00PMunchSince these are just types you would have normal type collisions
13:23:56PMunchLet'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:30FromDiscord<Clonkk> But it's not really a type ?↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
13:25:09PMunchMaybe not, but it could be handled the same way none-the-less
13:25:55PMunchOf 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:26PMunchBut replace `proc` with `async` and voila now it's a `proc {.async.}` that is expected as the callback
13:26:49PMunchSaves on typing, less line noise, and generally just nicer
13:27:25PMunchBesides, typing {..} on a Norwegian keyboard is a pain, and the whole pragma syntax feels a bit tacked on.
13:27:41FromDiscord<Clonkk> So conceptually you'd introduce python-like decorator↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
13:27:59FromDiscord<Clonkk> Haha I have the same issue wiith azerty keyboard↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
13:28:36PMunchI mean pragmas are already akin to Python decorators
13:28:46PMunchI just want to sprinkle some sugar on it
13:28:54FromDiscord<Rika> I don’t like it. It will fuck with my recognition
13:30:10FromDiscord<Clonkk> Yeah I could see it being useful↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
13:30:27FromDiscord<Clonkk> Especially if you start playing with heavy oragma such as `Raise` list and so on
13:30:30PMunch@Rika, how so? These are likely to still be a callable thing, and we already have five(?) keywords that can go there
13:30:33FromDiscord<konsumlamm> if anything i'd prefer something like `safe proc example(...)` over `safe example(...)`
13:30:45PMunch@Clonkk, exactly
13:30:55FromDiscord<Clonkk> Yeah I was about to suggest something like this↵(@konsumlamm)
13:31:00FromDiscord<Rika> In reply to @konsumlamm "if anything i'd prefer": Same here. I commented just that
13:31:01FromDiscord<konsumlamm> not using func/proc doesn't make it obvious that you're defining a function
13:31:09PMunch@konsumlamm, but what if the output isn't a procedure?
13:31:15PMunchNow we're just lying to the user again..
13:31:17FromDiscord<Rika> Why would it not be…
13:31:25FromDiscord<Rika> Just use a macro by then
13:31:29PMunch@Rika, it could be a pure function?
13:31:37FromDiscord<Rika> Ah that’s what you mean
13:31:38arkanoidPMunch: thanks for the nimDumpAsync check, damn line 37 :D http://ix.io/3Pd3/nim
13:32:06FromDiscord<konsumlamm> isn't the point to define custom function types though?
13:32:40FromDiscord<konsumlamm> tbh, i think just using pragmas works fine
13:32:52FromDiscord<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:00FromDiscord<Rika> I think so too
13:33:11PMunchWell 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:39FromDiscord<Rika> I don’t see what’s wrong with pragmas
13:33:47FromDiscord<Rika> “It’s a pain to type” sounds like a non-issue
13:33:47PMunch@konsumlamm, and you're free to use pragmas, I'm not saying we should do away with pragmas
13:34:10FromDiscord<Clonkk> Let"s say you have a long list of pragma you want to use as an umbrella identifier↵(@Rika)
13:34:12PMunch@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:17FromDiscord<Clonkk> It imporves readability
13:34:26FromDiscord<Rika> In reply to @Clonkk "Let"s say you have": You can define a pragma that combines pragmas, you know
13:34:28PMunch@Clonkk, you could define a pragma pragma,
13:34:45PMunchBut its still not super nice
13:35:02FromDiscord<Clonkk> yes of course, the point is just to provide syntaxic sugar on a proc↵(@Rika)
13:35:30FromDiscord<Rika> I think this is too sweet.
13:35:30FromDiscord<Clonkk> Is `customProc foo() = #...` better than `proc foo() {.custom.} = ...`
13:35:33FromDiscord<Clonkk> ?
13:35:42FromDiscord<Rika> No.
13:36:23*Gustavo6046 quit (Remote host closed the connection)
13:36:48FromDiscord<Clonkk> Personnaly I think there are cases where it's justified and read better
13:36:58FromDiscord<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:01FromDiscord<Clonkk> The exmaple of interrupt was a good one for instance
13:38:29FromDiscord<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:56PMunchasync is another one, Typing `proc <blah blah> {.async.}` is tedious, just `async <blah blah>` is much nicer
13:39:02FromDiscord<Rika> There’s no solution to that
13:39:06PMunchAnd now I only have to scan the left column to identify the async procedures
13:39:19FromDiscord<Clonkk> Syntaxic sugar or me changing keyboard \:D↵(@Rika)
13:39:27PMunch@Rika, yes there is, to not use those weird symbols..
13:39:37FromDiscord<Rika> Keyboard layouts being unfriendly to certain syntax
13:40:03PMunchWell if your keyboard layout is unfriendly to typing words then you might want to consider switching layouts..
13:40:08FromDiscord<Rika> So are we limiting the whole syntax to alphanumeric
13:40:22PMunchWe're limiting it to Nim identifiers
13:40:26PMunchObviously
13:40:35arkanoidI 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:59FromDiscord<abisxir> Guys do you know a dead simple C library for graphic programming? Not something like SDL or a game engine.
13:41:09PMunch@abisxir, imlib?
13:41:23FromDiscord<abisxir> Humm, let me check it
13:41:42arkanoidhttps://github.com/raysan5/raylib ?
13:41:45PMunchDepends on what you mean by dead simple though
13:42:02PMunchWhat do you actually need it for?
13:42:25FromDiscord<abisxir> imlib is complicated enough
13:43:14FromDiscord<abisxir> Do you remeber old time graphics.h? easy like circle(x, y, radius) draw(....) line(...) etc
13:43:28FromDiscord<enthus1ast> raylib
13:44:14FromDiscord<enthus1ast> or even pixie
13:44:32FromDiscord<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:55FromDiscord<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:12FromDiscord<konsumlamm> so i don't think `type async = proc {.async.}` is desirable, even if it was possiblr
13:45:36FromDiscord<enthus1ast> even simpler than raylib is pixie, but its not accelerated
13:46:42arkanoidPMunch: 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:19PMunch@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:48PMunch@arkanoid, seems like it unfortunately
13:48:11PMunchMaybe raise an issue about that in the Nim repo, seems like those features should compose better
13:48:39FromDiscord<Rika> In reply to @PMunch "<@312654963694108674>, maybe not, and": Interrupt handlers are not procedures? Since when
13:49:05arkanoidPMunch: yes I think so
13:50:43PMunch@Rika, well I guess they might fall under the procedure umbrella
13:50:51FromDiscord<Clonkk> I assume in the sense that there are things you would like to forbid in ISR↵(@Rika)
13:51:22FromDiscord<Rika> In reply to @Clonkk "I assume in the": That doesn’t disqualify them from being procedures
13:51:47PMunchBy that logic `func` is also a `proc`
13:51:58PMunchAs it is also a sub-specialisation of a procedure
13:52:06FromDiscord<Rika> I would say that.
13:52:12PMunchSo then it should be `func proc()`..
13:52:12arkanoidPMunch: it has already been issued https://github.com/nim-lang/Nim/issues/6639
13:52:16FromDiscord<Rika> pure proc …(…)
13:52:18FromDiscord<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:51FromDiscord<Clonkk> You'd prefer `pure proc()` over `func` ?↵(@Rika)
13:54:40PMunchI'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:34FromDiscord<Clonkk> so UFCS for pragma \:D ?
13:59:09PMunchYeah I guess :)
13:59:28PMunchI mean that is another way of implementing this
13:59:46PMunchJust allowing any pragma to take the place of `proc`
14:00:00PMunchIt makes sense, they're applying a transformation on the proc
14:00:28PMunchWell, maybe only those which doesn't take arguments..
14:00:56PMunch`raises:[Exception] myThing(x: int, y: int): string` looks a bit meh
14:03:08Amun-Raufc'ed pragma would be ugly as
14:05:02FromDiscord<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:39FromDiscord<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:37FromDiscord<lantos> sent a code paste, see https://play.nim-lang.org/#ix=3PdT
15:54:54FromDiscord<Rika> `a.len div c` returns an int
15:55:14FromDiscord<Rika> use div instead of / and youll remove a lot of the "noise"
15:55:42FromDiscord<lantos> (edit) "https://play.nim-lang.org/#ix=3PdT" => "https://play.nim-lang.org/#ix=3PdU"
15:59:18FromDiscord<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:19FromDiscord<Rika> down only
16:00:50FromDiscord<lantos> sent a code paste, see https://play.nim-lang.org/#ix=3PdY
16:01:15FromDiscord<Rika> In reply to @lantos "any downside you can": we're not python; use if over try
16:01:33FromDiscord<lantos> >,<
16:11:21*Gustavo6046 quit (Quit: Leaving)
16:11:39*Gustavo6046 joined #nim
16:11:57*Gustavo6046 quit (Client Quit)
16:16:24FromDiscord<Waldecir Santos> is it possible to overwrite this `:` operator here:
16:16:24FromDiscord<Waldecir Santos> https://media.discordapp.net/attachments/371759389889003532/941367007922774126/unknown.png
16:16:39FromDiscord<Waldecir Santos> (edit) "here:" => "here?:"
16:17:01FromDiscord<Elegantbeef> "overwrite"?
16:17:29FromDiscord<Waldecir Santos> Overflow
16:17:29FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Peb
16:17:42FromDiscord<Waldecir Santos> Bad example sorry 1 sec
16:18:08FromDiscord<Elegantbeef> The answer is probably "no"
16:18:13FromDiscord<Waldecir Santos> https://media.discordapp.net/attachments/371759389889003532/941367462530797669/unknown.png
16:18:30FromDiscord<Elegantbeef> What are you after?
16:18:55FromDiscord<Waldecir Santos> Trying to inject pragmas dynamically
16:19:14FromDiscord<Waldecir Santos> (edit) "dynamically" => ""dynamically" during compile time"
16:19:17FromDiscord<Elegantbeef> You want a typedef macro
16:19:40FromDiscord<Elegantbeef> https://github.com/beef331/constructor/#defaults for instance
16:19:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Pef
16:22:35FromDiscord<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:49FromDiscord<Waldecir Santos> I've some ideas and I'm using it to also learn nim, lol
16:23:15*audiophile_ joined #nim
16:56:02FromDiscord<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:10FromDiscord<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:43FromDiscord<eyecon> And: can we have a "validate" function which causes parser to fail if it doesn't satisfy some condition?
19:01:07FromDiscord<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:11NimEventerNew Nimble package! uuid4 - UUIDs in pure Nim, see https://github.com/vtbassmatt/nim-uuid4
20:05:21FromDiscord<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:06FromDiscord<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:48FromDiscord<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:35FromDiscord<eyecon> In reply to @KatrinaKitten "You can pass a": Thanks!
20:10:47FromDiscord<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:04FromDiscord<carpal> a way to `except XError as e`?
20:52:20FromDiscord<carpal> (edit) "XError" => "XError, YError"
21:03:16NimEventerNew Nimble package! klymene - Create beautiful command line interfaces in Nim. Based on docopt., see https://github.com/georgelemon/clymene
21:03:16NimEventerNew 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:19FromDiscord<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:58FromDiscord<federico3> Nim 1.6.4 is uploaded in Debian Sid \:)
22:25:46FromDiscord<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:50FromDiscord<Waldecir Santos> (edit) "covert" => "cover"
22:26:11FromDiscord<Elegantbeef> key params?
22:27:13FromDiscord<evoalg> no substitute for kwargs↵(@Waldecir Santos)
22:27:50FromDiscord<Elegantbeef> That's not 100% true, but yea 😀
22:28:05FromDiscord<Elegantbeef> Would require macros to support
22:28:19FromDiscord<evoalg> I was quoting what Solitude said, and I believed them
22:28:28FromDiscord<Elegantbeef> Well you can do it with macros
22:28:35FromDiscord<Elegantbeef> But it's not advised
22:28:40FromDiscord<evoalg> ahh that's because macros can do anything
22:28:55FromDiscord<evoalg> can macros write macros?
22:29:02FromDiscord<Elegantbeef> Yes
22:29:10FromDiscord<evoalg> gosh
22:29:11FromDiscord<Elegantbeef> Well macros cant do anything they can simulate many things
22:30:19FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Pg8
22:30:32*jmdaemon joined #nim
22:31:09FromDiscord<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:59FromDiscord<evoalg> and can use a Table
22:34:09FromDiscord<Elegantbeef> Could also use a tuple
22:34:12FromDiscord<Elegantbeef> `(hello: "world", other: "planets", otherer: 10)`
22:34:16FromDiscord<Elegantbeef> Would be the closes i'd imagine
22:34:37FromDiscord<Elegantbeef> Allows you to have heterogeneous types with a name -\> val
22:37:10FromDiscord<Elegantbeef> So i guess @Waldecir Santos there you go 😛
22:38:52FromDiscord<Waldecir Santos> Awesome, ty !
22:39:25FromDiscord<evoalg> The tuple would need to be defined at compiled time right?
22:39:29FromDiscord<Elegantbeef> Of course
22:39:49FromDiscord<Elegantbeef> but the procedure can be `proc doThing(tup: tuple)` so then you have a generic procedure that operates on any tuple
22:42:18FromDiscord<evoalg> to see if one of the args is an int, could `typeof` be used? ... or should a `try` `except` be used?
22:42:38FromDiscord<Elegantbeef> The former
22:42:58FromDiscord<evoalg> and it should use `when` instead of `if` for `typeof` ?
22:43:22FromDiscord<Elegantbeef> Yep
22:43:25FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Pgc
22:43:38FromDiscord<evoalg> nice, thank you!
22:43:45FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Pgd
22:43:47FromDiscord<Elegantbeef> fieldPairs is important 😛
22:44:16FromDiscord<evoalg> ahhhh ok!
22:44:17*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
22:47:05FromDiscord<evoalg> so why are macros discouraged for this sort of thing?
22:47:30FromDiscord<Elegantbeef> Well the simplest tool is the best tool
22:47:57FromDiscord<Elegantbeef> If you can do it with a procedure it's the best
22:48:59FromDiscord<evoalg> makes sense 🙂
22:49:30FromDiscord<evoalg> I can't just do \:) in matrix, but I have to click on the smiley icons
22:50:00FromDiscord<Elegantbeef> You can
22:50:07FromDiscord<Elegantbeef> it's a setting but you do also have to hit space after 🙂
22:51:23FromDiscord<evoalg> 🙂 works!
22:56:14FromDiscord<Elegantbeef> Yea element has some oddities
22:56:23FromDiscord<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