00:00:34 | FromDiscord | <Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2TUf |
00:01:52 | FromDiscord | <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:16 | FromDiscord | <ajusa> so yes, range to a list is done with `toSeq` |
00:03:30 | FromDiscord | <Anonymous Poet> the one thing I didnt try :/ haha, ty! |
00:15:14 | FromDiscord | <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:19 | FromDiscord | <Yardanico> In reply to @ajusa "might be a bit": nimib |
00:45:31 | FromDiscord | <Yardanico> https://github.com/pietroppeter/nimib |
00:45:57 | FromDiscord | <Yardanico> In reply to @ajusa "`const alphabet = toSeq(32..255).map(x": There's a much simpler way of doing this though |
00:46:12 | FromDiscord | <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:34 | FromDiscord | <Yardanico> If you really want a seq, then const chars = toSeq('\x32..'\x255') |
00:47:04 | FromDiscord | <Yardanico> Otherwise just const alphabet = '\x32'..'\x255' |
00:56:08 | FromDiscord | <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:30 | FromDiscord | <Zachary Carter> Implementation or syntax? |
01:04:37 | FromDiscord | <Sabena Sema> implementation |
01:04:38 | * | njoseph joined #nim |
01:04:48 | FromDiscord | <Sabena Sema> syntax is almost the same as c++ |
01:04:49 | FromDiscord | <Zachary Carter> Ah |
01:05:04 | FromDiscord | <Sabena Sema> implementation is much easier because the macro can just directly do things |
01:05:11 | FromDiscord | <Zachary Carter> Yeah I was confused because I think it's very similar to pythons |
01:05:36 | FromDiscord | <Zachary Carter> Yeah metaprogramming ftw for things like this |
01:06:24 | FromDiscord | <ElegantBeef> Also strscans scanf/scantuple |
01:07:11 | FromDiscord | <ElegantBeef> Super nice to use for things like AOC |
01:12:02 | * | rockcavera quit (Remote host closed the connection) |
01:12:03 | FromDiscord | <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:41 | FromDiscord | <Yardanico> Not sure honestly, you can ask @pietroppeter if he's online, I'm going to sleep soon |
01:12:59 | FromDiscord | <ajusa> ah alright, I saw that you had contributed so I wasn't sure if you knew. Good night! |
01:13:57 | FromDiscord | <Rika> Is the program seeing the same env vars you are seeing |
01:14:18 | * | krux02 quit (Remote host closed the connection) |
01:14:29 | FromDiscord | <ajusa> not sure |
01:14:36 | FromDiscord | <ajusa> this is the line it is failing at : https://github.com/pietroppeter/nimib/blob/main/src/nimib/gits.nim#L14 |
01:15:50 | FromDiscord | <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:44 | FromDiscord | <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:10 | FromDiscord | <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:44 | FromDiscord | <Sabena Sema> I have no idea if strformat is actually faster than printf though (which std::format kinda aims to be) |
01:39:58 | FromDiscord | <Sabena Sema> or well sprintf |
01:48:13 | * | YovelKey-Cohen[m joined #nim |
01:51:19 | FromDiscord | <Hi02Hi> sent a code paste, see https://play.nim-lang.org/#ix=2TUy |
01:53:59 | FromDiscord | <Hi02Hi> I just dont trust i beat everyone else with 15 loc |
01:56:18 | leorize[m] | it's more likely that you didn't beat them from what I can infer from the code :p |
01:56:31 | FromDiscord | <ElegantBeef> What's the benchmark? |
01:56:39 | leorize[m] | try using `hyperfine` to benchmark, it produces better results |
01:56:57 | FromDiscord | <Hi02Hi> i used the shell time |
01:57:06 | FromDiscord | <ElegantBeef> I mean what's the actual challenge |
01:57:31 | FromDiscord | <Hi02Hi> https://benhoyt.com/writings/count-words/#other-languages |
01:59:14 | FromDiscord | <ElegantBeef> You duplicate a shit ton of strings |
02:00:11 | FromDiscord | <ElegantBeef> I'm fairly certain i can do it faster than you |
02:00:25 | FromDiscord | <ElegantBeef> ~~Looks at strviewsutils~~ π |
02:03:13 | leorize[m] | Hi02Hi, seems like you're benchmarking it wrong, since you're not solving the challenge |
02:04:00 | leorize[m] | the `simple` nim version is similar to what you wrote though :p |
02:07:43 | FromDiscord | <Hi02Hi> what am i not doing? the output looks the same |
02:08:22 | leorize[m] | oh, sorry, I misread it |
02:08:46 | leorize[m] | I got curious and tried to look at Zig's "simple" version |
02:08:49 | FromDiscord | <Hi02Hi> In reply to @ElegantBeef "You duplicate a shit": this was a starting point for others to optimize |
02:08:54 | FromDiscord | <Hi02Hi> go ahead |
02:09:24 | FromDiscord | <Hi02Hi> it just seemed too fast |
02:09:25 | leorize[m] | I don't think you can say simple.zig is simple lol |
02:09:29 | FromDiscord | <ElegantBeef> Where is the test set? |
02:09:37 | FromDiscord | <Hi02Hi> hold on |
02:09:55 | FromDiscord | <ElegantBeef> Ah i got it |
02:10:01 | FromDiscord | <Hi02Hi> https://github.com/benhoyt/countwords/blob/master/kjvbible.txt |
02:10:32 | * | leorize joined #nim |
02:10:58 | leorize | the optimized nim version looks kinda complicated |
02:15:02 | FromDiscord | <ElegantBeef> Well using views i got down to `0.62`s |
02:15:53 | FromDiscord | <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:36 | Prestige | I like how grep is on the list, lol |
02:22:47 | FromDiscord | <Rika> Simple probably means whatever a beginner would think of naively |
02:22:59 | leorize | you can try reading that code :P |
02:24:54 | FromDiscord | <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:21 | FromDiscord | <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:01 | leorize | can you give us the full compilation output? |
02:38:47 | FromDiscord | <ajusa> Seems like I ran into https://github.com/nim-lang/Nim/issues/16845 |
02:40:10 | FromDiscord | <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:22 | FromDiscord | <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:04 | FromDiscord | <jfmonty2> sent a code paste, see https://play.nim-lang.org/#ix=2TV9 |
05:27:19 | FromDiscord | <jfmonty2> or is there a way I can avoid having to type out A and B here? |
05:27:53 | FromDiscord | <Yardanico> one thing is that you can try to use implicit generics |
05:27:55 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#generics-implicit-generics\ |
05:27:57 | FromDiscord | <Yardanico> (edit) "https://nim-lang.org/docs/manual.html#generics-implicit-generics\" => "https://nim-lang.org/docs/manual.html#generics-implicit-generics" |
05:28:11 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TVa |
05:28:35 | FromDiscord | <Yardanico> (edit) "https://play.nim-lang.org/#ix=2TVa" => "https://play.nim-lang.org/#ix=2TVb" |
05:28:51 | FromDiscord | <Yardanico> (edit) "https://play.nim-lang.org/#ix=2TVb" => "https://play.nim-lang.org/#ix=2TVc" |
05:29:01 | FromDiscord | <jfmonty2> hm, interesting |
05:31:09 | FromDiscord | <jfmonty2> ok, so in this case I could do `proc doSomething(m: MyType, n: myType.someField) =` it looks like |
05:31:50 | FromDiscord | <Yardanico> yes |
05:32:02 | FromDiscord | <jfmonty2> er, `MyType.B` maybe |
05:32:53 | FromDiscord | <Yardanico> maybe give more descriptive names to your generic types in MyType? :P |
05:33:17 | FromDiscord | <jfmonty2> right π I was just thinking of that |
05:33:29 | FromDiscord | <jfmonty2> That helps a surprising amount though. Funny how these little features make all the difference. |
05:42:52 | ForumUpdaterBot | New thread by Halloleo: NimScript tasks with parameters?, see https://forum.nim-lang.org/t/7694 |
05:45:47 | * | narimiran joined #nim |
05:50:37 | FromDiscord | <hamidb80> ok, im stuck |
05:50:39 | FromDiscord | <hamidb80> https://play.nim-lang.org/#ix=2lK1 |
05:51:12 | FromDiscord | <hamidb80> https://play.nim-lang.org/#ix=2TVd |
05:52:58 | FromDiscord | <Yardanico> @hamidb80 `sorted` will return a seq[CmpList] but your func returns seq[List] |
05:58:45 | FromDiscord | <Yardanico> @hamidb80 also are you sure you don't want to return a Matrix as well? |
05:58:56 | FromDiscord | <hamidb80> yes |
05:59:00 | FromDiscord | <hamidb80> tnk u |
05:59:09 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TVe |
05:59:26 | FromDiscord | <hamidb80> anyway |
05:59:56 | FromDiscord | <hamidb80> In reply to @hamidb80 "https://play.nim-lang.org/#ix=2TVd": look at line 27 |
06:00:06 | FromDiscord | <hamidb80> there is a closed par in the end |
06:00:24 | FromDiscord | <Yardanico> yes but that's not the cause of the error |
06:00:54 | ForumUpdaterBot | New thread by Halloleo: Can I do text replacements in a file via a NimScript?, see https://forum.nim-lang.org/t/7695 |
06:01:55 | FromDiscord | <Yardanico> ?? |
06:01:56 | FromDiscord | <hamidb80> sent a code paste, see https://play.nim-lang.org/#ix=2TVh |
06:02:09 | FromDiscord | <hamidb80> result = s |
06:02:16 | FromDiscord | <Yardanico> copy the original matrix into the result right away |
06:02:19 | FromDiscord | <Yardanico> and then sort it in-place |
06:02:26 | FromDiscord | <hamidb80> sorted s, cmp |
06:02:33 | FromDiscord | <Yardanico> no |
06:02:42 | FromDiscord | <hamidb80> why noy |
06:02:43 | FromDiscord | <Yardanico> in-place is better than out-of-place since you don't need to copy |
06:03:05 | FromDiscord | <Yardanico> `sorted` takes the original seq, creates a copy, then sorts it and returns thatβ΅`sort` sorts the original seq itself |
06:03:05 | FromDiscord | <hamidb80> (edit) "noy" => "not" |
06:03:32 | FromDiscord | <Yardanico> you can check that yourself - https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/algorithm.nim#L436 |
06:03:46 | FromDiscord | <Yardanico> sorted literally creates a copy of the data, sorts it and returns that |
06:03:52 | FromDiscord | <Yardanico> so it's better to use `sort` ourselves |
06:04:07 | FromDiscord | <hamidb80> In reply to @hamidb80 "result = s": doesn't this line copy the s into result? |
06:04:30 | FromDiscord | <Yardanico> yes, but in your code you did two copies |
06:04:38 | FromDiscord | <Yardanico> first to populate `temp` and second is because of `sorted` |
06:04:58 | FromDiscord | <hamidb80> oh |
06:05:06 | FromDiscord | <hamidb80> tnx |
06:05:45 | FromDiscord | <hamidb80> what if i make this `func` inline? |
06:06:14 | FromDiscord | <Yardanico> yes you can do that, I just did it so that the code is easier to read |
06:06:20 | FromDiscord | <hamidb80> ok |
06:23:08 | FromDiscord | <Yardanico> In reply to @ajusa "looks like it doesn't": yeah you're right |
06:23:11 | FromDiscord | <Yardanico> I'll PR a fix |
06:38:03 | FromDiscord | <Yardanico> @ajusa my fix was merged |
06:43:10 | FromDiscord | <Araq> @clyybber don't ask me here, ask me in internals |
06:45:54 | * | narimiran quit (Ping timeout: 256 seconds) |
06:50:34 | FromDiscord | <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:39 | FromDiscord | <ElegantBeef> A reminder there is like a week until the end of the month for those TMWN submissions π |
06:50:48 | FromDiscord | <Yardanico> yeah @pietroppeter ^ add nimib here :P |
06:50:49 | FromDiscord | <Yardanico> https://github.com/beef331/website |
06:50:52 | * | Lord_Nightmare quit (Read error: Connection reset by peer) |
06:51:06 | FromDiscord | <ElegantBeef> I was just going to ask them if they wanted to π |
06:51:08 | FromDiscord | <pietroppeter> I will! I just need to officially release! very slow, I know! |
06:51:25 | FromDiscord | <Yardanico> it's fine to show off development things too :P |
06:51:30 | FromDiscord | <ElegantBeef> Lol it's fine |
06:51:41 | FromDiscord | <ElegantBeef> I just want enough that it doesnt look bad to publish |
06:51:50 | FromDiscord | <Yardanico> @pietroppeter oh, yeah, it certainly shouldn't fail because of that |
06:52:08 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TVl |
06:52:12 | FromDiscord | <Yardanico> because execProcess actually expects the process to exist :) |
06:52:31 | FromDiscord | <Yardanico> we can just try: except OSError: |
06:52:56 | FromDiscord | <ElegantBeef> What's it attempting to get? |
06:53:19 | FromDiscord | <Yardanico> @ElegantBeef we already fixed the error |
06:53:34 | FromDiscord | <ElegantBeef> I'm just curious what it's doing |
06:53:36 | FromDiscord | <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:45 | FromDiscord | <Yardanico> @pietroppeter well it doesn't |
06:53:55 | FromDiscord | <Yardanico> I mean |
06:54:46 | FromDiscord | <ElegantBeef> I'm just a little confused about what git has to do with this project π |
06:55:06 | FromDiscord | <Yardanico> @ElegantBeef embedding a link to the git repo |
06:55:08 | FromDiscord | <Yardanico> (edit) "git" => "github" |
06:55:10 | * | haxscramper joined #nim |
06:55:15 | * | Lord_Nightmare joined #nim |
06:55:50 | FromDiscord | <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:51 | FromDiscord | <ElegantBeef> This is fetching the actual url to do that? |
06:55:57 | FromDiscord | <Yardanico> @ElegantBeef yes? |
06:56:11 | FromDiscord | <ElegantBeef> Why not just use the file in the `.git` π |
06:56:23 | FromDiscord | <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:23 | FromDiscord | <Yardanico> @ElegantBeef calling git is more reliable imo |
06:56:28 | FromDiscord | <Rika> Will it work for non-github repos |
06:56:30 | FromDiscord | <Yardanico> also it will work for subdirs by default |
06:56:35 | FromDiscord | <Yardanico> @Rika no, for now it's _just_ github |
06:56:43 | FromDiscord | <Yardanico> but that's not a big problem anyway, and it's easily customizable |
06:56:48 | FromDiscord | <Yardanico> @pietroppeter the problem seems to be because of the fact that execCmdEx doesn't really respect poUsePath |
06:56:58 | FromDiscord | <Yardanico> so even with no options it successfully executed git |
06:57:04 | FromDiscord | <Yardanico> but then execProcess failed |
06:57:48 | FromDiscord | <Yardanico> I think that it's because execCmdEx adds `poEvalCommand` to options for startProcess |
06:58:09 | FromDiscord | <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:13 | FromDiscord | <Yardanico> also @pietroppeter change `let` to `const` in assets since you don't seem to change them anyway :) |
06:59:27 | FromDiscord | <Yardanico> and you only seem to use those assets once anyway, so const wouldn't lead to bigger binary size |
07:00:35 | FromDiscord | <pietroppeter> yeah, I should. |
07:02:15 | FromDiscord | <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:18 | FromDiscord | <Yardanico> but for general usage it should work fine |
07:03:51 | FromDiscord | <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:14 | FromDiscord | <Yardanico> what will you do in that refactor? |
07:06:47 | FromDiscord | <pietroppeter> pushed now the work-in-progress branch: https://github.com/pietroppeter/nimib/tree/refactor-renders |
07:08:00 | FromDiscord | <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:10 | FromDiscord | <Yardanico> oh, nice |
07:09:28 | FromDiscord | <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:41 | FromDiscord | <pietroppeter> (also pushed the change of let -> const in assets) |
07:10:49 | FromDiscord | <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:35 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TVw |
07:45:51 | FromDiscord | <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:03 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/824187539145097216/unknown.png |
07:51:21 | FromDiscord | <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:17 | FromDiscord | <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:41 | FromDiscord | <ElegantBeef> Like the past few days i've worked on it, it just looks/feels od |
08:10:42 | FromDiscord | <ElegantBeef> (edit) "od" => "odd" |
08:10:48 | FromDiscord | <Rika> It looks fine to me |
08:10:58 | FromDiscord | <ElegantBeef> Ah |
08:11:00 | FromDiscord | <ElegantBeef> That's good |
08:11:12 | FromDiscord | <Rika> Maybe the Help part shouldnβt be just as is |
08:11:26 | FromDiscord | <Rika> Maybe needs a prefix like sub command or something dunno |
08:14:08 | FromDiscord | <ElegantBeef> Probably should take a nicename for the doc name just so can support identifiers and the like in the docs |
08:14:49 | FromDiscord | <ElegantBeef> non nim identifiers |
08:39:42 | FromDiscord | <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:08 | FromDiscord | <Yardanico> yeah, but maybe in the evening today (in ~7-8 hours) or tomorrow |
08:40:18 | FromDiscord | <pietroppeter> yep no problem! |
08:40:27 | FromDiscord | <Yardanico> but I'll switch to a runtime solution instead, maybe I could use nim's lexer |
08:40:28 | FromDiscord | <Yardanico> (edit) "use" => "reuse" |
08:45:11 | FromDiscord | <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:20 | ForumUpdaterBot | New thread by Cmc: Channel.tryRecv fails when send in progress, is this expected behavior?, see https://forum.nim-lang.org/t/7696 |
09:22:56 | PMunch | Hmm, so this PROGMEM thing boils down to codegen having changed slightly for custom types |
09:25:13 | PMunch | If 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:08 | PMunch | But 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:32 | PMunch | This obviously doesn't work as you can't copy data into PROGMEM on runtime. |
09:45:46 | * | dddddd_ joined #nim |
09:47:30 | PMunch | It seems to have changed between 1.4.0 and 1.4.2 |
09:51:47 | FromDiscord | <mratsim> There was a change so that large const are not inlined in each module but use pointers |
09:51:51 | FromDiscord | <mratsim> it might be related |
09:52:15 | PMunch | Definitely sounds like it could be related |
09:56:33 | FromDiscord | <mratsim> I asked for a way to tag const as byaddr but I can't remember where |
09:56:58 | FromDiscord | <mratsim> and what was done was big const are now by addr instead of being inlined |
10:00:40 | PMunch | Hmm, this isn't a const though, you can't use codegenDecl on consts |
10:01:02 | PMunch | I mean that change makes sense though, and it might be related |
10:01:33 | PMunch | But 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:21 | FromDiscord | <mratsim> ah yes, what I mentioned only applied to const |
10:08:05 | PMunch | I'm setting up a git autobisect now |
10:08:20 | PMunch | That 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:58 | PMunch | 99032ca07b39e272519e36d758391063dd659178 |
10:33:03 | PMunch | That's apparently the first bad commit |
10:34:54 | PMunch | If I where to guess it's this that causes the error: https://github.com/nim-lang/Nim/commit/99032ca07b39e272519e36d758391063dd659178#diff-ee922073e19918f7b88397ee2092b6f34c21b0e9983cac3c9a5dae1b32ad2273R214 |
10:39:11 | PMunch | Ding ding ding, that was it |
10:42:05 | FromDiscord | <mratsim> It is indeed related to the `dontInlineConstant` change π |
10:42:16 | PMunch | Yup, you where right :) |
10:43:37 | Clonkk[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:32 | FromDiscord | <mratsim> I thought it was type cdouble = float64? |
10:52:11 | FromDiscord | <mratsim> just wrap your C code with proc foo(a: ptr UncheckedArray[float64]) instead of proc foo(a: ptr UncheckedArray[cdouble]) |
10:52:31 | FromDiscord | <mratsim> c2nim has facilities to change the type generated |
10:52:54 | Clonkk[m] | <FromDiscord "<mratsim> I thought it was type "> Yup, my type mismatch was elsewhere |
10:55:20 | PMunch | Hmm, 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:47 | PMunch | Created an issue for this: https://github.com/nim-lang/Nim/issues/17497 |
11:14:24 | FromDiscord | <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:43 | PMunch | Yeah I found it through the issue text |
11:18:56 | PMunch | Added a `if result: writeStackTrace()` to the `dontInlineConstant` procedure and this is what it spat out http://ix.io/2TWp |
11:23:55 | FromDiscord | <exelotl> oh, it's very cool that this const stuff is being worked on |
11:24:10 | PMunch | What do you mean? |
11:24:51 | FromDiscord | <exelotl> like, just seeing that there are RFCs/PRs for addressable consts from this year |
11:25:53 | PMunch | I mean that is apparently already a thing since 1.4.2 |
11:26:11 | PMunch | Well not directly addressable, but at least not copied |
11:27:58 | PMunch | Hmm, this applies to vars as well |
11:29:18 | * | letto quit (Read error: Connection reset by peer) |
11:30:30 | FromDiscord | <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:24 | PMunch | It works fine for a constant array of integers, but not if you have that declared as a certain type |
11:32:11 | FromDiscord | <exelotl> ah I see |
11:33:43 | FromDiscord | <mratsim> you should add your need for addressable const |
11:33:51 | FromDiscord | <mratsim> my need was avoiding duplicating code |
11:34:04 | FromDiscord | <mratsim> but the const with an address is not solved either. |
11:34:14 | FromDiscord | <mratsim> I use `let` for that. |
11:34:41 | FromDiscord | <mratsim> but it's annoying because that means Nim considers there is a sideeffect in accessing it. |
11:38:23 | PMunch | Hmm, 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:03 | FromDiscord | <exelotl> oh wait I mistyped earlier |
11:43:23 | PMunch | Why can't I do this by the way? https://play.nim-lang.org/#ix=2TWr |
11:43:27 | FromDiscord | <exelotl> I meant I use {.emit.} and/or {.importc.} |
11:44:23 | PMunch | Yeah, that's one way of doing it. It's a bit hacky though.. |
11:45:30 | PMunch | Zevv 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:50 | FromDiscord | <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:19 | FromDiscord | <exelotl> @mratsim my use case actually hasn't changed since a year ago haha |
11:48:31 | FromDiscord | <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:02 | FromDiscord | <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:39 | JustASlacker | hello people of #nim |
12:48:38 | JustASlacker | Ive have a small script where I use walkdir to get all files https://nim-lang.org/docs/os.html#walkDirRec.i,string |
12:49:17 | JustASlacker | that works fine except when I dont have permissions to read dir content |
12:49:31 | JustASlacker | then it just returns an empty list |
12:50:12 | JustASlacker | so I tried to find out the dir permissions via https://nim-lang.org/docs/os.html#getFilePermissions%2Cstring |
12:50:47 | JustASlacker | But I dont see an easy way to check if Im allowed or not. |
12:51:08 | JustASlacker | so right now, I just try to enter the dir with SetCurrentDir and handle the excepton |
12:51:12 | JustASlacker | but that looks bad |
12:51:19 | JustASlacker | any other ideas? |
12:58:20 | Amun_Ra | posix.opendir? |
13:07:48 | JustASlacker | hmm, interesting |
13:13:45 | FromDiscord | <Rika> i dont understand the issue |
13:13:55 | FromDiscord | <Rika> if you cant read the dir, what is the expected outcome |
13:14:31 | PMunch | @Rika, I think he wants to return an error instead of just saying that the dir is empty |
13:14:59 | FromDiscord | <Rika> i see |
13:15:09 | FromDiscord | <Rika> wasnt clear |
13:16:03 | FromDiscord | <Rika> well then whats wrong with getFilePermissions? |
13:16:47 | JustASlacker | well, you get something like this back |
13:17:00 | PMunch | Well it will return fpUserRead for example when a folder is owned by root and is only readable by root |
13:17:25 | FromDiscord | <Rika> ah so you need the owner as well |
13:17:31 | PMunch | So you need to get the owner as well, and the group of the file, and the groups your in |
13:17:32 | JustASlacker | Yes |
13:17:35 | JustASlacker | excatly |
13:17:41 | PMunch | And your username/id |
13:18:06 | JustASlacker | lots of stuff, and I couldt find a way to get owner with the stuff in os |
13:18:49 | JustASlacker | well, my use case is that I check all the certificates inside the dir |
13:19:09 | JustASlacker | I need that to fail when I cant read those certs |
13:20:33 | JustASlacker | https://pastebin.com/1g7cv2wp |
13:32:18 | PMunch | This should work: https://play.nim-lang.org/#ix=2TWM |
13:33:58 | FromDiscord | <Yardanico> From #gamedev - is this a feature? |
13:34:03 | FromDiscord | <Yardanico> this compiles just fine |
13:34:08 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TWO |
13:35:11 | JustASlacker | Yardanico, thx <3 |
13:35:17 | FromDiscord | <Yardanico> ? |
13:35:24 | FromDiscord | <Yardanico> you meant to say PMunch :P |
13:35:47 | JustASlacker | oh, right |
13:35:58 | JustASlacker | thx PMunch <3 |
13:44:53 | PMunch | No problem |
13:45:13 | PMunch | I guess this isn't in the os module simply because Windows doesn't have the same concept of file permissions |
13:45:49 | PMunch | But 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:25 | PMunch | And then you just pass it a set of read/write/exec depending on what you want to do |
13:47:13 | FromDiscord | <Araq> custom numeric literals arrived, https://github.com/nim-lang/Nim/pull/17489 |
13:47:53 | * | SunDwarf is now known as Lura |
13:48:23 | FromDiscord | <Araq> many thanks to JohnAD! He did most of the work |
13:49:37 | PMunch | Oh cool |
13:51:55 | * | fputs quit (Quit: WeeChat 3.1) |
13:52:21 | * | fputs joined #nim |
13:54:31 | PMunch | Hmm, what is the logic for `choosenim update devel`? It still pulls 8ccde68f132be4dba330eb6ec50f4679e564efac for me.. |
13:54:54 | Clonkk[m] | Maybe choosenim update self before ? |
13:55:00 | Oddmonger | template cannot emits code, can it ? Β« template P(p:proc) = proc p() Β» won't generate Β« proc p() Β» ? |
13:55:09 | PMunch | Nah, it takes the latest nightly |
13:55:17 | PMunch | --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:37 | FromDiscord | <Yardanico> yes |
13:56:06 | FromDiscord | <Yardanico> @Oddmonger it can do what you want, but only in some cases |
13:56:27 | PMunch | @Araq, did you see the issue from earlier with the codegen creating a nimCopyMem for static globals? |
13:56:33 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/oS9 |
13:57:40 | PMunch | I guess that would actually even double the initial memory consumption of things with lots of globals.. |
13:57:44 | Oddmonger | thank you Yardanico, the idea is to speed up prototyping |
13:58:43 | FromDiscord | <exelotl> In reply to @Araq "custom numeric literals arrived,": aaaaah epic |
13:59:46 | FromDiscord | <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:00 | FromDiscord | <mratsim> and 2'big |
14:01:04 | FromDiscord | <mratsim> or 2'u256 |
14:02:14 | Oddmonger | Yardanico : i can prototype with that: https://play.nim-lang.org/#ix=2TWZ |
14:02:21 | FromDiscord | <Yardanico> lol |
14:02:32 | PMunch | Oh damn, didn't even consider fixed point, this is perfect for that! |
14:02:35 | FromDiscord | <Yardanico> just use editor snippets :P |
14:02:47 | Oddmonger | but that's not a big deal compared to writting full proto |
14:02:53 | PMunch | And it even takes arguments! |
14:03:20 | PMunch | Totally breaks my code highlighter though :P |
14:04:43 | FromDiscord | <Araq> related: finally `-128'i8` works |
14:05:06 | JustASlacker | PMunch, whats up with that static and staticExec in your playground code |
14:05:29 | FromDiscord | <Yardanico> @PMunch yeah need to fix that |
14:05:33 | FromDiscord | <Yardanico> github highlighting breaks too |
14:05:53 | * | Cadey quit (Quit: WeeChat 3.0) |
14:05:54 | PMunch | @JustASlacker, oh that was just to find some folders with the correct file permissions to show it working |
14:06:05 | PMunch | If you switch to compilation output you can see what it does |
14:06:06 | * | Xe joined #nim |
14:06:30 | PMunch | @Yardanico, GitHub highlighting will probably take longer to fix :P |
14:06:37 | FromDiscord | <Yardanico> not exactly, they use NimLime |
14:06:43 | PMunch | I'm not even sure which highlighter I'm using |
14:06:45 | PMunch | Oh really? |
14:06:46 | PMunch | Cool |
14:07:22 | FromDiscord | <Yardanico> https://github.com/github/linguist/blob/master/vendor/licenses/git_submodule/NimLime.dep.yml |
14:07:40 | FromDiscord | <Yardanico> yeah they need textmate grammar definitions so NimLime has been used since a long time ago |
14:07:52 | FromDiscord | <Yardanico> so we need to fix it in https://github.com/Varriount/NimLime |
14:08:10 | FromDiscord | <Yardanico> (and then update the commit in the github repo) |
14:11:42 | FromDiscord | <Yardanico> the relevant parts are starting with https://github.com/Varriount/NimLime/blob/master/Syntaxes/Nim.tmLanguage#L277 |
14:13:19 | FromDiscord | <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:38 | FromDiscord | <Yardanico> except doing some external work by capturing necessary code from the source files |
14:14:32 | FromDiscord | <Rika> Wow nice feature |
14:16:19 | FromDiscord | <Yardanico> there are some good news from the jetbrains plugin btw |
14:16:45 | FromDiscord | <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:47 | FromDiscord | <Yardanico> https://youtrack.jetbrains.com/issue/NIM-3 |
14:17:25 | FromDiscord | <Yardanico> MCS autocompletion is still in plans though - https://youtrack.jetbrains.com/issue/NIM-33 |
14:18:28 | PMunch | @Yardanico, that is true. No way to get the original text, unless you do some silly hacks |
14:18:37 | FromDiscord | <Yardanico> yeah, just wanted to confirm :) |
14:18:42 | FromDiscord | <Yardanico> guess I'll be doing one of these silly hacks :P |
14:18:48 | FromDiscord | <Yardanico> for https://github.com/pietroppeter/nimib |
14:19:18 | FromDiscord | <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:36 | FromDiscord | <Araq> use nimpretty as a library, maybe |
14:21:10 | FromDiscord | <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:22 | PMunch | I 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:31 | PMunch | Don't remember what I was using it for though |
14:23:21 | FromDiscord | <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:10 | FromDiscord | <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:50 | FromDiscord | <Araq> the double minus is supposed to be a Gedankenstrich |
14:29:16 | FromDiscord | <Araq> good point, it's ambiguous |
14:29:43 | FromDiscord | <Gary M> Hey this is pretty cool, I might use that to make a simd scalar literal |
14:29:49 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/824288900007591953/unknown.png |
14:30:06 | FromDiscord | <Yardanico> <https://github.com/nim-lang/Nim/commit/86af2f7b5057e2def4e07d680da7e4fd947bd2bd#diff-675b48280a134981d14c223555aead03f97d9ae557ecc322b9c2865babbd2281R355> |
14:32:22 | FromDiscord | <Yardanico> @Araq the point was that `isPositive` is true even in the `-` if branch |
14:32:25 | FromDiscord | <Yardanico> so it's never false |
14:32:41 | FromDiscord | <Araq> ah |
14:33:00 | FromDiscord | <Araq> well you'll fix my mistakes, I'm sure |
14:33:56 | FromDiscord | <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:06 | FromDiscord | <Gary M> I'm having an issue of a `distinct` type I've defined saying `object constructor needs an object type` |
15:00:19 | FromDiscord | <Gary M> the type is a distinct `object` |
15:02:18 | FromDiscord | <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:22 | FromDiscord | <mratsim> what's your instantiation line? |
15:02:26 | FromDiscord | <Yardanico> you can convert, not cast |
15:02:34 | FromDiscord | <Yardanico> but yeah, code would be interesting |
15:02:51 | FromDiscord | <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:02 | FromDiscord | <Gary M> it's messy π |
15:03:25 | FromDiscord | <Yardanico> not sure what's the issue? |
15:03:42 | FromDiscord | <Gary M> well I was doing Vec3(v: ...) |
15:03:47 | FromDiscord | <Gary M> it doesn't work that way |
15:04:03 | FromDiscord | <Gary M> it only works if it is not distinct |
15:04:30 | FromDiscord | <Yardanico> yeah it won't work, but why do you need a distinct object? |
15:04:48 | FromDiscord | <Yardanico> see https://github.com/nim-lang/Nim/issues/6248 |
15:05:33 | FromDiscord | <Gary M> because I'm using a Vec2, Vec3, and Vec4 that share the exact same internal structure |
15:05:42 | FromDiscord | <Gary M> of a Union type, so it can't be inherited |
15:06:40 | * | waleee-cl joined #nim |
15:07:48 | FromDiscord | <Yardanico> then yeah, you need to use conversions (they're not casts!) |
15:07:50 | FromDiscord | <Gary M> and I don't want them to be implicitly converted by sharing the same type |
15:07:58 | FromDiscord | <Yardanico> they won't incur a runtime cost anyway |
15:08:12 | FromDiscord | <Yardanico> uint(8) is a conversion while cast[uint8](8) is a cast |
15:08:16 | FromDiscord | <Gary M> but now I'm having the issue that the fields on the original object aren't being seen π¦ |
15:08:21 | FromDiscord | <Yardanico> yes, obviously |
15:08:33 | FromDiscord | <Gary M> okay I'm using conversions not casting |
15:08:33 | FromDiscord | <Rika> you have to borrow those |
15:08:41 | FromDiscord | <Gary M> how do I borrow? |
15:08:57 | FromDiscord | <Rika> {.borrow: `.`.} i forget where to put it |
15:09:03 | FromDiscord | <Rika> i think after the typ[e name |
15:09:04 | FromDiscord | <Rika> yeah |
15:09:12 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TXm |
15:09:47 | FromDiscord | <Gary M> Thanks, everything works. |
15:11:29 | FromDiscord | <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:15 | FromDiscord | <Cerda> Hey, guys is there are resources to learn Nim language? |
15:16:31 | FromDiscord | <Yardanico> There are plenty to choose from in https://nim-lang.org/learn.html |
15:16:32 | FromDiscord | <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:12 | FromDiscord | <jfmonty2> (additional entries elided for clarity) |
15:59:16 | FromDiscord | <jfmonty2> sent a code paste, see https://play.nim-lang.org/#ix=2TXw |
16:00:14 | FromDiscord | <jfmonty2> How is there a type mismatch at position 0? It's the exact type it's asking for |
16:01:15 | FromDiscord | <jfmonty2> (edit) "It's" => "The third one is" |
16:04:17 | saem | Daaaaaayum custom numeric literals. :) |
16:04:39 | saem | Yardanico: you thinking about syntax highlighting? |
16:05:18 | leorize | @jfmonty2 can you post the beginning of the message? |
16:06:04 | FromDiscord | <jfmonty2> sent a code paste, see https://paste.rs/KJv |
16:06:36 | saem | NimLime uses a textmate grammar, excellent. I wonder if their grammar is good. π€ |
16:06:38 | FromDiscord | <jfmonty2> Before that it's just the usual compiler stuff about which config files it's using |
16:07:07 | leorize | can you try manually converting the `int` to `Natural`? |
16:07:23 | leorize | saem: their grammar powers Github's highlighter |
16:08:19 | saem | leorize: that one seems good but I haven't worked with it extensively. |
16:08:29 | FromDiscord | <jfmonty2> I tried converting to `Natural`, yeah, but it didn't help |
16:08:39 | * | PMunch quit (Quit: leaving) |
16:09:07 | FromDiscord | <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:09 | saem | I'm asking because I can just throw it into the extension after converting it to json. |
16:09:12 | leorize | @jfmonty2 try adding generic parameters to your `FixedSeq`'s `[]` definition |
16:09:53 | leorize | if it works then I guess you found yet-another-generic-bug |
16:10:32 | saem | Also means I'll be consistent with NimLime and GitHub. Which has some mild consistency benefits. |
16:10:58 | leorize | saem: not sure if their `1'i32` is fixed yet |
16:11:21 | FromDiscord | <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:27 | FromDiscord | <jfmonty2> er, whoops |
16:11:29 | FromDiscord | <jfmonty2> wrong tag, sorry |
16:11:42 | FromDiscord | <jfmonty2> (edit) removed "@alex.boisvert" |
16:12:07 | leorize | you should file an issue on github |
16:12:29 | leorize | generics matching being weird is nothing too new unfortunately... |
16:12:44 | FromDiscord | <jfmonty2> Ok, will do. Thanks! |
16:16:18 | * | vicfred quit (Quit: Leaving) |
16:16:47 | saem | I'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:38 | leorize | looking forward to the day you fix generics + distinct issues |
16:18:13 | FromDiscord | <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:41 | leorize | still a bug |
16:18:56 | * | vicfred joined #nim |
16:19:03 | leorize | `var` should not suddenly make generics matching go wild |
16:19:27 | FromDiscord | <Gary M> "generics gone wild" |
16:19:38 | FromDiscord | <jfmonty2> Rule 34 |
16:19:57 | FromDiscord | <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:26 | leorize | @saem do you know what is this new `CUSTOM_NUMERIC_SUFFIX`? |
16:21:13 | leorize | I 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:10 | FromDiscord | <hamidb80> i think i found a bug by mistake |
16:27:12 | FromDiscord | <hamidb80> https://play.nim-lang.org/#ix=2TXG |
16:27:17 | FromDiscord | <hamidb80> can anyone check this? |
16:30:05 | leorize | looks like a serious type checking bug |
16:30:19 | FromDiscord | <hamidb80> should I open an issue? |
16:30:43 | leorize | yea, please do |
16:38:25 | FromDiscord | <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:10 | saem | leorize: 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:17 | leorize | saem: 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:08 | FromDiscord | <sealmove> are converters always implicit? |
17:57:38 | FromDiscord | <sealmove> if there a way to configure this? for example define a converter but disallow implicit convertions |
17:58:29 | leorize[m] | make a proc? |
17:58:44 | FromDiscord | <sealmove> but the proc can't have the same name as the type |
17:58:57 | FromDiscord | <sealmove> or can it? |
17:59:46 | leorize[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:45 | FromDiscord | <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:54 | FromDiscord | <hamidb80> !eval var a = @[]; a.add [1,2,3]; echo a |
18:57:55 | NimBot | Compile failed: /usercode/in.nim(1, 9) Error: cannot infer the type of the sequence |
18:58:26 | FromDiscord | <hamidb80> !eval var a = @[0]; a.add [1,2,3]; echo a |
18:58:28 | NimBot | @[0, 1, 2, 3] |
19:28:44 | * | superbia quit (Quit: WeeChat 3.1) |
19:47:28 | FromDiscord | <zajrik> sent a code paste, see https://play.nim-lang.org/#ix=2TYN |
19:47:45 | FromDiscord | <zajrik> (edit) "https://play.nim-lang.org/#ix=2TYN" => "https://play.nim-lang.org/#ix=2TYO" |
19:49:27 | FromDiscord | <zidsal> I know optionutils supports that https://nimble.directory/docs/optionsutils//optionsutils.html |
19:52:59 | FromDiscord | <zidsal> My bad I need to read the full sentence. I missed the part about pattern matching |
19:53:17 | FromDiscord | <zajrik> No worries :o) |
19:53:42 | FromDiscord | <zajrik> I added the specific words "pattern matching" for clarity after you had sent it |
19:53:58 | FromDiscord | <zidsal> Ah, clearly I have been cleared of all charges! |
19:54:07 | FromDiscord | <zajrik> Indeed |
19:55:52 | FromDiscord | <haxscramper> In reply to @zajrik "<@608382355454951435> is there a": https://play.nim-lang.org/#ix=2TYR |
19:56:01 | FromDiscord | <haxscramper> `opt @capture or <default-expr>` |
19:56:05 | FromDiscord | <haxscramper> But it is not documented yes |
19:56:10 | FromDiscord | <haxscramper> I just forgot about it |
19:56:35 | FromDiscord | <zajrik> I saw that for sequence matching but not in other structures |
19:56:42 | FromDiscord | <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:17 | FromDiscord | <haxscramper> sent a code paste, see https://paste.rs/yQZ |
19:57:47 | FromDiscord | <haxscramper> well, yes, it applies to any patch |
19:57:56 | FromDiscord | <haxscramper> Though I'm not sure how it would work with option types |
19:58:14 | FromDiscord | <zajrik> Okay, so doing it like that captures the Option and not the value, yes? |
19:59:03 | FromDiscord | <haxscramper> Not sure if I understand the question. `or <default-expr>` makes capture have a value of `<default-expr>` |
19:59:10 | FromDiscord | <haxscramper> If capture itself failed |
19:59:12 | FromDiscord | <zajrik> Oh, hmm |
19:59:38 | FromDiscord | <haxscramper> well, it is not very well described, wait for a second I will tell you full semantics |
19:59:44 | FromDiscord | <zajrik> One sec, lemme get on discord on pc so I can paste code here |
20:01:43 | FromDiscord | <zajrik> sent a code paste, see https://play.nim-lang.org/#ix=2TYZ |
20:01:52 | FromDiscord | <zajrik> Compiler is telling me `c` is `Option[string]` |
20:03:08 | FromDiscord | <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:59 | FromDiscord | <haxscramper> Can you show the definition of `SettingsComponent`? |
20:04:26 | FromDiscord | <zajrik> sent a code paste, see https://play.nim-lang.org/#ix=2TZ1 |
20:04:50 | FromDiscord | <zajrik> For reference, all settings that are `Option[string]` are `None` when the settings value would be `""` |
20:07:10 | FromDiscord | <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:50 | FromDiscord | <haxscramper> The man problem in `Some(@capture or <default>)` is that it breaks logic |
20:08:11 | FromDiscord | <haxscramper> Because outer part of the pattern kind of fails match, but it still succedes |
20:08:39 | FromDiscord | <haxscramper> But If I add `Some() or "default"` it would look like I'm defaulting `Some()`, not capture, which is also weird |
20:08:39 | FromDiscord | <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:01 | FromDiscord | <zajrik> I think `Some(@capture or "")` looks great |
20:09:13 | FromDiscord | <zajrik> (edit) """)`" => ""default")`" |
20:09:38 | * | lritter quit (Ping timeout: 264 seconds) |
20:09:52 | FromDiscord | <haxscramper> It is not a problem of implementation |
20:10:07 | FromDiscord | <haxscramper> But maybe `Some(@capture or "default")` is intuitive enough |
20:10:42 | FromDiscord | <zajrik> I agree, it definitely seems intuitive enough to me |
20:10:54 | FromDiscord | <zajrik> It's very clear what it accomplishes |
20:11:46 | FromDiscord | <haxscramper> But what about `Some((field: @capture or "default"))`? |
20:11:59 | FromDiscord | <haxscramper> Or any other pattern involving `Some()` that has `or` clause |
20:12:14 | FromDiscord | <zajrik> oh, hmm |
20:12:53 | FromDiscord | <zajrik> Okay now I'm seeing the ambiguity |
20:12:55 | FromDiscord | <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:42 | FromDiscord | <haxscramper> So last time I just left unimplemented because I couldn't find good enough solution that wouldn't be ambiguous |
20:15:13 | FromDiscord | <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:49 | FromDiscord | <haxscramper> "no value" means `None()` or `nil` maybe? I.e. things that can be clearly considered "no value" |
20:16:17 | FromDiscord | <zajrik> and `or` would then offer the ability to provide defaults for "no value" |
20:16:22 | FromDiscord | <haxscramper> yes |
20:16:25 | FromDiscord | <zajrik> (edit) "and `or` would then offer the ability to provide defaults for ... "nooccurrence" added "any" | "any"no value" ... " added "occurrence" |
20:16:37 | FromDiscord | <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:44 | FromDiscord | <zajrik> Seems reasonable to me |
20:18:36 | FromDiscord | <haxscramper> And `opt` for fields can be implemented by calling `optGetOrDefault` proc (overload it for `Option` and `ptr | ref` values) |
20:21:05 | FromDiscord | <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:12 | FromDiscord | <zajrik> That would work for the time being, right? |
20:22:40 | FromDiscord | <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:19 | FromDiscord | <haxscramper> `(proc:` only supports zero-argument functions |
20:23:24 | FromDiscord | <zajrik> Nah, I was just thinking of writing one specifically for `Option[string]` that returns `""` if it's `None` |
20:23:41 | FromDiscord | <haxscramper> yes, that should work |
20:24:14 | FromDiscord | <zajrik> sent a code paste, see https://play.nim-lang.org/#ix=2TZ6 |
20:24:55 | FromDiscord | <zajrik> Thanks for all your insight! |
20:25:53 | FromDiscord | <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:42 | FromDiscord | <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:59 | FromDiscord | <zajrik> Nice |
20:28:14 | FromDiscord | <zajrik> oh wait, I can just `self.get("")` for that proc |
20:28:16 | FromDiscord | <zajrik> :drakeLUL: |
20:28:21 | * | narimiran quit (Ping timeout: 258 seconds) |
20:31:59 | FromDiscord | <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:16 | FromGitter | <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:35 | PMunch | I'm writing a response to that as we speak .) |
21:35:44 | FromGitter | <mantielero> Brilliant mate |
21:36:08 | FromGitter | <mantielero> I think is related to big-endian, but I am not able to make it work |
21:36:21 | PMunch | There |
21:37:02 | PMunch | Definitely related to endianness, but I also find a bug in binaryparse |
21:37:06 | PMunch | s/find/found |
21:38:06 | FromGitter | <mantielero> Great |
21:38:45 | FromGitter | <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:30 | PMunch | Good to hear, that was the goal of binaryparse :) |
21:40:05 | FromGitter | <mantielero> I wonder if it would make sense using https://github.com/johnnovak/nim-binstreams in order to handle better the endian |
21:40:55 | PMunch | Oh 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:41 | PMunch | Okay, 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:57 | PMunch | At least the part that writes integers |
21:55:12 | PMunch | I'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:49 | FromDiscord | <zetashift> What is the recommended neovim plugin for Nim? |
23:04:07 | * | PMunch quit (Quit: leaving) |
23:07:50 | FromDiscord | <ElegantBeef> isnt it nim.nvim |
23:08:12 | FromDiscord | <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:34 | FromDiscord | <sealmove> when you forward declare a proc, where should you put the exportation mark? |
23:33:52 | FromDiscord | <sealmove> to the forward decl or the definition |
23:34:04 | FromDiscord | <ElegantBeef> i'd say both |
23:34:50 | FromDiscord | <ElegantBeef> Forward declarations have some odd logic currently π |
23:35:49 | * | vicfred joined #nim |
23:43:51 | * | vicfred quit (Quit: Leaving) |