<< 24-03-2021 >>

00:00:34FromDiscord<Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2TUf
00:01:52FromDiscord<ajusa> In reply to @Anonymous Poet "does nim have a": `const alphabet = toSeq(32..255).map(x => chr(x))` should do the trick
00:02:16FromDiscord<ajusa> so yes, range to a list is done with `toSeq`
00:03:30FromDiscord<Anonymous Poet> the one thing I didnt try :/ haha, ty!
00:15:14FromDiscord<ajusa> In reply to @ajusa "might be a bit": specifically I'm wondering if there is a library that I can write nim code in along with sections of an article, and make sure that the Nim code is still correct while I edit. Almost like a jupyter notebook, but generated by running the file or something.
00:26:36*vicfred joined #nim
00:27:45*arecaceae quit (Remote host closed the connection)
00:28:26*arecaceae joined #nim
00:45:19FromDiscord<Yardanico> In reply to @ajusa "might be a bit": nimib
00:45:31FromDiscord<Yardanico> https://github.com/pietroppeter/nimib
00:45:57FromDiscord<Yardanico> In reply to @ajusa "`const alphabet = toSeq(32..255).map(x": There's a much simpler way of doing this though
00:46:12FromDiscord<ajusa> In reply to @Yardanico "https://github.com/pietroppeter/nimib": thank you so much, I just couldn't remember if I hallucinated it or not
00:46:34FromDiscord<Yardanico> If you really want a seq, then const chars = toSeq('\x32..'\x255')
00:47:04FromDiscord<Yardanico> Otherwise just const alphabet = '\x32'..'\x255'
00:56:08FromDiscord<Sabena Sema> nim's strformat is so very impressive, just from a terseness perspective
00:57:32*rockcavera quit (Remote host closed the connection)
00:58:01*rockcavera joined #nim
01:00:11*fredrikhr quit (Ping timeout: 256 seconds)
01:04:18*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
01:04:30FromDiscord<Zachary Carter> Implementation or syntax?
01:04:37FromDiscord<Sabena Sema> implementation
01:04:38*njoseph joined #nim
01:04:48FromDiscord<Sabena Sema> syntax is almost the same as c++
01:04:49FromDiscord<Zachary Carter> Ah
01:05:04FromDiscord<Sabena Sema> implementation is much easier because the macro can just directly do things
01:05:11FromDiscord<Zachary Carter> Yeah I was confused because I think it's very similar to pythons
01:05:36FromDiscord<Zachary Carter> Yeah metaprogramming ftw for things like this
01:06:24FromDiscord<ElegantBeef> Also strscans scanf/scantuple
01:07:11FromDiscord<ElegantBeef> Super nice to use for things like AOC
01:12:02*rockcavera quit (Remote host closed the connection)
01:12:03FromDiscord<ajusa> In reply to @Yardanico "https://github.com/pietroppeter/nimib": Hm, I'm getting a `Additional info: "Could not find command: \'git\'. OS error: No such file or directory" [OSError]` for some reason when I try to run a simple file based on the `hello.nim` provided in the repository. I have `git` installed and I am on linux. Any ideas?
01:12:41FromDiscord<Yardanico> Not sure honestly, you can ask @pietroppeter if he's online, I'm going to sleep soon
01:12:59FromDiscord<ajusa> ah alright, I saw that you had contributed so I wasn't sure if you knew. Good night!
01:13:57FromDiscord<Rika> Is the program seeing the same env vars you are seeing
01:14:18*krux02 quit (Remote host closed the connection)
01:14:29FromDiscord<ajusa> not sure
01:14:36FromDiscord<ajusa> this is the line it is failing at : https://github.com/pietroppeter/nimib/blob/main/src/nimib/gits.nim#L14
01:15:50FromDiscord<ajusa> looks like it doesn't look at PATH possibly? Although I'm not even sure why this library needs to run any git commands, for some sort of convenience function maybe?
01:16:40*rockcavera joined #nim
01:19:44FromDiscord<ajusa> eh I gave up and checked out the commit that doesn't look at my git repo stuff for now, just want to start writing up something.
01:22:36*a_chou joined #nim
01:26:23*NimBot joined #nim
01:39:10FromDiscord<Sabena Sema> In reply to @Zachary Carter "Yeah metaprogramming ftw for": yeah I'm implementing std::format for c++ and it's way longer than strformat because we have to like, type erase the arguments to save on template instantiations and stuff
01:39:44FromDiscord<Sabena Sema> I have no idea if strformat is actually faster than printf though (which std::format kinda aims to be)
01:39:58FromDiscord<Sabena Sema> or well sprintf
01:48:13*YovelKey-Cohen[m joined #nim
01:51:19FromDiscord<Hi02Hi> sent a code paste, see https://play.nim-lang.org/#ix=2TUy
01:53:59FromDiscord<Hi02Hi> I just dont trust i beat everyone else with 15 loc
01:56:18leorize[m]it's more likely that you didn't beat them from what I can infer from the code :p
01:56:31FromDiscord<ElegantBeef> What's the benchmark?
01:56:39leorize[m]try using `hyperfine` to benchmark, it produces better results
01:56:57FromDiscord<Hi02Hi> i used the shell time
01:57:06FromDiscord<ElegantBeef> I mean what's the actual challenge
01:57:31FromDiscord<Hi02Hi> https://benhoyt.com/writings/count-words/#other-languages
01:59:14FromDiscord<ElegantBeef> You duplicate a shit ton of strings
02:00:11FromDiscord<ElegantBeef> I'm fairly certain i can do it faster than you
02:00:25FromDiscord<ElegantBeef> ~~Looks at strviewsutils~~ πŸ˜„
02:03:13leorize[m]Hi02Hi, seems like you're benchmarking it wrong, since you're not solving the challenge
02:04:00leorize[m]the `simple` nim version is similar to what you wrote though :p
02:07:43FromDiscord<Hi02Hi> what am i not doing? the output looks the same
02:08:22leorize[m]oh, sorry, I misread it
02:08:46leorize[m]I got curious and tried to look at Zig's "simple" version
02:08:49FromDiscord<Hi02Hi> In reply to @ElegantBeef "You duplicate a shit": this was a starting point for others to optimize
02:08:54FromDiscord<Hi02Hi> go ahead
02:09:24FromDiscord<Hi02Hi> it just seemed too fast
02:09:25leorize[m]I don't think you can say simple.zig is simple lol
02:09:29FromDiscord<ElegantBeef> Where is the test set?
02:09:37FromDiscord<Hi02Hi> hold on
02:09:55FromDiscord<ElegantBeef> Ah i got it
02:10:01FromDiscord<Hi02Hi> https://github.com/benhoyt/countwords/blob/master/kjvbible.txt
02:10:32*leorize joined #nim
02:10:58leorizethe optimized nim version looks kinda complicated
02:15:02FromDiscord<ElegantBeef> Well using views i got down to `0.62`s
02:15:53FromDiscord<ajusa> Why is zig's simple version using the buffer stuff lol, that is only supposed to be for the optimized versions of code
02:16:36PrestigeI like how grep is on the list, lol
02:22:47FromDiscord<Rika> Simple probably means whatever a beginner would think of naively
02:22:59leorizeyou can try reading that code :P
02:24:54FromDiscord<Hi02Hi> In reply to @Rika "Simple probably means whatever": which is what i tried to write
02:25:03*a_chou quit (Ping timeout: 245 seconds)
02:31:21FromDiscord<ajusa> Is it always a bug if I can get Nim's output to not compile? Just got a `Error: execution of an external compiler program 'gcc'` for the first time, on both 1.4.4 and devel
02:35:01leorizecan you give us the full compilation output?
02:38:47FromDiscord<ajusa> Seems like I ran into https://github.com/nim-lang/Nim/issues/16845
02:40:10FromDiscord<ajusa> I just updated that with the error I got, basically you can't redeclare types in different blocks with the same name in the same file
02:40:22FromDiscord<ajusa> so maybe types declarations just aren't block scoped? not sure
04:10:20*rockcavera quit (Remote host closed the connection)
04:24:48*fputs joined #nim
05:02:07*jjido quit (Quit: Connection closed for inactivity)
05:03:07*asdflkj quit (Ping timeout: 260 seconds)
05:25:57*asdflkj joined #nim
05:27:04FromDiscord<jfmonty2> sent a code paste, see https://play.nim-lang.org/#ix=2TV9
05:27:19FromDiscord<jfmonty2> or is there a way I can avoid having to type out A and B here?
05:27:53FromDiscord<Yardanico> one thing is that you can try to use implicit generics
05:27:55FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#generics-implicit-generics\
05:27:57FromDiscord<Yardanico> (edit) "https://nim-lang.org/docs/manual.html#generics-implicit-generics\" => "https://nim-lang.org/docs/manual.html#generics-implicit-generics"
05:28:11FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TVa
05:28:35FromDiscord<Yardanico> (edit) "https://play.nim-lang.org/#ix=2TVa" => "https://play.nim-lang.org/#ix=2TVb"
05:28:51FromDiscord<Yardanico> (edit) "https://play.nim-lang.org/#ix=2TVb" => "https://play.nim-lang.org/#ix=2TVc"
05:29:01FromDiscord<jfmonty2> hm, interesting
05:31:09FromDiscord<jfmonty2> ok, so in this case I could do `proc doSomething(m: MyType, n: myType.someField) =` it looks like
05:31:50FromDiscord<Yardanico> yes
05:32:02FromDiscord<jfmonty2> er, `MyType.B` maybe
05:32:53FromDiscord<Yardanico> maybe give more descriptive names to your generic types in MyType? :P
05:33:17FromDiscord<jfmonty2> right πŸ˜› I was just thinking of that
05:33:29FromDiscord<jfmonty2> That helps a surprising amount though. Funny how these little features make all the difference.
05:42:52ForumUpdaterBotNew thread by Halloleo: NimScript tasks with parameters?, see https://forum.nim-lang.org/t/7694
05:45:47*narimiran joined #nim
05:50:37FromDiscord<hamidb80> ok, im stuck
05:50:39FromDiscord<hamidb80> https://play.nim-lang.org/#ix=2lK1
05:51:12FromDiscord<hamidb80> https://play.nim-lang.org/#ix=2TVd
05:52:58FromDiscord<Yardanico> @hamidb80 `sorted` will return a seq[CmpList] but your func returns seq[List]
05:58:45FromDiscord<Yardanico> @hamidb80 also are you sure you don't want to return a Matrix as well?
05:58:56FromDiscord<hamidb80> yes
05:59:00FromDiscord<hamidb80> tnk u
05:59:09FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TVe
05:59:26FromDiscord<hamidb80> anyway
05:59:56FromDiscord<hamidb80> In reply to @hamidb80 "https://play.nim-lang.org/#ix=2TVd": look at line 27
06:00:06FromDiscord<hamidb80> there is a closed par in the end
06:00:24FromDiscord<Yardanico> yes but that's not the cause of the error
06:00:54ForumUpdaterBotNew thread by Halloleo: Can I do text replacements in a file via a NimScript?, see https://forum.nim-lang.org/t/7695
06:01:55FromDiscord<Yardanico> ??
06:01:56FromDiscord<hamidb80> sent a code paste, see https://play.nim-lang.org/#ix=2TVh
06:02:09FromDiscord<hamidb80> result = s
06:02:16FromDiscord<Yardanico> copy the original matrix into the result right away
06:02:19FromDiscord<Yardanico> and then sort it in-place
06:02:26FromDiscord<hamidb80> sorted s, cmp
06:02:33FromDiscord<Yardanico> no
06:02:42FromDiscord<hamidb80> why noy
06:02:43FromDiscord<Yardanico> in-place is better than out-of-place since you don't need to copy
06:03:05FromDiscord<Yardanico> `sorted` takes the original seq, creates a copy, then sorts it and returns that↡`sort` sorts the original seq itself
06:03:05FromDiscord<hamidb80> (edit) "noy" => "not"
06:03:32FromDiscord<Yardanico> you can check that yourself - https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/algorithm.nim#L436
06:03:46FromDiscord<Yardanico> sorted literally creates a copy of the data, sorts it and returns that
06:03:52FromDiscord<Yardanico> so it's better to use `sort` ourselves
06:04:07FromDiscord<hamidb80> In reply to @hamidb80 "result = s": doesn't this line copy the s into result?
06:04:30FromDiscord<Yardanico> yes, but in your code you did two copies
06:04:38FromDiscord<Yardanico> first to populate `temp` and second is because of `sorted`
06:04:58FromDiscord<hamidb80> oh
06:05:06FromDiscord<hamidb80> tnx
06:05:45FromDiscord<hamidb80> what if i make this `func` inline?
06:06:14FromDiscord<Yardanico> yes you can do that, I just did it so that the code is easier to read
06:06:20FromDiscord<hamidb80> ok
06:23:08FromDiscord<Yardanico> In reply to @ajusa "looks like it doesn't": yeah you're right
06:23:11FromDiscord<Yardanico> I'll PR a fix
06:38:03FromDiscord<Yardanico> @ajusa my fix was merged
06:43:10FromDiscord<Araq> @clyybber don't ask me here, ask me in internals
06:45:54*narimiran quit (Ping timeout: 256 seconds)
06:50:34FromDiscord<pietroppeter> In reply to @ajusa "looks like it doesn't": @ajusa : the reason why nimib now calls git is that I added a header that will automatically link to your public github repo if it has one; now it is fixed on Linux (on Windows it was working) thanks to @Yardanico , although honestly I do not expect to fail when it does not find git (it should just skip that part), so maybe there is still some bug there
06:50:39FromDiscord<ElegantBeef> A reminder there is like a week until the end of the month for those TMWN submissions πŸ˜„
06:50:48FromDiscord<Yardanico> yeah @pietroppeter ^ add nimib here :P
06:50:49FromDiscord<Yardanico> https://github.com/beef331/website
06:50:52*Lord_Nightmare quit (Read error: Connection reset by peer)
06:51:06FromDiscord<ElegantBeef> I was just going to ask them if they wanted to πŸ˜„
06:51:08FromDiscord<pietroppeter> I will! I just need to officially release! very slow, I know!
06:51:25FromDiscord<Yardanico> it's fine to show off development things too :P
06:51:30FromDiscord<ElegantBeef> Lol it's fine
06:51:41FromDiscord<ElegantBeef> I just want enough that it doesnt look bad to publish
06:51:50FromDiscord<Yardanico> @pietroppeter oh, yeah, it certainly shouldn't fail because of that
06:52:08FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TVl
06:52:12FromDiscord<Yardanico> because execProcess actually expects the process to exist :)
06:52:31FromDiscord<Yardanico> we can just try: except OSError:
06:52:56FromDiscord<ElegantBeef> What's it attempting to get?
06:53:19FromDiscord<Yardanico> @ElegantBeef we already fixed the error
06:53:34FromDiscord<ElegantBeef> I'm just curious what it's doing
06:53:36FromDiscord<pietroppeter> yeah but in `src\nimib.nim` there is a `if isGitAvailable() and isOnGithub():` so it should not run `isOnGithub` when git is not available
06:53:45FromDiscord<Yardanico> @pietroppeter well it doesn't
06:53:55FromDiscord<Yardanico> I mean
06:54:46FromDiscord<ElegantBeef> I'm just a little confused about what git has to do with this project πŸ˜„
06:55:06FromDiscord<Yardanico> @ElegantBeef embedding a link to the git repo
06:55:08FromDiscord<Yardanico> (edit) "git" => "github"
06:55:10*haxscramper joined #nim
06:55:15*Lord_Nightmare joined #nim
06:55:50FromDiscord<pietroppeter> I added a header that automatically links to github repo if your document is in a github repo: example: https://pietroppeter.github.io/nimib/hello.html
06:55:51FromDiscord<ElegantBeef> This is fetching the actual url to do that?
06:55:57FromDiscord<Yardanico> @ElegantBeef yes?
06:56:11FromDiscord<ElegantBeef> Why not just use the file in the `.git` πŸ˜„
06:56:23FromDiscord<haxscramper> In reply to @ynfle "You are basically using": Yes, I did solve my error, but it wasn't related to recursion (there was no recursion whatsoever). The error was related to explicit `typedesc` field that silently broke everything.
06:56:23FromDiscord<Yardanico> @ElegantBeef calling git is more reliable imo
06:56:28FromDiscord<Rika> Will it work for non-github repos
06:56:30FromDiscord<Yardanico> also it will work for subdirs by default
06:56:35FromDiscord<Yardanico> @Rika no, for now it's _just_ github
06:56:43FromDiscord<Yardanico> but that's not a big problem anyway, and it's easily customizable
06:56:48FromDiscord<Yardanico> @pietroppeter the problem seems to be because of the fact that execCmdEx doesn't really respect poUsePath
06:56:58FromDiscord<Yardanico> so even with no options it successfully executed git
06:57:04FromDiscord<Yardanico> but then execProcess failed
06:57:48FromDiscord<Yardanico> I think that it's because execCmdEx adds `poEvalCommand` to options for startProcess
06:58:09FromDiscord<pietroppeter> no, at the moment is just github and should fail silently if it does not find a github repo. a lot of space for improvement or customization
06:59:13FromDiscord<Yardanico> also @pietroppeter change `let` to `const` in assets since you don't seem to change them anyway :)
06:59:27FromDiscord<Yardanico> and you only seem to use those assets once anyway, so const wouldn't lead to bigger binary size
07:00:35FromDiscord<pietroppeter> yeah, I should.
07:02:15FromDiscord<Yardanico> and about embedding code - the idea with instantiationInfo shouldn't be hard to implement, but I think that there would be some edge cases
07:02:18FromDiscord<Yardanico> but for general usage it should work fine
07:03:51FromDiscord<pietroppeter> yep, I think too is feasible, but that will definitely have to wait after rendering refactor (which I started working on but it is not planned for 0.1)
07:04:14FromDiscord<Yardanico> what will you do in that refactor?
07:06:47FromDiscord<pietroppeter> pushed now the work-in-progress branch: https://github.com/pietroppeter/nimib/tree/refactor-renders
07:08:00FromDiscord<pietroppeter> I will add render objects and separte the rendering part from the block part. blocks will be generic (no block kind anymore) to simplify creation of custom blocks. also it will simplify how to add or customize a rendering backend
07:08:10FromDiscord<Yardanico> oh, nice
07:09:28FromDiscord<pietroppeter> basically every block will have only a renderPlan, currently just a seq of strings. and according to backend it will execute the different steps. block renderPlan can be customized and rendering backend also will be customizable.
07:09:41FromDiscord<pietroppeter> (also pushed the change of let -> const in assets)
07:10:49FromDiscord<pietroppeter> and now I understand your explanation above and from what I understand now thanks to adding poUsePath also in ExecProcess it should indeed fail silently if it does not find git
07:13:34*leorize quit (Remote host closed the connection)
07:14:09*leorize joined #nim
07:18:06*r4vi quit (Ping timeout: 240 seconds)
07:18:29*r4vi joined #nim
07:45:04*lritter joined #nim
07:45:35FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TVw
07:45:51FromDiscord<Yardanico> it won't work for some things like triple-quoted literals if they span more than 1 line since then the indentation level would break
07:47:03FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/824187539145097216/unknown.png
07:51:21FromDiscord<Yardanico> well, I'm not sure why I used `static` since we could as well just read the source at runtime
07:53:55*fredrikhr joined #nim
08:02:02*vicfred quit (Quit: Leaving)
08:10:17FromDiscord<ElegantBeef> @Yardanico wanna take a look at my Commandline DSL and tell me if it's as odd as it looks to me? https://github.com/beef331/commander
08:10:41FromDiscord<ElegantBeef> Like the past few days i've worked on it, it just looks/feels od
08:10:42FromDiscord<ElegantBeef> (edit) "od" => "odd"
08:10:48FromDiscord<Rika> It looks fine to me
08:10:58FromDiscord<ElegantBeef> Ah
08:11:00FromDiscord<ElegantBeef> That's good
08:11:12FromDiscord<Rika> Maybe the Help part shouldn’t be just as is
08:11:26FromDiscord<Rika> Maybe needs a prefix like sub command or something dunno
08:14:08FromDiscord<ElegantBeef> Probably should take a nicename for the doc name just so can support identifiers and the like in the docs
08:14:49FromDiscord<ElegantBeef> non nim identifiers
08:39:42FromDiscord<pietroppeter> In reply to @Yardanico "well, I'm not sure": looks like a good starting point, I think it could make sense to add it as a new template (I would name it `nbCodeAsInSource`). I would not document it as official and I would adapt this after render refactoring. source is already available through `nbDoc.context["source"]` but it is highlighted, we could add a `nbDoc.context["source_raw"]` with the non-highlighted version. Do you want t
08:40:08FromDiscord<Yardanico> yeah, but maybe in the evening today (in ~7-8 hours) or tomorrow
08:40:18FromDiscord<pietroppeter> yep no problem!
08:40:27FromDiscord<Yardanico> but I'll switch to a runtime solution instead, maybe I could use nim's lexer
08:40:28FromDiscord<Yardanico> (edit) "use" => "reuse"
08:45:11FromDiscord<pietroppeter> yes, make sense. You could wrap that functionality in something like a `nbBlockFromSource(name: string, line: int, source: string): string` in `src\blocks.nim` (name is name of block, you might need that for blocks like `nbCodeAsInSource: echo "hi"` all on the same line)
08:56:31*PMunch joined #nim
09:01:50*narimiran joined #nim
09:19:20ForumUpdaterBotNew thread by Cmc: Channel.tryRecv fails when send in progress, is this expected behavior?, see https://forum.nim-lang.org/t/7696
09:22:56PMunchHmm, so this PROGMEM thing boils down to codegen having changed slightly for custom types
09:25:13PMunchIf I do `let myData {.codegenDecl: "N_LIB_PRIVATE const $# $# PROGMEM".} = [100'u8, 200, 300]` it works fine, that spits out `static NIM_CONST tyArray_ myData_ PROGMEM = {((NU8) 100), ((NU8) 200), ((NU8) 300)};`.
09:29:08PMunchBut if I create a custom type (not even a distinct type) `type Test = array[3, uint8]` and do `let myData {.codegenDecl: "N_LIB_PRIVATE const $# $# PROGMEM".} = Test([100'u8, 200, 300])` it spits out `static NIM_CONST tyArray_ TM_ = {((NU8) 100), ((NU8) 200), ((NU8) 300)}; N_LIB_PRIVATE const tyArray_ myData_ PROGMEM;` and a `nimCopyMem((void*)myData_, (NIM_CONST void*)TM_, sizeof(tyArray_));` in NimMainModule.
09:29:32PMunchThis obviously doesn't work as you can't copy data into PROGMEM on runtime.
09:45:46*dddddd_ joined #nim
09:47:30PMunchIt seems to have changed between 1.4.0 and 1.4.2
09:51:47FromDiscord<mratsim> There was a change so that large const are not inlined in each module but use pointers
09:51:51FromDiscord<mratsim> it might be related
09:52:15PMunchDefinitely sounds like it could be related
09:56:33FromDiscord<mratsim> I asked for a way to tag const as byaddr but I can't remember where
09:56:58FromDiscord<mratsim> and what was done was big const are now by addr instead of being inlined
10:00:40PMunchHmm, this isn't a const though, you can't use codegenDecl on consts
10:01:02PMunchI mean that change makes sense though, and it might be related
10:01:33PMunchBut this seems like a bug more than anything. Nim creates two global arrays for it, then as the first thing it does is to copy all the contents from one over into the other
10:02:21FromDiscord<mratsim> ah yes, what I mentioned only applied to const
10:08:05PMunchI'm setting up a git autobisect now
10:08:20PMunchThat should tell me exactly which commit is causing this
10:13:21*waleee-cl quit (Quit: Connection closed for inactivity)
10:19:38*krux02 joined #nim
10:28:00*Vladar joined #nim
10:31:58PMunch99032ca07b39e272519e36d758391063dd659178
10:33:03PMunchThat's apparently the first bad commit
10:34:54PMunchIf I where to guess it's this that causes the error: https://github.com/nim-lang/Nim/commit/99032ca07b39e272519e36d758391063dd659178#diff-ee922073e19918f7b88397ee2092b6f34c21b0e9983cac3c9a5dae1b32ad2273R214
10:39:11PMunchDing ding ding, that was it
10:42:05FromDiscord<mratsim> It is indeed related to the `dontInlineConstant` change πŸ˜‰
10:42:16PMunchYup, you where right :)
10:43:37Clonkk[m]Small question: do you think it is wise to define a cdouble <-> float64 converter in code that pass float64 to C to avoid constantly converting ``ptr UncheckedArray[float64]`` to ``ptr UncheckedArray[cdouble]`` ?
10:51:32FromDiscord<mratsim> I thought it was type cdouble = float64?
10:52:11FromDiscord<mratsim> just wrap your C code with proc foo(a: ptr UncheckedArray[float64]) instead of proc foo(a: ptr UncheckedArray[cdouble])
10:52:31FromDiscord<mratsim> c2nim has facilities to change the type generated
10:52:54Clonkk[m]<FromDiscord "<mratsim> I thought it was type "> Yup, my type mismatch was elsewhere
10:55:20PMunchHmm, not sure why `dontInlineConstant` is even called for a let declaration though
11:02:27*dddddd_ quit (Ping timeout: 260 seconds)
11:11:12*withered_dragon joined #nim
11:11:47PMunchCreated an issue for this: https://github.com/nim-lang/Nim/issues/17497
11:14:24FromDiscord<mratsim> ah I know why I couldn't find an isue, it was a RFC: https://github.com/nim-lang/RFCs/issues/257
11:15:43PMunchYeah I found it through the issue text
11:18:56PMunchAdded a `if result: writeStackTrace()` to the `dontInlineConstant` procedure and this is what it spat out http://ix.io/2TWp
11:23:55FromDiscord<exelotl> oh, it's very cool that this const stuff is being worked on
11:24:10PMunchWhat do you mean?
11:24:51FromDiscord<exelotl> like, just seeing that there are RFCs/PRs for addressable consts from this year
11:25:53PMunchI mean that is apparently already a thing since 1.4.2
11:26:11PMunchWell not directly addressable, but at least not copied
11:27:58PMunchHmm, this applies to vars as well
11:29:18*letto quit (Read error: Connection reset by peer)
11:30:30FromDiscord<exelotl> the whole addressable const thing is something I really need for GBA dev and so far I've had to use `{.exportc.}` for most use cases, except for constant arrays of integers where the PROGMEM stuff works as expected (I hadn't noticed the bug you mentioned either, maybe it's happening but just doesn't do anything on the GBA?)
11:31:05*letto joined #nim
11:31:24PMunchIt works fine for a constant array of integers, but not if you have that declared as a certain type
11:32:11FromDiscord<exelotl> ah I see
11:33:43FromDiscord<mratsim> you should add your need for addressable const
11:33:51FromDiscord<mratsim> my need was avoiding duplicating code
11:34:04FromDiscord<mratsim> but the const with an address is not solved either.
11:34:14FromDiscord<mratsim> I use `let` for that.
11:34:41FromDiscord<mratsim> but it's annoying because that means Nim considers there is a sideeffect in accessing it.
11:38:23PMunchHmm, it appears to just do this transformation based on reading the code and not actually understanding it. Moving from `let x = Test([...array data...])` to `let x: Test = [...array data...]` makes it behave like in 1.4.0
11:41:45*krixec joined #nim
11:42:03FromDiscord<exelotl> oh wait I mistyped earlier
11:43:23PMunchWhy can't I do this by the way? https://play.nim-lang.org/#ix=2TWr
11:43:27FromDiscord<exelotl> I meant I use {.emit.} and/or {.importc.}
11:44:23PMunchYeah, that's one way of doing it. It's a bit hacky though..
11:45:30PMunchZevv and I where playing around with PROGMEM and how to create an easier system for it. So that you could just say that something was progmem and it would generate the required templates to call pgm_read or memcpy_P for you automatically
11:47:50FromDiscord<exelotl> yeah the {.emit.} + {.importc, nodecl.} combo leads to some annoying issues because I can't export that symbol to other modules, can't use inline procs that refer to the symbol, etc.
11:48:19FromDiscord<exelotl> @mratsim my use case actually hasn't changed since a year ago haha
11:48:31FromDiscord<exelotl> see my "Animation data" and "Dispatch tables" examples: https://forum.nim-lang.org/t/5192#32574
12:02:36*whitefly joined #nim
12:16:29*narimiran quit (Ping timeout: 265 seconds)
12:23:02FromDiscord<mratsim> In reply to @exelotl "<@!570268431522201601> my use case": I mean, add your need to my RFC and I can reopen it.
12:26:22*rockcavera joined #nim
12:47:13*JustASlacker joined #nim
12:47:39JustASlackerhello people of #nim
12:48:38JustASlackerIve have a small script where I use walkdir to get all files https://nim-lang.org/docs/os.html#walkDirRec.i,string
12:49:17JustASlackerthat works fine except when I dont have permissions to read dir content
12:49:31JustASlackerthen it just returns an empty list
12:50:12JustASlackerso I tried to find out the dir permissions via https://nim-lang.org/docs/os.html#getFilePermissions%2Cstring
12:50:47JustASlackerBut I dont see an easy way to check if Im allowed or not.
12:51:08JustASlackerso right now, I just try to enter the dir with SetCurrentDir and handle the excepton
12:51:12JustASlackerbut that looks bad
12:51:19JustASlackerany other ideas?
12:58:20Amun_Raposix.opendir?
13:07:48JustASlackerhmm, interesting
13:13:45FromDiscord<Rika> i dont understand the issue
13:13:55FromDiscord<Rika> if you cant read the dir, what is the expected outcome
13:14:31PMunch@Rika, I think he wants to return an error instead of just saying that the dir is empty
13:14:59FromDiscord<Rika> i see
13:15:09FromDiscord<Rika> wasnt clear
13:16:03FromDiscord<Rika> well then whats wrong with getFilePermissions?
13:16:47JustASlackerwell, you get something like this back
13:17:00PMunchWell it will return fpUserRead for example when a folder is owned by root and is only readable by root
13:17:25FromDiscord<Rika> ah so you need the owner as well
13:17:31PMunchSo you need to get the owner as well, and the group of the file, and the groups your in
13:17:32JustASlackerYes
13:17:35JustASlackerexcatly
13:17:41PMunchAnd your username/id
13:18:06JustASlackerlots of stuff, and I couldt find a way to get owner with the stuff in os
13:18:49JustASlackerwell, my use case is that I check all the certificates inside the dir
13:19:09JustASlackerI need that to fail when I cant read those certs
13:20:33JustASlackerhttps://pastebin.com/1g7cv2wp
13:32:18PMunchThis should work: https://play.nim-lang.org/#ix=2TWM
13:33:58FromDiscord<Yardanico> From #gamedev - is this a feature?
13:34:03FromDiscord<Yardanico> this compiles just fine
13:34:08FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TWO
13:35:11JustASlackerYardanico, thx <3
13:35:17FromDiscord<Yardanico> ?
13:35:24FromDiscord<Yardanico> you meant to say PMunch :P
13:35:47JustASlackeroh, right
13:35:58JustASlackerthx PMunch <3
13:44:53PMunchNo problem
13:45:13PMunchI guess this isn't in the os module simply because Windows doesn't have the same concept of file permissions
13:45:49PMunchBut it would be nice to have a "can I perform X on this file/folder" procedure there. That would be something like that on Linux, and a simpler check on Windows.s
13:46:25PMunchAnd then you just pass it a set of read/write/exec depending on what you want to do
13:47:13FromDiscord<Araq> custom numeric literals arrived, https://github.com/nim-lang/Nim/pull/17489
13:47:53*SunDwarf is now known as Lura
13:48:23FromDiscord<Araq> many thanks to JohnAD! He did most of the work
13:49:37PMunchOh cool
13:51:55*fputs quit (Quit: WeeChat 3.1)
13:52:21*fputs joined #nim
13:54:31PMunchHmm, what is the logic for `choosenim update devel`? It still pulls 8ccde68f132be4dba330eb6ec50f4679e564efac for me..
13:54:54Clonkk[m]Maybe choosenim update self before ?
13:55:00Oddmongertemplate cannot emits code, can it ? Β« template P(p:proc) = proc p() Β» won't generate Β« proc p() Β» ?
13:55:09PMunchNah, it takes the latest nightly
13:55:17PMunch--latest grabs the actual latest commit
13:55:25*krixec quit (Quit: WeeChat 3.1)
13:55:33*m4r35n357 quit (Quit: Ex-Chat)
13:55:37FromDiscord<Yardanico> yes
13:56:06FromDiscord<Yardanico> @Oddmonger it can do what you want, but only in some cases
13:56:27PMunch@Araq, did you see the issue from earlier with the codegen creating a nimCopyMem for static globals?
13:56:33FromDiscord<Yardanico> sent a code paste, see https://paste.rs/oS9
13:57:40PMunchI guess that would actually even double the initial memory consumption of things with lots of globals..
13:57:44Oddmongerthank you Yardanico, the idea is to speed up prototyping
13:58:43FromDiscord<exelotl> In reply to @Araq "custom numeric literals arrived,": aaaaah epic
13:59:46FromDiscord<exelotl> now I'll be able to do 2.5'fp for fixed point in my game instead of fp(2.5) :D
14:01:00FromDiscord<mratsim> and 2'big
14:01:04FromDiscord<mratsim> or 2'u256
14:02:14OddmongerYardanico : i can prototype with that: https://play.nim-lang.org/#ix=2TWZ
14:02:21FromDiscord<Yardanico> lol
14:02:32PMunchOh damn, didn't even consider fixed point, this is perfect for that!
14:02:35FromDiscord<Yardanico> just use editor snippets :P
14:02:47Oddmongerbut that's not a big deal compared to writting full proto
14:02:53PMunchAnd it even takes arguments!
14:03:20PMunchTotally breaks my code highlighter though :P
14:04:43FromDiscord<Araq> related: finally `-128'i8` works
14:05:06JustASlackerPMunch, whats up with that static and staticExec in your playground code
14:05:29FromDiscord<Yardanico> @PMunch yeah need to fix that
14:05:33FromDiscord<Yardanico> github highlighting breaks too
14:05:53*Cadey quit (Quit: WeeChat 3.0)
14:05:54PMunch@JustASlacker, oh that was just to find some folders with the correct file permissions to show it working
14:06:05PMunchIf you switch to compilation output you can see what it does
14:06:06*Xe joined #nim
14:06:30PMunch@Yardanico, GitHub highlighting will probably take longer to fix :P
14:06:37FromDiscord<Yardanico> not exactly, they use NimLime
14:06:43PMunchI'm not even sure which highlighter I'm using
14:06:45PMunchOh really?
14:06:46PMunchCool
14:07:22FromDiscord<Yardanico> https://github.com/github/linguist/blob/master/vendor/licenses/git_submodule/NimLime.dep.yml
14:07:40FromDiscord<Yardanico> yeah they need textmate grammar definitions so NimLime has been used since a long time ago
14:07:52FromDiscord<Yardanico> so we need to fix it in https://github.com/Varriount/NimLime
14:08:10FromDiscord<Yardanico> (and then update the commit in the github repo)
14:11:42FromDiscord<Yardanico> the relevant parts are starting with https://github.com/Varriount/NimLime/blob/master/Syntaxes/Nim.tmLanguage#L277
14:13:19FromDiscord<Yardanico> btw, just to double check, there's no way to get the _original_ code in its text form (not modified by renderer) passed to a template/macro, right?
14:13:38FromDiscord<Yardanico> except doing some external work by capturing necessary code from the source files
14:14:32FromDiscord<Rika> Wow nice feature
14:16:19FromDiscord<Yardanico> there are some good news from the jetbrains plugin btw
14:16:45FromDiscord<Yardanico> "In version 1.4.0 there is an initial support for types and some simple situations are now handled. I will continue on improving type evaluation support."
14:16:47FromDiscord<Yardanico> https://youtrack.jetbrains.com/issue/NIM-3
14:17:25FromDiscord<Yardanico> MCS autocompletion is still in plans though - https://youtrack.jetbrains.com/issue/NIM-33
14:18:28PMunch@Yardanico, that is true. No way to get the original text, unless you do some silly hacks
14:18:37FromDiscord<Yardanico> yeah, just wanted to confirm :)
14:18:42FromDiscord<Yardanico> guess I'll be doing one of these silly hacks :P
14:18:48FromDiscord<Yardanico> for https://github.com/pietroppeter/nimib
14:19:18FromDiscord<Yardanico> renderer likes to reformat code (which is not a bad thing but sometimes people might prefer the original style), and of course it removes non-doc comments
14:20:36FromDiscord<Araq> use nimpretty as a library, maybe
14:21:10FromDiscord<Yardanico> Yeah, I had something like that in mind, reuse Nim's lexer or more parts so that I can handle all the edge cases with triple-quoted strings and the like
14:22:22PMunchI think I was using macros.lineInfo to get the placement of things and then opened the file and read the section with that
14:22:31PMunchDon't remember what I was using it for though
14:23:21FromDiscord<Yardanico> yeah I already made the simplest solution with that at compile-time with insantiationInfo, but I can just make it runtime
14:23:23*al1ranger joined #nim
14:28:10FromDiscord<clyybber> @Araq awesome! is this double minus supposed to be included in the quotes ? https://github.com/nim-lang/Nim/pull/17488/files#diff-a3ec74f120eb5ec238c5db08f21d4148e2bbda1a01f53845d38e99c0c2fea6b9R542
14:28:50FromDiscord<Araq> the double minus is supposed to be a Gedankenstrich
14:29:16FromDiscord<Araq> good point, it's ambiguous
14:29:43FromDiscord<Gary M> Hey this is pretty cool, I might use that to make a simd scalar literal
14:29:49FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/824288900007591953/unknown.png
14:30:06FromDiscord<Yardanico> <https://github.com/nim-lang/Nim/commit/86af2f7b5057e2def4e07d680da7e4fd947bd2bd#diff-675b48280a134981d14c223555aead03f97d9ae557ecc322b9c2865babbd2281R355>
14:32:22FromDiscord<Yardanico> @Araq the point was that `isPositive` is true even in the `-` if branch
14:32:25FromDiscord<Yardanico> so it's never false
14:32:41FromDiscord<Araq> ah
14:33:00FromDiscord<Araq> well you'll fix my mistakes, I'm sure
14:33:56FromDiscord<clyybber> :D
14:52:37*icebattle quit (Ping timeout: 256 seconds)
14:53:28*krux02 quit (Remote host closed the connection)
14:58:06*al1ranger quit (Quit: Leaving)
15:00:06FromDiscord<Gary M> I'm having an issue of a `distinct` type I've defined saying `object constructor needs an object type`
15:00:19FromDiscord<Gary M> the type is a distinct `object`
15:02:18FromDiscord<Gary M> well I guess I kinda solved it. I'm using the original object's constructor and casting to the distinct type, but that feels weird.
15:02:22FromDiscord<mratsim> what's your instantiation line?
15:02:26FromDiscord<Yardanico> you can convert, not cast
15:02:34FromDiscord<Yardanico> but yeah, code would be interesting
15:02:51FromDiscord<Gary M> `template vec3(x2, y2, z2: Real): Vec3 = Vec3 VectorBase(v: InternalVec4(x: qfloat(x2), y: qfloat(y2), z: qfloat(z2), w: qfloat(0.0)))`
15:03:02FromDiscord<Gary M> it's messy πŸ˜„
15:03:25FromDiscord<Yardanico> not sure what's the issue?
15:03:42FromDiscord<Gary M> well I was doing Vec3(v: ...)
15:03:47FromDiscord<Gary M> it doesn't work that way
15:04:03FromDiscord<Gary M> it only works if it is not distinct
15:04:30FromDiscord<Yardanico> yeah it won't work, but why do you need a distinct object?
15:04:48FromDiscord<Yardanico> see https://github.com/nim-lang/Nim/issues/6248
15:05:33FromDiscord<Gary M> because I'm using a Vec2, Vec3, and Vec4 that share the exact same internal structure
15:05:42FromDiscord<Gary M> of a Union type, so it can't be inherited
15:06:40*waleee-cl joined #nim
15:07:48FromDiscord<Yardanico> then yeah, you need to use conversions (they're not casts!)
15:07:50FromDiscord<Gary M> and I don't want them to be implicitly converted by sharing the same type
15:07:58FromDiscord<Yardanico> they won't incur a runtime cost anyway
15:08:12FromDiscord<Yardanico> uint(8) is a conversion while cast[uint8](8) is a cast
15:08:16FromDiscord<Gary M> but now I'm having the issue that the fields on the original object aren't being seen 😦
15:08:21FromDiscord<Yardanico> yes, obviously
15:08:33FromDiscord<Gary M> okay I'm using conversions not casting
15:08:33FromDiscord<Rika> you have to borrow those
15:08:41FromDiscord<Gary M> how do I borrow?
15:08:57FromDiscord<Rika> {.borrow: `.`.} i forget where to put it
15:09:03FromDiscord<Rika> i think after the typ[e name
15:09:04FromDiscord<Rika> yeah
15:09:12FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TXm
15:09:47FromDiscord<Gary M> Thanks, everything works.
15:11:29FromDiscord<Gary M> and now I can make the operators generic, nice πŸ˜„
15:15:11*vicfred joined #nim
15:15:40*whitefly quit (Remote host closed the connection)
15:15:40*withered_dragon quit (Remote host closed the connection)
15:16:15FromDiscord<Cerda> Hey, guys is there are resources to learn Nim language?
15:16:31FromDiscord<Yardanico> There are plenty to choose from in https://nim-lang.org/learn.html
15:16:32FromDiscord<Solitude> https://nim-lang.org/learn.html
15:16:46*JustASlacker quit (Ping timeout: 265 seconds)
15:29:46*Vladar quit (Quit: Leaving)
15:30:04*Mister_Magister quit (Ping timeout: 256 seconds)
15:59:12FromDiscord<jfmonty2> (additional entries elided for clarity)
15:59:16FromDiscord<jfmonty2> sent a code paste, see https://play.nim-lang.org/#ix=2TXw
16:00:14FromDiscord<jfmonty2> How is there a type mismatch at position 0? It's the exact type it's asking for
16:01:15FromDiscord<jfmonty2> (edit) "It's" => "The third one is"
16:04:17saemDaaaaaayum custom numeric literals. :)
16:04:39saemYardanico: you thinking about syntax highlighting?
16:05:18leorize@jfmonty2 can you post the beginning of the message?
16:06:04FromDiscord<jfmonty2> sent a code paste, see https://paste.rs/KJv
16:06:36saemNimLime uses a textmate grammar, excellent. I wonder if their grammar is good. πŸ€”
16:06:38FromDiscord<jfmonty2> Before that it's just the usual compiler stuff about which config files it's using
16:07:07leorizecan you try manually converting the `int` to `Natural`?
16:07:23leorizesaem: their grammar powers Github's highlighter
16:08:19saemleorize: that one seems good but I haven't worked with it extensively.
16:08:29FromDiscord<jfmonty2> I tried converting to `Natural`, yeah, but it didn't help
16:08:39*PMunch quit (Quit: leaving)
16:09:07FromDiscord<jfmonty2> I think it might have something to do with the `[]` proc being `var`? But I need it to be `var` because elsewhere I have to do `inc(fixedseq[i])` sorts of things
16:09:09saemI'm asking because I can just throw it into the extension after converting it to json.
16:09:12leorize@jfmonty2 try adding generic parameters to your `FixedSeq`'s `[]` definition
16:09:53leorizeif it works then I guess you found yet-another-generic-bug
16:10:32saemAlso means I'll be consistent with NimLime and GitHub. Which has some mild consistency benefits.
16:10:58leorizesaem: not sure if their `1'i32` is fixed yet
16:11:21FromDiscord<jfmonty2> @alex.boisvert that does seem to work, yes. Weird because I was using implicit generics, which I thought should have the same effect? Should I post on the forum?
16:11:25*fredrikhr quit (Quit: Client Disconnecting)
16:11:27FromDiscord<jfmonty2> er, whoops
16:11:29FromDiscord<jfmonty2> wrong tag, sorry
16:11:42FromDiscord<jfmonty2> (edit) removed "@alex.boisvert"
16:12:07leorizeyou should file an issue on github
16:12:29leorizegenerics matching being weird is nothing too new unfortunately...
16:12:44FromDiscord<jfmonty2> Ok, will do. Thanks!
16:16:18*vicfred quit (Quit: Leaving)
16:16:47saemI'm starting to slowly put together a clearer point of view in regards to generic instantiation and might have a few fixes in that vicinity at some point.
16:17:38leorizelooking forward to the day you fix generics + distinct issues
16:18:13FromDiscord<jfmonty2> Actually wait, I might have spoken too soon. It seems that it was related to the `var` thing after all, because I added another proc that's the exact same, but without the `var`, and it works fine.
16:18:41leorizestill a bug
16:18:56*vicfred joined #nim
16:19:03leorize`var` should not suddenly make generics matching go wild
16:19:27FromDiscord<Gary M> "generics gone wild"
16:19:38FromDiscord<jfmonty2> Rule 34
16:19:57FromDiscord<jfmonty2> OK then I'll see if I can isolate what exactly is causing this to be weird, and if/when I do I'll post to github
16:20:26leorize@saem do you know what is this new `CUSTOM_NUMERIC_SUFFIX`?
16:21:13leorizeI don't see a rule for it...
16:22:42*narimiran joined #nim
16:25:50*arecaceae quit (Remote host closed the connection)
16:26:11*arecaceae joined #nim
16:27:10FromDiscord<hamidb80> i think i found a bug by mistake
16:27:12FromDiscord<hamidb80> https://play.nim-lang.org/#ix=2TXG
16:27:17FromDiscord<hamidb80> can anyone check this?
16:30:05leorizelooks like a serious type checking bug
16:30:19FromDiscord<hamidb80> should I open an issue?
16:30:43leorizeyea, please do
16:38:25FromDiscord<hamidb80> https://github.com/nim-lang/Nim/issues/17498
16:47:12*MTRNord quit (Ping timeout: 260 seconds)
16:47:44*BitPuffin quit (Ping timeout: 268 seconds)
16:47:44*j-james[m] quit (Ping timeout: 268 seconds)
16:47:44*unclechu quit (Ping timeout: 268 seconds)
16:48:23*fbpyr[m] quit (Ping timeout: 260 seconds)
16:48:23*drbixx[m] quit (Ping timeout: 260 seconds)
16:51:38*fbpyr[m] joined #nim
16:52:18*drbixx[m] joined #nim
16:53:10saemleorize: nope, I'll see if I can look tonight.
17:01:50*BitPuffin joined #nim
17:02:19*j-james[m] joined #nim
17:02:30*unclechu joined #nim
17:02:34*MTRNord joined #nim
17:06:17leorizesaem: I inferred from the source that it's the same as an unquoted ident
17:17:02*Mister_Magister joined #nim
17:25:02*JustASlacker joined #nim
17:41:11*superbia joined #nim
17:54:20*zedeus joined #nim
17:57:08FromDiscord<sealmove> are converters always implicit?
17:57:38FromDiscord<sealmove> if there a way to configure this? for example define a converter but disallow implicit convertions
17:58:29leorize[m]make a proc?
17:58:44FromDiscord<sealmove> but the proc can't have the same name as the type
17:58:57FromDiscord<sealmove> or can it?
17:59:46leorize[m]it can, but I usually prefer the `to<Type>` naming pattern, not sure what is nep1 recommendation though
18:00:07*letto quit (Quit: Konversation terminated!)
18:01:45FromDiscord<sealmove> nope: https://play.nim-lang.org/#ix=2TYp
18:02:01*letto joined #nim
18:13:12*JustASlacker quit (Quit: Leaving)
18:21:29*tane joined #nim
18:53:35*xet7 quit (Remote host closed the connection)
18:56:36*xet7 joined #nim
18:57:54FromDiscord<hamidb80> !eval var a = @[]; a.add [1,2,3]; echo a
18:57:55NimBotCompile failed: /usercode/in.nim(1, 9) Error: cannot infer the type of the sequence
18:58:26FromDiscord<hamidb80> !eval var a = @[0]; a.add [1,2,3]; echo a
18:58:28NimBot@[0, 1, 2, 3]
19:28:44*superbia quit (Quit: WeeChat 3.1)
19:47:28FromDiscord<zajrik> sent a code paste, see https://play.nim-lang.org/#ix=2TYN
19:47:45FromDiscord<zajrik> (edit) "https://play.nim-lang.org/#ix=2TYN" => "https://play.nim-lang.org/#ix=2TYO"
19:49:27FromDiscord<zidsal> I know optionutils supports that https://nimble.directory/docs/optionsutils//optionsutils.html
19:52:59FromDiscord<zidsal> My bad I need to read the full sentence. I missed the part about pattern matching
19:53:17FromDiscord<zajrik> No worries :o)
19:53:42FromDiscord<zajrik> I added the specific words "pattern matching" for clarity after you had sent it
19:53:58FromDiscord<zidsal> Ah, clearly I have been cleared of all charges!
19:54:07FromDiscord<zajrik> Indeed
19:55:52FromDiscord<haxscramper> In reply to @zajrik "<@608382355454951435> is there a": https://play.nim-lang.org/#ix=2TYR
19:56:01FromDiscord<haxscramper> `opt @capture or <default-expr>`
19:56:05FromDiscord<haxscramper> But it is not documented yes
19:56:10FromDiscord<haxscramper> I just forgot about it
19:56:35FromDiscord<zajrik> I saw that for sequence matching but not in other structures
19:56:42FromDiscord<haxscramper> well, rather it is documented but not very well https://nim-lang.github.io/fusion/src/fusion/matching.html#variable-binding-bind-variable-type
19:57:17FromDiscord<haxscramper> sent a code paste, see https://paste.rs/yQZ
19:57:47FromDiscord<haxscramper> well, yes, it applies to any patch
19:57:56FromDiscord<haxscramper> Though I'm not sure how it would work with option types
19:58:14FromDiscord<zajrik> Okay, so doing it like that captures the Option and not the value, yes?
19:59:03FromDiscord<haxscramper> Not sure if I understand the question. `or <default-expr>` makes capture have a value of `<default-expr>`
19:59:10FromDiscord<haxscramper> If capture itself failed
19:59:12FromDiscord<zajrik> Oh, hmm
19:59:38FromDiscord<haxscramper> well, it is not very well described, wait for a second I will tell you full semantics
19:59:44FromDiscord<zajrik> One sec, lemme get on discord on pc so I can paste code here
20:01:43FromDiscord<zajrik> sent a code paste, see https://play.nim-lang.org/#ix=2TYZ
20:01:52FromDiscord<zajrik> Compiler is telling me `c` is `Option[string]`
20:03:08FromDiscord<zajrik> I never had unpopulated settings during testing so I never realized I was able to get errors unpacking the settings that are Options when checking for changes lol
20:03:59FromDiscord<haxscramper> Can you show the definition of `SettingsComponent`?
20:04:26FromDiscord<zajrik> sent a code paste, see https://play.nim-lang.org/#ix=2TZ1
20:04:50FromDiscord<zajrik> For reference, all settings that are `Option[string]` are `None` when the settings value would be `""`
20:07:10FromDiscord<haxscramper> To match `Option[T]` you need to have `Some(@capture)`, because it is an explicit optional fieldΒ· `opt` was added for sequence/table matches. To do what you want you'd need to have `Some(@capture or "")`, but this is not supported right now (because it still isn't perfectly clear how to do this). It is probably somewhat confusing though, and I need to update documentation on `opt`/`Option`.
20:07:50FromDiscord<haxscramper> The man problem in `Some(@capture or <default>)` is that it breaks logic
20:08:11FromDiscord<haxscramper> Because outer part of the pattern kind of fails match, but it still succedes
20:08:39FromDiscord<haxscramper> But If I add `Some() or "default"` it would look like I'm defaulting `Some()`, not capture, which is also weird
20:08:39FromDiscord<zajrik> `Some()` is a special consideration in itself, correct? Could you not add special consideration to forward `<default>` to `get()` since it accepts a value for defaulting?
20:08:58*vicfred quit (Quit: Leaving)
20:09:01FromDiscord<zajrik> I think `Some(@capture or "")` looks great
20:09:13FromDiscord<zajrik> (edit) """)`" => ""default")`"
20:09:38*lritter quit (Ping timeout: 264 seconds)
20:09:52FromDiscord<haxscramper> It is not a problem of implementation
20:10:07FromDiscord<haxscramper> But maybe `Some(@capture or "default")` is intuitive enough
20:10:42FromDiscord<zajrik> I agree, it definitely seems intuitive enough to me
20:10:54FromDiscord<zajrik> It's very clear what it accomplishes
20:11:46FromDiscord<haxscramper> But what about `Some((field: @capture or "default"))`?
20:11:59FromDiscord<haxscramper> Or any other pattern involving `Some()` that has `or` clause
20:12:14FromDiscord<zajrik> oh, hmm
20:12:53FromDiscord<zajrik> Okay now I'm seeing the ambiguity
20:12:55FromDiscord<haxscramper> Ye, I'm not saying it is not possible, but it is necessary to consider that `Some()` can have any pattern inside, so it must be necessary to handle `or` for all cases
20:13:42FromDiscord<haxscramper> So last time I just left unimplemented because I couldn't find good enough solution that wouldn't be ambiguous
20:15:13FromDiscord<haxscramper> Although it might be possible to extend `opt` to denote something like "inaccessible", (no such key in table, not such element in array, "no value" for an field)
20:15:49FromDiscord<haxscramper> "no value" means `None()` or `nil` maybe? I.e. things that can be clearly considered "no value"
20:16:17FromDiscord<zajrik> and `or` would then offer the ability to provide defaults for "no value"
20:16:22FromDiscord<haxscramper> yes
20:16:25FromDiscord<zajrik> (edit) "and `or` would then offer the ability to provide defaults for ... "nooccurrence" added "any" | "any"no value" ... " added "occurrence"
20:16:37FromDiscord<haxscramper> And then your code would work as you wrote it. And it would not clash with `Some()` because `Some()` explicitly means `Some()/None()` for option, and `opt` is for `@capture or <default-for-no-value>`
20:16:44FromDiscord<zajrik> Seems reasonable to me
20:18:36FromDiscord<haxscramper> And `opt` for fields can be implemented by calling `optGetOrDefault` proc (overload it for `Option` and `ptr | ref` values)
20:21:05FromDiscord<zajrik> Oh, I didn't even think about just writing a proc for Option that just provides a default and use that in the pattern
20:21:12FromDiscord<zajrik> That would work for the time being, right?
20:22:40FromDiscord<haxscramper> Maybe, though it shouldn't be possible to pass arguments to `(proc:`. So if you are thinking about `(getOrDefault("default"): @capture)` is won't work
20:23:19FromDiscord<haxscramper> `(proc:` only supports zero-argument functions
20:23:24FromDiscord<zajrik> Nah, I was just thinking of writing one specifically for `Option[string]` that returns `""` if it's `None`
20:23:41FromDiscord<haxscramper> yes, that should work
20:24:14FromDiscord<zajrik> sent a code paste, see https://play.nim-lang.org/#ix=2TZ6
20:24:55FromDiscord<zajrik> Thanks for all your insight!
20:25:53FromDiscord<zajrik> If you happen to remember me when the time comes, I'd love to know if you ever work out defaulting for those "no value" matches in the future
20:26:42FromDiscord<haxscramper> I will have some time at the end of the week, and if I remember this part of implementation correctly it would only take couple hours to fix
20:26:59FromDiscord<zajrik> Nice
20:28:14FromDiscord<zajrik> oh wait, I can just `self.get("")` for that proc
20:28:16FromDiscord<zajrik> :drakeLUL:
20:28:21*narimiran quit (Ping timeout: 258 seconds)
20:31:59FromDiscord<zajrik> I'll keep an eye out for those changes then πŸ‘
20:34:17*PMunch joined #nim
21:22:54*hyiltiz quit (Ping timeout: 246 seconds)
21:35:16FromGitter<mantielero> I am trying to parse some binary data using `binaryparse`. I filed a question here: https://github.com/PMunch/binaryparse/issues/17
21:35:35PMunchI'm writing a response to that as we speak .)
21:35:44FromGitter<mantielero> Brilliant mate
21:36:08FromGitter<mantielero> I think is related to big-endian, but I am not able to make it work
21:36:21PMunchThere
21:37:02PMunchDefinitely related to endianness, but I also find a bug in binaryparse
21:37:06PMunchs/find/found
21:38:06FromGitter<mantielero> Great
21:38:45FromGitter<mantielero> For me is the first time that I try to do this in Nim, and I am amazed with how intuitive it is
21:39:30PMunchGood to hear, that was the goal of binaryparse :)
21:40:05FromGitter<mantielero> I wonder if it would make sense using https://github.com/johnnovak/nim-binstreams in order to handle better the endian
21:40:55PMunchOh you could definitely do that
21:42:27*haxscramper quit (Remote host closed the connection)
21:42:54*hyiltiz joined #nim
21:42:54*hyiltiz quit (Changing host)
21:42:54*hyiltiz joined #nim
21:47:38*hyiltiz quit (Ping timeout: 260 seconds)
21:48:36*hyiltiz joined #nim
21:48:36*hyiltiz quit (Changing host)
21:48:36*hyiltiz joined #nim
21:54:41PMunchOkay, it's late and I'm tired. But this doesn't make any sense.. Somehow the writing part is completely broken it seems..
21:54:57PMunchAt least the part that writes integers
21:55:12PMunchI'll have a look at it tomorrow. Maybe I'll even just rewrite the whole thing..
22:01:48*hyiltiz quit (Ping timeout: 265 seconds)
22:02:28*hyiltiz joined #nim
22:02:29*hyiltiz quit (Changing host)
22:02:29*hyiltiz joined #nim
22:12:19*krux02 joined #nim
22:40:49FromDiscord<zetashift> What is the recommended neovim plugin for Nim?
23:04:07*PMunch quit (Quit: leaving)
23:07:50FromDiscord<ElegantBeef> isnt it nim.nvim
23:08:12FromDiscord<ElegantBeef> I dont know of any other
23:15:51*tane quit (Quit: Leaving)
23:19:14*cornfeedhobo joined #nim
23:21:10*cornfeedhobo quit (Client Quit)
23:33:34FromDiscord<sealmove> when you forward declare a proc, where should you put the exportation mark?
23:33:52FromDiscord<sealmove> to the forward decl or the definition
23:34:04FromDiscord<ElegantBeef> i'd say both
23:34:50FromDiscord<ElegantBeef> Forward declarations have some odd logic currently πŸ˜„
23:35:49*vicfred joined #nim
23:43:51*vicfred quit (Quit: Leaving)