<< 09-01-2022 >>

00:15:49FromDiscord<Elegantbeef> Does anyone know if it's possible to have the `static` scope run as if it was running inside a `nim e` instead of for the OS you're compiling for?
00:41:38*dithpri quit (Quit: '); DROP TABLE Users;--)
00:59:11*Figworm joined #nim
01:17:13*cyraxjoe joined #nim
01:17:25*algae quit (Ping timeout: 240 seconds)
01:17:40FromDiscord<demotomohiro> I don't know how to do it but this code do similar thing↵`const foo = staticExec("nim e mycode.nim")`
01:23:16FromDiscord<Patitotective> Can I get the nim filename in this command? I want to add an extension to the output files https://media.discordapp.net/attachments/371759389889003532/929545829147107388/unknown.png
01:24:11FromDiscord<Patitotective> Like
01:24:47FromDiscord<Patitotective> (edit) "Like" => "sent a code paste, see https://play.nim-lang.org/#ix=3LzA"
01:25:46*Figworm quit (Quit: Figworm)
01:29:34FromDiscord<impbox [ftsf]> In reply to @Patitotective "Can I get the": using config.nims you can
01:30:21FromDiscord<Patitotective> how?
01:30:22*MightyJoe joined #nim
01:30:26FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3LzC
01:30:50FromDiscord<impbox [ftsf]> -o is optional, so i default to using the projectName
01:31:17*cyraxjoe quit (Ping timeout: 240 seconds)
01:33:09FromDiscord<Patitotective> hmm
01:33:15FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LzD
01:33:27FromDiscord<impbox [ftsf]> ahh import std/compilesettings
01:33:42FromDiscord<impbox [ftsf]> https://nim-lang.org/docs/compilesettings.html
01:35:52*MightyJoe quit (Quit: I'm out!)
01:37:31*cyraxjoe joined #nim
01:40:22FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LzE
01:43:33FromDiscord<Patitotective> yea, it works if i do tht
01:43:35FromDiscord<Patitotective> (edit) "tht" => "that"
01:59:54*algae joined #nim
02:03:47*bkay joined #nim
02:04:23*beshr quit (Ping timeout: 256 seconds)
02:05:07*noeontheend joined #nim
02:29:38*neurocyte09172 joined #nim
02:31:25*neurocyte0917 quit (Ping timeout: 240 seconds)
02:31:25*neurocyte09172 is now known as neurocyte0917
03:26:13FromDiscord<gogolxdong (liuxiaodong)> Does anyone know Brave Browser?
03:31:48FromDiscord<Rika> Yes, why
03:35:38FromDiscord<gogolxdong (liuxiaodong)> Just curious and want to say it's a good production , I'm migrating from chrome to brave across the board.
03:36:51FromDiscord<Rika> I personally dislike the company
03:37:06FromDiscord<Rika> I would really just recommend Firefox over anything…
03:37:07FromDiscord<gogolxdong (liuxiaodong)> We'd like to make a similiar one but support IPFS natively especially on mobile phone.
03:37:10FromDiscord<Elegantbeef> I like the many issues they have
03:37:18FromDiscord<Rika> In reply to @Elegantbeef "I like the many": What lol
03:37:30FromDiscord<Elegantbeef> "Privacy first browser" which requires phoning home
03:37:53FromDiscord<Rika> Yeah lol
03:38:23FromDiscord<Rika> That weird currency thing they have too
03:38:33FromDiscord<Elegantbeef> https://github.com/brave/brave-browser/issues/19125 is a fun github issue
03:39:11FromDiscord<Elegantbeef> Yea i'm just using firefox
03:41:45FromDiscord<Rika> How fun
03:50:17*sagax quit (Ping timeout: 240 seconds)
03:53:11FromDiscord<gogolxdong (liuxiaodong)> Though our testing of decentralized sharing cases for Brave desktop shows it did good job, there is only public IPFS gateway to open file files/directories on mobile phone which is somewhat slower than native IPFS protocol.
03:57:20*arkurious quit (Quit: Leaving)
04:02:21*anadahz quit (Remote host closed the connection)
04:02:40*anadahz joined #nim
04:09:43FromDiscord<gogolxdong (liuxiaodong)> Most of public gateway are blocked by GFW.
04:12:58*algae quit (Quit: WeeChat 3.4)
04:35:01*noeontheend quit (Ping timeout: 240 seconds)
05:26:15*kayabaNerve_ joined #nim
05:41:38NimEventerNew Nimble package! conventional_semver - Calcualte the next semver version given the git log and previous version, see https://gitlab.com/SimplyZ/conventional_semver
06:16:06FromDiscord<Bung> @PMunch please check this when you feel free https://github.com/PMunch/nimlsp/pull/109
08:58:23*Gustavo6046 quit (Quit: Leaving)
09:14:29*jjido joined #nim
09:59:54NimEventerNew post on r/nim by TheDarkMode: How to use JS to make a front end, see https://reddit.com/r/nim/comments/rzofbm/how_to_use_js_to_make_a_front_end/
10:27:52*lumo_e joined #nim
10:51:54FromDiscord<Isofruit> In reply to @Rika "I would really just": I use firefox on desktop any time of the week.↵Firefox mobile though feels hard-core like an abandoned product with how badly it performs on my (admittedly potato) phone
10:52:07FromDiscord<Rika> Ah mobile yeah
10:52:11FromDiscord<Rika> Pretty eh
10:52:23FromDiscord<Rika> Performance aside even, it just feels dated
10:52:41FromDiscord<Isofruit> If my side-project loads 3 times faster on brave than it does on FF then there are some fundamental engine issues
10:53:07FromDiscord<Rika> Probably
10:54:25FromDiscord<Isofruit> I've been contemplating which Chromium Browser to use on mobile until FF performance rises, so far brave seems alright
10:54:51FromDiscord<Isofruit> Then again, I don't do anything even remotely important on my phone if I can help it, particularly over the browser
10:57:07FromDiscord<Rika> I’m almost always outside the apartment so I use my phone mega heavily
10:57:18FromDiscord<Rika> I have two power banks always in my bag usually charged
11:02:22FromDiscord<Isofruit> Active a lot?↵Yeah not quite the same on my end, since the HO days I'm only on mobile on my way to sports or visiting someone
11:04:00*PMunch joined #nim
11:06:32FromDiscord<Rika> In reply to @Isofruit "Active a lot? Yeah": Yeah
11:06:40FromDiscord<Rika> I don’t really like staying in the house
11:06:54FromDiscord<Rika> You can imagine how COVID was for me when it was still lockdown for me
11:09:05FromDiscord<Isofruit> In reply to @Rika "You can imagine how": Ooooooooff, that must've been really damn rough, my condolences.
11:09:34FromDiscord<Isofruit> What you normally doing? Going for walks/coffee?
11:10:02FromDiscord<Isofruit> Are you the stock foto of a developer sitting on a lawn in a sunny day, back against the tree, enjoying the life? 😄
11:10:26FromDiscord<Rika> A lot of things, cycling around, going to the same malls I usually go to, parks, river sides, literally “throw a dart at the map and let’s see”
11:10:50FromDiscord<Rika> In reply to @Isofruit "Are you the stock": Nah I don’t develop in these places, too depressing to do
11:15:18*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
11:22:31FromDiscord<Rika> Ah, but I do read documentation like a book
11:22:34FromDiscord<Rika> Yes I’m a weirdo
11:23:35FromDiscord<Isofruit> That is legitimately a habit I envy you for, when I try reading docs without already having some level of connection to a given library, my brain doesn't comprehend the words fully. I see them, I get a rough idea, but it's not clicking anywhere
11:28:04FromDiscord<Isofruit> On a more channel related note:↵Is anyone else using prologue? If so, do you guys also have the issue that, when there is an exception and Prologue hands you the exception traceback, you don't see the exception-type ?
11:38:45*krux02 joined #nim
11:49:57PMunch@Isofruit, just wait until I have my eEink laptop up and running. I'll be chilling in the sun programming like a damn maniac!
11:50:32FromDiscord<Isofruit> Too much power!
11:50:47FromDiscord<Isofruit> He will be able to code and charge up with some Vitamin D
11:51:18FromDiscord<Isofruit> The world can not endure somebody developing and being in a healthy environment!
11:54:51PMunchJokes on you, I already drink my Tran so I'm full of vitamin D despite not seeing the sun for half the year!
11:54:53FromDiscord<Isofruit> ...if I have an error, is there a way to see which package/module its defined in so I can import it and use it in a catch statement?
11:55:07FromDiscord<Isofruit> (edit) "error," => "Exception,"
11:55:08PMunchgrep?
11:55:34FromDiscord<Isofruit> curses, the one linux tool I have not yet acclimatized to despite knowing it is useful
11:55:39PMunch:P
11:55:59PMunch`grep -Hnr "MyCoolException" ~/.nimble/pkgs`
11:56:05PMunchThat should show you where it is
11:56:11PMunchOr rather everywhere it is mentioned
11:56:41PMunchI guess you might want to throw on a "MyCoolExcption =" to find the definition
11:56:45FromDiscord<Isofruit> Ahah! "NotFoundError" stems from norm!
11:57:08PMunchSome times the most basic tools will yield you the greatest power
11:58:18FromDiscord<Isofruit> Thanks for the command! I'll... one of these days I'll invest the time to actually learn grep
11:58:46PMunchOnce you get used to it you will wonder how you ever got by without it
11:59:10FromDiscord<congusbongus> rg is pretty cool
11:59:42PMunchBy the way, that command explained is "H: with filenames, n: with line numbers, r: recursive through folder"
12:00:22PMunch@congusbongus, rg?
12:00:30FromDiscord<Rika> Ripgrep
12:08:51FromDiscord<planetis> Hey, is it safe for c code generated by nim to do this\: `int test(int x) { return &x }` ?
12:11:48FromDiscord<federico3> is there a way to show the code generated by templates?
12:13:25FromDiscord<planetis> if not expandmacros then you could get it if you use it wrong and the compiler outputs an error with the expanded code
12:14:47FromDiscord<el__maco> that code doesn't look particularly "safe"
12:16:12FromDiscord<planetis> well ok sure but can it lead to undefined behavior if used incorrectly
12:16:55FromDiscord<el__maco> what would be a correct use of that 🤔
12:17:06FromDiscord<planetis> well its nim compilers job to make sure the code is safe but I am trying to figure if lent return type with .bycopy pragma produce faulty code
12:18:14FromDiscord<el__maco> `x` doesn't exist anymore when the function returns. Using that pointer would be a problem
12:18:36FromDiscord<planetis> ok thank you, thats what i thought as well
12:19:32FromDiscord<el__maco> not sure what compilers do in this situation, since depending on the calling convention `x` might not be anywhere in the memory to begin with
12:19:34FromDiscord<planetis> btw I ran that code with asan and it didn't complain, it confused me...
12:20:21FromDiscord<planetis> i had -fsanitize=address,undefined
12:22:04FromDiscord<Rika> It’s probably some hacky specification that says that it’s valid
12:24:27FromDiscord<planetis> ill report a bug anyway
12:25:25*lumo_e quit (Ping timeout: 240 seconds)
12:27:56FromDiscord<el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3LD2
12:28:37FromDiscord<el__maco> seems like the default calling convention puts arguments on stack then 🤔
12:35:20FromDiscord<Isofruit> Is there a lazy way around defining init procs?
12:35:53FromDiscord<Rika> Third party package
12:36:04FromDiscord<Rika> Beef made it because of course he did
12:36:22FromDiscord<Isofruit> sent a long message, see http://ix.io/3LD5
12:37:15FromDiscord<Isofruit> What's the name?
12:37:19FromDiscord<Isofruit> (edit) "long message," => "code paste," | "http://ix.io/3LD5" => "https://play.nim-lang.org/#ix=3LD7"
12:37:28FromDiscord<Isofruit> (edit) "https://play.nim-lang.org/#ix=3LD7" => "https://play.nim-lang.org/#ix=3LD8"
12:37:49FromDiscord<Rika> Constructor
12:38:10FromDiscord<Isofruit> (edit) "https://play.nim-lang.org/#ix=3LD8" => "https://play.nim-lang.org/#ix=3LD9"
12:38:37FromDiscord<Isofruit> Let me pray silently that he doesn't view Constructor like a child
12:38:41FromDiscord<Isofruit> (edit) "a" => "his own"
12:39:01FromDiscord<Isofruit> (edit) "like" => "as if it were"
12:39:06FromDiscord<Isofruit> There, better expressed
12:41:23FromDiscord<Isofruit> That looks really nice, and saves me writing like 50+ boilerplate constructors
13:08:25FromDiscord<Isofruit> Another question, is there perhaps a way to print the exception's package?↵I'm in an issue with xflywind about the thing with printing an error type. I think it'd be even more helpful to not just log the exception's type as a string, but also the package it comes from for easy importing, saves the user having to grep their nimble repo themselves.
13:08:36FromDiscord<Isofruit> (edit) "print the" => "echo an"
13:27:58*lumo_e joined #nim
13:35:06FromDiscord<xflywind> Sorry, I have no idea. But you can echo the package of specific type at compile time.
13:35:36FromDiscord<krisppurg> Is it weird to have a case statement inside a case statement?
13:36:35*jjido joined #nim
13:36:40FromDiscord<xflywind> In reply to @flywind "Sorry, I have no": https://play.nim-lang.org/#ix=3LDs
13:37:45FromDiscord<xflywind> I don't know a way to detect that at runtime.
13:48:44FromDiscord<Isofruit> Hmm not without making an entire package out of it that makes a map of exceptiontype-package name at compile time and calls that at runtime, which would be shooting with cannons on sparrows
13:56:44FromDiscord<xflywind> I agree
14:13:59FromDiscord<Patitotective> How can I make Nim generates a file with extension on Linux? Like, what's the proper extension? `.so`, `.lib`?
14:22:43FromDiscord<federico3> is there any line profiler that generates charts & similar?
14:24:50FromDiscord<planetis> https://github.com/KDAB/hotspot ?
14:24:54FromDiscord<Rika> In reply to @Patitotective "How can I make": linux binaries do not have extensions
14:26:43FromDiscord<Patitotective> But it says it is a shared library, and shared libraries do have extensions (i think)
14:28:57*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
14:30:41FromDiscord<Rika> .so
14:30:48FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LDN
14:30:54FromDiscord<Rika> yes
14:32:13*lumo_e quit (Ping timeout: 240 seconds)
14:55:22*lumo_e joined #nim
14:56:26*arkurious joined #nim
14:59:22*SebastianM joined #nim
14:59:28FromDiscord<federico3> thanks [planetis](https://matrix.to/#/@planetis:matrix.org)
15:03:43SebastianMGuys, I found that the latest build of nim in nightlies repo is from December 14. Whats going on?
15:05:49FromDiscord<federico3> [planetis](https://matrix.to/#/@planetis:matrix.org)\: do you use perf with it? Any way to add descriptive proc names to the output?
15:06:46FromDiscord<leorize> `--call-graph dwarf`
15:07:21FromDiscord<leorize> if hotspot's UI is not your jam, checkout FF profiler too\: https://profiler.firefox.com/docs/#/./guide-perf-profiling
15:09:14*SebastianM quit (Quit: Bye)
15:09:28FromDiscord<planetis> Works with perf, I compile with -g at the end. The names are mangled but I generally don't mind. Only problem are [] procs which I need to find out which one is which at the C file.
15:13:25FromDiscord<federico3> any way to do line profiling?
15:17:29FromDiscord<Saptak> what is the difference between ``div`` and ``/``
15:20:39FromDiscord<Rosen> div is integer division
15:27:58PMunchSebastianM, hmm that is a bit peculiar
15:29:41FromDiscord<Saptak> In reply to @Rosen "div is integer division": what's the diffrence
15:31:07FromDiscord<Rosen> https://media.discordapp.net/attachments/371759389889003532/929759198563143700/unknown.png
15:31:23FromDiscord<Rosen> div outputs the integer division result while / will give you a float result
15:32:39FromDiscord<Saptak> Oo
15:39:11FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LEe
15:41:44FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LEg
15:51:33FromDiscord<Patitotective> it worked that way LOL↵im super smart or nim's super intuitive
16:00:48FromDiscord<Rika> why not both
16:50:52FromDiscord<leorize> it's due to github sorting, check these tags instead\: https://github.com/nim-lang/nightlies/releases?q=latest&expanded=true↵(<@709044657232936960_=53ebastian=4d=5b=49=52=43=5d>)
17:09:18FromDiscord<exelotl> I'm I'm doing a PR to fix a bug introduced in Nim 1.6, do I need to include [backport:1.6] ?
17:09:24FromDiscord<exelotl> (edit) "I'm" => "if"
17:09:47FromDiscord<Elegantbeef> Nah
17:11:57FromDiscord<exelotl> even though it's a PR into devel and the current "in progress" changelog says 1.8.x ?
17:13:47FromDiscord<Elegantbeef> Yes, you can ask for it to be backported
17:16:51FromDiscord<xflywind> In reply to @exelotl "if I'm doing a": it is recommended to do so.
17:17:41FromDiscord<xflywind> https://nim-lang.github.io/Nim/contributing.html#the-cmdgit-stuff-general-commit-rules
17:18:52FromDiscord<exelotl> so I say [backport:1.6] and add an entry to the 1.8 changelog, and somebody will correctly move it into the 1.6.4 changelog when the time comes?
17:19:20FromDiscord<xflywind> true
17:20:14FromDiscord<xflywind> that's what has been happening
17:20:52FromDiscord<exelotl> ok, thanks!
17:23:07FromDiscord<xflywind> the changelog will appear on tge release artcile: https://nim-lang.org/blog/2021/12/17/version-162-released.html
17:23:10FromDiscord<xflywind> you are welcome
17:23:23FromDiscord<Patitotective> Should I export a std library or should I re-import it? (Like from the submodule to the main module of a nimble package)
17:23:36FromDiscord<Elegantbeef> Purely up to you
17:24:05FromDiscord<Patitotective> But it doesn't affect efficiency, right?
17:24:22FromDiscord<Elegantbeef> It does not
17:26:30FromDiscord<Elegantbeef> The module should be typed once then reused, and code generated is non duplicated, so it should be good all round
17:28:43*qwr quit (Read error: Connection reset by peer)
18:03:54nrds<Wabby/freenode99> Is there a reason why issues are rarely labeled on the Nim repository?
18:21:03FromDiscord<Patitotective> sent a code paste, see https://paste.rs/zL5
18:21:42FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=3LF8" => "https://play.nim-lang.org/#ix=3LF7"
18:24:24FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LF9
18:24:49FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=3LF9" => "https://play.nim-lang.org/#ix=3LFa"
18:24:55FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=3LFa" => "https://play.nim-lang.org/#ix=3LFb"
18:25:18FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=3LFb" => "https://paste.rs/DC6"
18:26:39FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LFe
18:31:21FromDiscord<Elegantbeef> `newCall(ident"PTable", ident"()", ident"as", ident"PTableTypes")` is just wrong in all regards
18:31:34FromDiscord<Elegantbeef> What is the code you want to generate written out as?
18:32:25FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LFh
18:32:32FromDiscord<Patitotective> But those parenthesis doesn't seem to work in `newCall`
18:32:41FromDiscord<Elegantbeef> So then `nnkObjectConstr.newTree(ident"Ptable")`
18:32:42FromDiscord<Elegantbeef> Well of course not that's not a call
18:33:06FromDiscord<Patitotective> In reply to @Elegantbeef "`newCall(ident"PTable", ident"()", ident"as", ident": Yea, I'm not sure where to read about those procedures, docs doesn't seem to help
18:33:19FromDiscord<Patitotective> In reply to @Elegantbeef "So then `nnkObjectConstr.newTree(ident"Ptable")`": I'll try it later, thanks, I gtg
18:33:49FromDiscord<Elegantbeef> https://dev.to/beef331/demystification-of-macros-in-nim-13n8
18:33:50FromDiscord<Elegantbeef> Read what i linked when you have time
18:33:52FromDiscord<Elegantbeef> It'll give you a basis on how to write macros
18:49:50FromDiscord<Professor Actual Factual> How does one create a memory aligned seq in nim like cpp `_mm_malloc`?
18:56:44FromDiscord<ynfle (ynfle)> @Patitotective Try using `macros.dumpTree` to see the ast (which is basically what it says in the article beef linked/wrote)
19:15:01*bkay quit (Ping timeout: 240 seconds)
19:26:22*jjido joined #nim
19:41:17FromDiscord<auxym> Anyone know if c2nim is supposed to support stdint types, eg `uint8_t`? It seems to be generating them as `uint8T` in nim, which isn't even valid nim...
19:59:01FromDiscord<Recruit_main707> afaik you can just do `type uint8T = uint8` and it should be fine
20:00:59FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=3LFK
20:01:53FromDiscord<auxym> also c2nim seems to choke on `attribute ((packed))` annotations to struct typedefs
20:02:06PMunch@auxym, have you tried Futhark?
20:03:00FromDiscord<auxym> not yet, I do remember reading about it on the forums... how well does it handle a huge soup of macros? 😛 Trying to make minimal bindings for tinyusb
20:04:48PMunchBetter than any of the alternatives in my testing
20:05:01PMunchIt's the only C wrapper I've managed to wrap huge codebases in
20:05:51PMunchIt doesn't do a great job at exposing macros you're supposed to be able to call yourself though. But it handles all the macros uses internally.
20:08:20FromDiscord<auxym> great! might give it a try!
20:10:50PMunchJust to be clear, I'm also the person who wrote Futhark, so my views of the library are obviously a bit coloured by that
20:11:03PMunchBut just let me know if you need help :)
20:11:20FromDiscord<Elegantbeef> My biggest issue with futhark is it's biggest benefit 😛
20:11:31PMunchWhich is?
20:11:35PMunchThat it requires Clang?
20:11:50FromDiscord<Elegantbeef> No that it doesnt emit `.nim` files
20:11:57PMunchIt does though
20:12:05FromDiscord<Elegantbeef> I thought it didnt
20:12:13PMunchJust in a cache folder, because you're not supposed to ever have to look at them
20:12:23FromDiscord<Elegantbeef> Ah there we go
20:12:27PMunchIt puts them in your nimcache :)
20:12:36PMunchSo you can go have a look at them if you want to
20:12:42FromDiscord<Elegantbeef> So then i might use futhark on things more often
20:12:52PMunchBut you shouldn't have to for what it's worth
20:13:01*Gustavo6046 joined #nim
20:13:15PMunchAt least not once you're comfortable with how it wraps things
20:13:18FromDiscord<Elegantbeef> I prefer concrete definitions and if possible applying the idiomatic nim conventions on the imported procs
20:14:58PMunchWell Futhark is more about just making the C imports transparent
20:15:41FromDiscord<Elegantbeef> Yea i know easiest/fastest way to get the C-api into Nim
20:15:46FromDiscord<Elegantbeef> Not the most idiomatic one
20:15:50PMunchSo you should build your stuff on top to give it better types and stuff. But that should call the underlying C procedures (you can make it zero-cost by using templates) so that if the underlying C code changes or updates you will have type conflicts
20:17:45FromDiscord<Elegantbeef> I know I know, I'm just odd and do not like that way
20:18:15PMunchWhy not?
20:19:06PMunchWhat's better than just having the C types exactly as they appear in the C code and then get proper type mismatch error messages if the underlying code changes?
20:20:26PMunchI had a project that I had wrapped manually because I couldn't get c2nim or nimterop to work on it, even after about a week of trying with both (at work, so 8 hours a day). I wrote Futhark and wrapped it in minutes, and I was shocked(!) by the fact that my manual wrapper still worked because the type definitions had drifted a *lot* more than I had expected
20:27:05PMunchFuthark now keeps my types true to the C library, so if I have a type mismatch I will know. And Nim will generate objects that are actually the right size and fields at the correct offsets
20:27:20PMunchThat's what I'm looking for in a C wrapper, a tool that wraps C
20:27:40PMunchAnd then I can build abstractions on top of the C library
20:33:17FromDiscord<Elegantbeef> I dont really touch C, so that's why i'm so odd here, the most i've touched C is the slow manual wrapping of the pico-sdk
20:33:58FromDiscord<Elegantbeef> I'm just an idiot that doesnt have interest in the tool wrappings since i'll have to idiomatically do it anyway before i'll be happy, but it means a majority of the sdk isnt wrapped since either i havent or someone hasnt asked for it
20:38:15FromDiscord<Michal Maršálek> Hi, why does this not work: https://play.nim-lang.org/#ix=3LH1?
20:38:27FromDiscord<Michal Maršálek> (edit) "https://play.nim-lang.org/#ix=3LH1?" => "https://play.nim-lang.org/#ix=3LH1 ?"
20:39:13PMunch@Elegantbeef, the thing is that with Futhark you can focus on only creating your high level stuff. It's so draining to have a nice idea just to spend an entire evening trying to get c2nim or nimterop to just read your god damn C header file
20:39:52PMunch@Michal_Maršálek, why do you use that `id` thing?
20:42:24FromDiscord<Michal Maršálek> I want to have a template/macro that creates a complex generic type, here I created a simple example in which the template is an identity.
20:44:21FromDiscord<leorize> type expression that uses generics won't work on return type declaration unless you use some tricks
20:45:18FromDiscord<Michal Maršálek> In reply to @leorize "type expression that uses": wdym by on return type? this doesn't work either: https://play.nim-lang.org/#ix=3LH5
20:45:22FromDiscord<Michal Maršálek> What are the tricks
20:47:24FromDiscord<leorize> looks like your problem is different from mine
20:48:14FromDiscord<leorize> the trick is to create a typesection in the return value expression itself that aliases the generic type
20:48:47FromDiscord<leorize> that way any expressions using that will be deterred until the generic is instantiated
20:49:07FromDiscord<leorize> your problem seems to be in the template itself, though
20:49:25FromDiscord<Michal Maršálek> I don't really understand what you are saying
20:49:29*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
20:56:02FromDiscord<leorize> your problem right now is that the id template wants to be instantiated before T is available
20:57:21FromDiscord<Michal Maršálek> but `id` is not a generic?
20:57:30FromDiscord<leorize> it is a generic
20:57:43FromDiscord<leorize> typedesc is not a value type, it's a generic typeclass
20:57:45FromDiscord<Michal Maršálek> I thought it is just a regular compile time function
20:57:55FromDiscord<Michal Maršálek> which operates on types
20:58:28FromDiscord<leorize> that's not the case unfortunately
20:58:40FromDiscord<Michal Maršálek> i see
21:00:05FromDiscord<Michal Maršálek> than an untyped macro should work?
21:00:26FromDiscord<leorize> sent a code paste, see https://play.nim-lang.org/#ix=3LHa
21:00:42FromDiscord<leorize> pretty terrible, but playing with typedesc is never pleasant in Nim
21:01:36FromDiscord<Michal Maršálek> Yeah I'm trying to understand the types, macros, and compile time stuff in general and I'm discovering some tricky things
21:02:26FromDiscord<Michal Maršálek> Why doesn't this macro work than? https://play.nim-lang.org/#ix=3LHf
21:02:33FromDiscord<Michal Maršálek> (edit) "than?" => "then?"
21:03:34FromDiscord<leorize> here's another fun fact about Nim... uninstantiated generics are not valid if not produced by sem
21:04:00FromDiscord<Michal Maršálek> what is sem,
21:04:03FromDiscord<Michal Maršálek> ?
21:05:34FromDiscord<leorize> sem is short for semantic analysis pass in the compiler
21:06:16FromDiscord<Michal Maršálek> In reply to @leorize "here's another fun fact": is this realted to why the macro doesn't work?
21:09:33FromDiscord<Michal Maršálek> ok, I can live without being able to call templates in the function signatures
21:09:38FromDiscord<Michal Maršálek> another question
21:11:45FromDiscord<leorize> yes, the T generated by your macro is considered to not exist
21:13:26FromDiscord<leorize> you can get template calling to work if you use that lousy workaround I outlined above
21:13:52FromDiscord<leorize> that's how my union macro deals with this stuff\: https://github.com/alaviss/union/blob/main/union.nim#L369
21:14:37FromDiscord<leorize> https://github.com/alaviss/union/blob/main/union.nim#L338
21:15:55FromDiscord<Michal Maršálek> In reply to @leorize "you can get template": ah thanks
21:15:58FromDiscord<Michal Maršálek> it works
21:16:23FromDiscord<Michal Maršálek> Ok another question: why is Nim complaining here? https://play.nim-lang.org/#ix=3LHm
21:16:58FromDiscord<leorize> welcome to the amazing world of typedesc
21:17:27FromDiscord<leorize> so... that T is a typedesc, meaning that it will become a `typedesc[T]`
21:17:57FromDiscord<leorize> you passed `int` to it, creating `typedesc[int]` as the type for your data field
21:18:50FromDiscord<0ffh> I've got some code I really need to speed up.↵It's a backtracking combinatorial solver, at it seems to spend >80% of it's time in genericDeepCopy of deepcopy.nim, which kind of makes sense.↵So what could I do to speed up the copying of my solver state object?
21:19:27FromDiscord<leorize> don't use deep copy
21:19:58FromDiscord<Michal Maršálek> @leorize that sounds complicated
21:20:08FromDiscord<leorize> assuming that you're storing your graph as a linked list-like object, you have to move it to an another representation
21:20:28FromDiscord<0ffh> K. The problem is, the state object has fields with tables and sequences.↵There's no linked lists.
21:20:51FromDiscord<leorize> does it have refs?
21:20:54FromDiscord<0ffh> I need those seqs and tables copied too.
21:20:57FromDiscord<0ffh> No refs.
21:20:59FromDiscord<leorize> it is↵(@Michal Maršálek)
21:21:08FromDiscord<leorize> @0ffh\: then just use normal copy
21:21:26FromDiscord<leorize> seqs and tables in Nim are value types
21:21:36FromDiscord<0ffh> In reply to @leorize "<@812269866366140427>\: then just use": Okay, that should be an easy experiment to do.
21:22:43FromDiscord<Michal Maršálek> In reply to @leorize "you passed `int` to": how do I write it correctly
21:22:46FromDiscord<Michal Maršálek> ?
21:25:28FromDiscord<leorize> that's the neat part, you don't
21:25:40FromDiscord<leorize> technically this is how it should be done\: https://play.nim-lang.org/#ix=3LHA
21:25:58FromDiscord<leorize> but it doesn't work, as usual for this kind of generics
21:26:22FromDiscord<Michal Maršálek> yeah
21:26:30FromDiscord<Michal Maršálek> that is what I had at first actually
21:26:32FromDiscord<leorize> small fix\: https://play.nim-lang.org/#ix=3LHB
21:26:36FromDiscord<leorize> still doesn't work
21:27:13FromDiscord<Michal Maršálek> I tried with the semicolon first ye
21:29:03FromDiscord<retkid> does anyone have a good up to date demo of arraymancer
21:29:12FromDiscord<retkid> currently it all looks like a pita
21:29:31FromDiscord<leorize> https://play.nim-lang.org/#ix=3LHF \<- "progress"
21:30:05FromDiscord<retkid> what are you doing an why
21:30:06FromDiscord<retkid> (edit) "an" => "and"
21:30:36FromDiscord<retkid> why
21:30:40FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3LHG
21:31:29FromDiscord<retkid> the fact that you specify a..data nullifies any benefit from having the typecheck, and also its a typed function so why would you do that
21:31:38FromDiscord<retkid> (edit) "a..data" => "a.data"
21:31:44FromDiscord<leorize> playing gymnastics with the compiler to get @Michal Maršálek stuff to work lol
21:32:04FromDiscord<Michal Maršálek> I want to create a type which is generic in 1. a type T and 2. a value x:T
21:32:09FromDiscord<retkid> is Michal doing ``-gc:off`` nonsense
21:32:17FromDiscord<retkid> not literally that but in that vein
21:32:33FromDiscord<Elegantbeef> This is the type system it doesnt matter what memory management is doing
21:32:45FromDiscord<retkid> In reply to @retkid "not literally that but": wonder what that could mean
21:33:33FromDiscord<leorize> it's just generics crumbling on it's own weight
21:33:38FromDiscord<leorize> and typedesc doesn't help
21:33:56FromDiscord<retkid> its time to switch to an ML lang for this stuff
21:34:07FromDiscord<retkid> actually idk if that would help
21:35:24FromDiscord<Elegantbeef> What exactly are we after anyway?
21:35:54FromDiscord<leorize> somehow instantiate that type
21:36:39FromDiscord<Elegantbeef> It might not be possible simply cause i dont think Nim knows how to walk `[T; x: static T]`
21:37:04FromDiscord<Elegantbeef> Atleast in type def
21:37:09FromDiscord<leorize> yea I think so too
21:37:27FromDiscord<Elegantbeef> I could look at the culprit and see if it's simple
21:37:37FromDiscord<Elegantbeef> Though I doubt it's simple 😀
21:39:02FromDiscord<retkid> see i wanna use arraymancer but i have no money to buy a training server and i have no gpu and an i5-4790
21:39:05FromDiscord<retkid> (edit) "i5-4790" => "i5-4790S"
21:39:16FromDiscord<retkid> and im concerned that i will never actually train anything
21:39:35FromDiscord<leorize> your best bet for arraymancer guides is in the science channel
21:40:43FromDiscord<Isofruit> leorize, Elegantbeef, on the off chance, does one of you two have an idea on how to figure out within a nim program which package a given Exception-type comes from?
21:40:57FromDiscord<retkid> In reply to @leorize "your best bet for": its sad because I tried a bunch of different algorithms but i cant figure out any patterns in the data
21:40:58FromDiscord<Isofruit> (edit) "from?" => "from (at runtime)?"
21:40:59FromDiscord<0ffh> @leorize Haha, okay that dropped the time from 3:30 to 0:15! 🥳 😅
21:41:11FromDiscord<Elegantbeef> you can use a macro
21:41:13FromDiscord<Elegantbeef> But it's runtime information so it doesnt overly help
21:41:21FromDiscord<0ffh> Thanks!
21:41:43FromDiscord<leorize> nice!
21:41:59FromDiscord<Elegantbeef> Is that hours or minutes? 😀
21:42:02FromDiscord<Isofruit> Yeh, macro to get that info at compile time we (xflywind and I) contemplated but got kinda stuck there.
21:42:07FromDiscord<0ffh> 3min30sec to 15sec
21:42:16FromDiscord<leorize> @Isofruit\: you can if you reimplement RTTI in macros
21:42:17FromDiscord<Elegantbeef> What is your goal iso
21:42:58FromDiscord<leorize> nim doesn't have any idea about packages, mind you, you should be able to get module data but no more than that
21:43:33FromDiscord<Isofruit> API endpoints can throw all kinds of errors at runtime that I do not know ahead of time. When one occurs, I want to know a) which error type it is (that's easy enough, just log e.name) and b) what module needs to be imported to get access to that exception for a try-except statement
21:43:38FromDiscord<leorize> @0ffh\: deepCopy is pretty evil \:p
21:44:07FromDiscord<Elegantbeef> Well Nim knows what exceptions can be raised, so we can get the module name of them
21:44:15FromDiscord<Elegantbeef> This can be done all at CT for a block of code
21:44:30FromDiscord<retkid> In reply to @leorize "your best bet for": maybe best because im looking at this code and melting
21:44:48FromDiscord<retkid> who the fuck writes code like this ↵`` x.fc1.relu.fc2``
21:44:49FromDiscord<leorize> `{.raises: [].}` and Nim will let you know what raises what
21:45:14FromDiscord<Isofruit> Yeh, ideally I'd be able to log that at runtime since the error itself may not occur at compile time / I may not be aware it occurs
21:45:29FromDiscord<retkid> In reply to @retkid "who the fuck writes": isn't one of the first things you learn in writing clean code is using descriptive variables.
21:46:22*Gustavo6046 quit (Remote host closed the connection)
21:46:28FromDiscord<leorize> everyone knows that you need short variable names so your program can access it faster, duh
21:46:48FromDiscord<retkid> oh ok its an optimization, not bad code
21:46:53FromDiscord<retkid> >:)
21:46:54FromDiscord<Elegantbeef> Leorize this isnt python or lua \:d
21:47:23FromDiscord<leorize> obligatory /s
21:47:58FromDiscord<Elegantbeef> Why do you need the /s here
21:48:10FromDiscord<Elegantbeef> It's compiled code if someone actually thinks that they have more issues than messy code 😀
21:48:35FromDiscord<retkid> wat
21:49:07FromDiscord<retkid> the code has issues that i cant see because i cant understand it because the variables are named FOO AND VAR
21:49:31FromDiscord<Isofruit> Now back to seeing how constructor can make my life easier
21:50:18FromDiscord<Elegantbeef> Bet it wont↵(@Isofruit)
21:50:36FromDiscord<Isofruit> Have you already abandoned it?
21:50:40*Gustavo6046 joined #nim
21:50:40FromDiscord<leorize> that's the whole point of `{.raises: [].}`, to prevent any exception from being raised statically↵(@Isofruit)
21:50:44FromDiscord<Elegantbeef> Nah i recently made it better
21:51:25FromDiscord<SirOlaf> I am a back for more punishment related to that bug and think the compiler is wrong about comparing flags for generic types
21:51:29FromDiscord<Elegantbeef> Removed the dumb macros and now only going for `defaults` and `constr`
21:52:20FromDiscord<Isofruit> In reply to @leorize "that's the whole point": Isn't "raises" more a annotation (that is also verified) to show "hey, these exceptions cna be thrown by this function"?
21:52:23FromDiscord<retkid> i just learned if you hold alt you scroll faster in vscode
21:53:21FromDiscord<Isofruit> In reply to @Elegantbeef "Nah i recently made": Now I'm curious, why the assumption it won't make my life easier?
21:53:22FromDiscord<leorize> it's a constraint↵(@Isofruit)
21:53:26FromDiscord<0ffh> In reply to @leorize "<@812269866366140427>\: deepCopy is pretty": I'm surprised it makes such a great difference, I thought it only costs extra when there are actual references that need to be hunted down. 😆 ↵Anyways, that really dotted the is and crossed the ts on an already reasonable successful day for me.↵Also, you dropped this: :nim1:
21:53:39FromDiscord<Elegantbeef> and if you have a blank raises it means you cannot raise anything so have to handle it↵(@Isofruit)
21:54:32FromDiscord<Isofruit> Ohh you can force yourself to have to deal with all the exceptions at compile time and thus force the compiler to tell you of all the exceptions that are possible to occur? That... That is really neat
21:54:38FromDiscord<Isofruit> Does wonders for correctness
21:57:01arkanoidcan you help me understand why vscode is not considering the .nim files in ~/.cache/nim/myproject_d/ ? I'm using futhark and it drops the generated nim files there. The code compiles but is hard and slow without the help of nimsuggest
22:01:12FromDiscord<Michal Maršálek> In reply to @Elegantbeef "It might not be": Would it somehow work without the requirement that x has type T?
22:02:19FromDiscord<Elegantbeef> Yea if you do `T; X: static int` i'd work
22:02:34*rp3 is now known as rlp10
22:02:34FromDiscord<Michal Maršálek> I mean with a generic X: static
22:03:06FromDiscord<Michal Maršálek> ah thats nonsense
22:03:25FromDiscord<Michal Maršálek> nvm
22:04:07FromDiscord<leorize> it won't
22:04:08FromDiscord<Elegantbeef> `static` isnt a typeclass so indeed it'll not
22:04:08FromDiscord<leorize> but this is nim
22:04:09FromDiscord<leorize> I mean, it is a generic so technically it should be a typeclass
22:04:58FromDiscord<Michal Maršálek> I guess my only option is to make `X` a field and then use runtime asserts on it's value?
22:05:16arkanoidwhat's the most idiomatic way to translate a while with var assignment from C to nim? "while( (hFeature = OGR_L_GetNextFeature(hLayer)) != NULL ) { ... }"
22:05:56FromDiscord<Elegantbeef> `while (let hFeature = yourCall(hLayer); hFeature) != nil`
22:06:18arkanoidthanks!
22:06:28FromDiscord<leorize> the better way is to not do it because it's kind of a code smell \:p
22:06:49FromDiscord<Elegantbeef> Indeed
22:06:51FromDiscord<Michal Maršálek> (edit) "use runtime asserts" => "check it" | "it's value?" => "runtime?"
22:07:42FromDiscord<Michal Maršálek> well I'm trying to push myself as well as Nim and see what's possible
22:07:43FromDiscord<Isofruit> Ohhh defaults creates a `new<TypeName>` proc and a `<Type>.init()` proc
22:07:59FromDiscord<Elegantbeef> Does it do both?
22:08:03FromDiscord<Elegantbeef> Did i fuck something up?
22:08:20FromDiscord<Michal Maršálek> In reply to @leorize "the better way is": Not to do what?
22:08:26FromDiscord<Elegantbeef> If it does create both i fucked up
22:08:35FromDiscord<Elegantbeef> The while loop stuff michal
22:08:48FromDiscord<Isofruit> It appears to, I used to have `newCharacter` defined myself, I just commented it out
22:09:10FromDiscord<Elegantbeef> Well that's right, though i should add another parameter for it
22:09:20FromDiscord<Elegantbeef> One that allows the generic supporting `Character.new`
22:09:40FromDiscord<leorize> pretty much, though I'd prefer to avoid any kind of asserts↵(@Michal Maršálek)
22:09:45FromDiscord<Elegantbeef> For ref types it emits a `newT` for non-refs it emits `initT`
22:09:50FromDiscord<leorize> yea I was talking about the while loop thing↵(@Michal Maršálek)
22:10:16FromDiscord<Isofruit> works nicely with norm models and its tablename pragma
22:10:49FromDiscord<Elegantbeef> I will be making `implDefaults(Thingy, TypeDescConstr)` a thing when i get around to it
22:10:58FromDiscord<Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3LHT
22:11:29FromDiscord<Michal Maršálek> In reply to @leorize "pretty much, though I'd": That makes me very sad actually, but thank you all. 🙂
22:11:44FromDiscord<Isofruit> (edit) "https://play.nim-lang.org/#ix=3LHT" => "https://play.nim-lang.org/#ix=3LHV"
22:11:46FromDiscord<Elegantbeef> Yea that `Character.init` shouldnt work
22:11:52FromDiscord<Elegantbeef> So i guess bug found
22:12:08FromDiscord<Isofruit> Shall I open an issue so you don't have to?
22:12:25FromDiscord<Elegantbeef> Would be appreciated
22:13:09*PMunch quit (Quit: leaving)
22:13:14FromDiscord<Isofruit> Let me just first confirm that this is also an issue in inim, maybe the compiler just allows something illegal to happen that'll cause a runtime error
22:13:36*noeontheend joined #nim
22:13:39FromDiscord<Elegantbeef> I have a feeling it's the inheritance causing the issue
22:19:02FromDiscord<Isofruit> does nim by default provide a <Type>.new() proc?
22:19:48arkanoidleorize, sure, I first translate C -> nim 1:1, then I drop some more idiom in it
22:19:49FromDiscord<Isofruit> Huh, yeah it does
22:19:58FromDiscord<Isofruit> (edit) "does" => "does, if the Type is an object"
22:20:00FromDiscord<Recruit_main707> calling `new Type` will create a `ref Type`
22:20:09FromDiscord<Isofruit> Ahhh that explains it
22:20:17NimEventerNew thread by Cantanima: What's the proper idiom?, see https://forum.nim-lang.org/t/8789
22:20:25FromDiscord<Elegantbeef> It allocates a `ref Type` unless it's a ref type then it allocates just `Type`
22:20:27FromDiscord<Recruit_main707> its not exacty a <Type>.new() proc but it does the same
22:20:55FromDiscord<Isofruit> With the exception that it explodes in your face if you try to access any of its fields that store objects
22:21:09FromDiscord<Isofruit> or options
22:21:20FromDiscord<Isofruit> At least inim drowns me in a sea of red when I do that
22:21:58FromDiscord<Elegantbeef> `new T` will allocated only the root object so if you have other `ref T` it'll error↵(@Isofruit)
22:24:35FromDiscord<ajusa> I'm working on my html forms library and wanted to support multiselect, which means a sequence of strings. Right now a validator is defined as ` Validator = proc(value, label: string): string {.closure.}`. What's a good way to have a validator that'll operate on a sequence of strings? I've considered case objects but I feel like that may become too complicated. My honest reaction is to just treat sequences as a single deliminated string,
22:25:21FromDiscord<Isofruit> In reply to @Elegantbeef "`new T` will allocated": There is no bug, it merely compiled because I didn't call that function anywhere
22:25:35FromDiscord<Isofruit> (edit) "In reply to @Elegantbeef "`new T` will allocated": There is no bug, it merely compiled because I didn't call that function anywhere ... " added "and didn't realize"
22:25:49FromDiscord<Elegantbeef> but `init(Character)` isnt right
22:26:51FromDiscord<Isofruit> Kinda, it's more that the issue isn't noticed by the compiler if it is inside of dead code. `newModel(Character)`, which is the proc within which Character.init() is called, itself is never called anywhere ever
22:27:12FromDiscord<Isofruit> The second I do call it, the compiler implodes as it should
22:31:20FromDiscord<Isofruit> So false alarm, I apologize!
22:32:35FromDiscord<Elegantbeef> Oh cause it's a generic it's just an instantiation error
22:38:52FromDiscord<Elegantbeef> I found where the issue with the static is, no clue if it'll be a fun fix
22:43:25FromDiscord<deech> Is there a way to explicitly call the property of an object, eg. I'd like `obj.f` to always mean the `f` field of `obj` and error if it doesn't exist even if `proc f(obj:o ...)` exists.
22:44:30FromDiscord<deech> Even some kind of long hand is fine, like, `fieldOf(obj, f)` or something like that.
22:45:49FromDiscord<Elegantbeef> I could see term rewriting macros working here
22:45:50FromDiscord<Elegantbeef> Aside from that i dont know of a way
22:46:50FromDiscord<deech> I think it would be good to have some kind of builtin way of disambiguating. I try to stay away from term rewriting macros if possible. 🙂
22:47:26FromDiscord<deech> Maybe something like `obj[f]`?
22:47:58FromDiscord<Elegantbeef> You could make that
22:48:43FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LI6
22:48:47FromDiscord<Elegantbeef> Doesnt prevent function calls though
22:48:57FromDiscord<Elegantbeef> Wrapping it could though
22:50:11FromDiscord<deech> Right, that's what I meant, I could write a macro that iterates over the field pairs and errors of `field` doesn't exist but in this case I think it would be good to have built in ways to disambiguate all uses of `.`. I run into issues all the time with module qualification as well.
22:50:37FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LI7
22:50:37FromDiscord<Elegantbeef> It's not too hard for this case
22:51:10FromDiscord<Elegantbeef> I've never had an issue with properties vs procedures so i'll keep hush
22:51:24FromDiscord<Elegantbeef> I mean fields vs procedures
22:52:37FromDiscord<Elegantbeef> So it was like 5 loc to fix the static issue!
22:52:51FromDiscord<Elegantbeef> Only took me an hour to two write
22:53:06FromDiscord<Elegantbeef> hour or two to write\
22:53:33FromDiscord<evoalg> it's cos you got up too early beefy
22:55:40FromDiscord<Elegantbeef> Well i got too happy only fixed instantiation
22:55:59FromDiscord<Elegantbeef> dispatch is still borked
22:56:46FromDiscord<Elegantbeef> Wait nevermind, it works
23:01:24FromDiscord<treeform> In reply to @zetashift "<@107140179025735680>\: heyho, treeform, I'm": i have fixed the nimdocs now has right docs, some how it got stuck.
23:01:59FromDiscord<treeform> https://nimdocs.com/treeform/pixie/pixie.html
23:05:13FromDiscord<Isofruit> Managing to half the number of lines in my characterModel.nim thanks to constructor feels good
23:05:38FromDiscord<Isofruit> (edit) "half" => "halve"
23:07:39FromDiscord<Elegantbeef> Good to hear
23:08:27FromDiscord<Elegantbeef> Also worth noting you do not need the explicit types unless you really want to
23:09:12FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LIc
23:09:36FromDiscord<deech> Oh wow, when did we get `{.defaults.}`?
23:09:42FromDiscord<Isofruit> Ah, you mean I can save myself the entire `name: string = ""` and just do name = ""
23:09:43FromDiscord<Elegantbeef> We didnt
23:09:47FromDiscord<Elegantbeef> My macro adds it
23:09:58FromDiscord<deech> Ah, cool!
23:09:59FromDiscord<Elegantbeef> https://github.com/beef331/constructor#defaults for context
23:10:00FromDiscord<Isofruit> That's fair, I just like to explicitly type my models
23:12:06FromDiscord<Elegantbeef> @SirOlaf\: any progress on your bug?
23:12:50FromDiscord<SirOlaf> Not really, I'm just confused that it's possible for the flags to be different after generateInstance
23:12:54FromDiscord<Isofruit> ... is there a lazy way to get nimble to update my projects nimble file for me? With all the packages I use and their versions etc?
23:13:16FromDiscord<Elegantbeef> It is not
23:14:31FromDiscord<SirOlaf> My phrasing was off, it's strange that the "template" in semBorrow can have different return type flags than the result of it
23:14:40FromDiscord<SirOlaf> And those flags must come from somewhere, and it should be generateInstance
23:15:31FromDiscord<Patitotective> In reply to @Elegantbeef "https://dev.to/beef331/demystification-of-macros-in": This was really helpful, Thanks 🙃
23:16:59FromDiscord<SirOlaf> In reply to @SirOlaf "And those flags must": So either the flags are wrong or the comparison is too strict
23:20:22FromDiscord<tsoj> Is it possible to pass templates as function parameters?
23:21:35FromDiscord<Elegantbeef> No you can pass it to template/macros though
23:22:38FromDiscord<Elegantbeef> What're you trying to do?
23:24:58*justsomeguy joined #nim
23:26:29FromDiscord<tsoj> creating a function that converts instances of different types that have the same structure but different atomics at the lowest level (e.g. float instead of int), while also applying an operator when converting the atomics
23:27:13FromDiscord<Elegantbeef> Got an small example of the manual written code?
23:27:41FromDiscord<Elegantbeef> I think i understand but want to be certain before i suggest diving
23:29:10FromDiscord<tsoj> This works except for the custom operator: https://play.nim-lang.org/#ix=3LIh
23:29:35*crem quit (Ping timeout: 268 seconds)
23:33:28FromDiscord<retkid> what does
23:33:33FromDiscord<retkid> ``..<`` do
23:33:45FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3LIi
23:33:52FromDiscord<Elegantbeef> depends on context
23:34:03FromDiscord<Elegantbeef> It's an iterator and also range construction
23:34:24FromDiscord<Elegantbeef> Tsoj that might work, you now can defined your own `converTo` procs for each field type which will be called on `a.convertTo`
23:34:26FromDiscord<retkid> its just a fancy way of doing x-1
23:34:42FromDiscord<Elegantbeef> It's more readable yes
23:34:51FromDiscord<retkid> no its not
23:34:58FromDiscord<Elegantbeef> It is indeed
23:35:39FromDiscord<retkid> ``for a in 0 ..< 65`` is less readable then ``for a in 0 .. 65-1``
23:35:45FromDiscord<retkid> (edit) "65-1``" => "65-1:``"
23:35:51FromDiscord<Elegantbeef> It's more readable
23:35:58FromDiscord<Elegantbeef> You know what's even more readable
23:36:03FromDiscord<Elegantbeef> `for a in 0..64`
23:36:17FromDiscord<retkid> well thats what the compiler sees
23:36:31FromDiscord<retkid> unfortunately humans are not compilers
23:36:47FromDiscord<Elegantbeef> But the point is `less than` is easy to comprehend to me atleast than `x -1`
23:37:03FromDiscord<Elegantbeef> Same semantics but the range operator is easier to understand
23:37:21FromDiscord<Elegantbeef> It reads left to right without any operations
23:37:39FromDiscord<retkid> i guess but then i gotta convert it into words in my brain so it takes more time
23:38:05FromDiscord<Elegantbeef> You dont convert it to words?
23:38:07FromDiscord<retkid> so its like↵"for all digits between x and y while x is less than why"
23:38:10FromDiscord<retkid> (edit) "why"" => "y""
23:38:32FromDiscord<Elegantbeef> No it's more like `for x in range of 0 to less than y`
23:38:36FromDiscord<Elegantbeef> Atleast to me
23:39:02FromDiscord<Elegantbeef> Versus the mental overhead of reasoning the -1 and interpreting it
23:39:05FromDiscord<retkid> but i dont need to processes a loop when written like ``for a in x .. y``
23:39:06FromDiscord<Elegantbeef> It's all subjective anywho
23:39:10FromDiscord<retkid> -1
23:39:18FromDiscord<Elegantbeef> What ever you say
23:39:30FromDiscord<retkid> see, our brains work differently, and its pretty interesting