00:00:08 | FromDiscord | <Leastrio> Are there any good http libs out there? |
00:00:16 | FromDiscord | <Leastrio> The std one doesnt fit my needs |
00:00:27 | FromDiscord | <Leastrio> (edit) "there?" => "there that you guys recommend?" |
00:06:22 | FromDiscord | <Elegantbeef> assign↵(@Mustache Man) |
00:06:28 | FromDiscord | <Elegantbeef> `let a = b` is copy by value |
00:19:29 | * | pbsds quit (Quit: The Lounge - https://thelounge.chat) |
00:22:09 | * | pbsds joined #nim |
01:17:19 | * | ltriant joined #nim |
01:29:52 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
01:35:00 | * | ltriant quit (Ping timeout: 272 seconds) |
01:55:46 | * | xet7 quit (Quit: Leaving) |
01:56:20 | * | xet7 joined #nim |
02:09:23 | * | ltriant joined #nim |
02:15:29 | * | azimut_ quit (Ping timeout: 255 seconds) |
02:20:22 | * | ltriant quit (Ping timeout: 268 seconds) |
02:49:58 | * | ltriant joined #nim |
02:55:26 | * | ltriant quit (Ping timeout: 272 seconds) |
03:00:02 | FromDiscord | <@thatrandomperson5-6310e3b26da03> Anyone have a nodetree template? I don’t want to manually add all the basic procs like `add` or `[]`. It can also just be an inheritable object or a macros |
03:21:36 | * | krux02 quit (Remote host closed the connection) |
03:22:20 | * | ltriant joined #nim |
03:27:44 | * | ltriant quit (Ping timeout: 272 seconds) |
03:49:38 | * | ltriant joined #nim |
03:50:58 | * | arkurious quit (Quit: Leaving) |
03:55:04 | * | ltriant quit (Ping timeout: 260 seconds) |
04:21:12 | * | ltriant joined #nim |
04:26:05 | * | ltriant quit (Ping timeout: 246 seconds) |
04:52:47 | * | ltriant joined #nim |
04:58:04 | * | ltriant quit (Ping timeout: 260 seconds) |
08:34:33 | FromDiscord | <Leastrio> Im setting a few headers in my httpClient, and one is getting removed when i make a request. Is there a way to make it not remove the header? |
08:35:43 | * | pro joined #nim |
08:35:55 | * | pro quit (Client Quit) |
08:36:12 | FromDiscord | <Leastrio> (edit) "one" => "the Authorization header" |
09:28:22 | FromDiscord | <sOkam!> How would you use strings and sequences in a gc:none situation?↵I imagine they would need to be coded, but question is related to learning to do that↵Are both seq and string GC'ed, or is that only the case for seq? |
09:40:34 | FromDiscord | <ElegantBeef> Both are gc'd |
09:40:52 | FromDiscord | <ElegantBeef> You would make your own collection and manually manage it using hooks |
09:41:10 | FromDiscord | <ElegantBeef> Though i wouldnt suggest doing that |
09:41:16 | * | jmdaemon quit (Ping timeout: 252 seconds) |
09:47:15 | * | jjido joined #nim |
09:52:50 | FromDiscord | <sOkam!> Goal is just learning manual mm↵Or do you mean that there is a better way in that context than strings/seq? |
09:55:06 | FromDiscord | <ElegantBeef> I meant i wouldnt manual manage memory |
09:56:45 | FromDiscord | <sOkam!> ah, yeah. i get that. i have no intention of making anything serious with it either, its just for toy learning on the side |
09:57:18 | FromDiscord | <sOkam!> any pointers on how to learn that concept of "collection" and "hooks" that you mention? |
09:57:45 | FromDiscord | <ElegantBeef> for the former it's just "C vector" or "C growable array" |
09:57:56 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/destructors.html for hooks |
09:58:24 | FromDiscord | <ElegantBeef> Growable arrays are really extraordinary simple to implement |
09:59:18 | FromDiscord | <AmjadHD> In reply to @hmmm "<@629598664452734989> broski how do": git clone my fork of the repo to the Packages folder (reachable from sublime text through `Preferences > Browse Packages ...`) and checkout the rework branch. |
10:01:07 | FromDiscord | <sOkam!> In reply to @ElegantBeef "Growable arrays are really": oh just found this with a quick search with those keywords. they do look simple indeed. tyty https://media.discordapp.net/attachments/371759389889003532/1061222941641154601/image.png |
10:02:39 | FromDiscord | <ElegantBeef> The trick in Nim is to make them generic of course 😄 |
10:03:18 | FromDiscord | <ElegantBeef> We also have the nice `type GrowableArray[T] = ptr object` 😄 |
10:03:49 | FromDiscord | <ElegantBeef> Or i guess just object depending on the way you lay them out |
10:05:09 | FromDiscord | <ElegantBeef> sent a code paste, see https://paste.rs/l0Q |
10:06:06 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=4ky4 |
10:06:14 | FromDiscord | <ElegantBeef> Bunch of different ways to lay out the data of course |
10:07:42 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
10:08:10 | FromDiscord | <badmachine> Hello! I'm new here. I couldn't find a good answer via google - what's the easiest way to interop with rust crates? |
10:08:29 | FromDiscord | <ElegantBeef> Use the c-api if they provide it |
10:08:58 | FromDiscord | <ElegantBeef> Otherwise make your own bindings for them either manually or with things like https://github.com/arnetheduck/nbindgen |
10:09:21 | FromDiscord | <badmachine> I looked through nbindgen, but some of the docs point to cbindgen docs |
10:09:29 | FromDiscord | <ElegantBeef> To wrap C-api you can try c2nim, futhark, nimterop |
10:09:42 | FromDiscord | <badmachine> Gotcha, thanks! |
10:11:34 | FromDiscord | <ElegantBeef> Futhark is generally the easiest but it's also the most, how do i put it .... uhhh ugly |
10:36:29 | FromDiscord | <ShalokShalom> Elegant, does Kate pick up your nimlsp without further doing? |
10:37:12 | FromDiscord | <ShalokShalom> https://invent.kde.org/utilities/kate/-/merge_requests/680↵I actually merged this 9 months ago and never came to actually testing it extensively. ^^ |
10:53:38 | FromDiscord | <4zv4l> sent a long message, see http://ix.io/4kyg |
10:55:02 | FromDiscord | <4zv4l> but I found why I guess↵I was using `out` variable which is a reserved word |
10:58:35 | FromDiscord | <cellux (Ruzsa Balázs)> sent a code paste, see https://paste.rs/dYA |
11:14:10 | FromDiscord | <Phil> @jtv I don't think I asked you this one yet, what are your testing approaches in nim or procedural languages in general?↵Solely integration tests? |
11:18:49 | * | azimut joined #nim |
11:24:00 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4kyl |
11:28:07 | FromDiscord | <4zv4l> oh maybe because the file doesn't exist and `fmappend` won't create it ? |
11:28:28 | FromDiscord | <4zv4l> yeah no idk |
11:37:10 | FromDiscord | <4zv4l> seems that when I change the buffer size↵it works |
12:00:21 | FromDiscord | <untoreh> sent a code paste, see https://paste.rs/hOa |
12:28:24 | FromDiscord | <d4> sent a code paste, see https://play.nim-lang.org/#ix=4kyK |
12:28:27 | FromDiscord | <d4> basically im trying to append the contents to the file instead of rewriting it |
12:51:17 | FromDiscord | <d4> there are no errors happening, it just doesnt write anything to the file |
12:54:33 | FromDiscord | <ShalokShalom> In reply to @ShalokShalom "Elegant, does Kate pick": ElegantBeef: I try to get Kate running with Nim, and it seems to break the syntax highlighting. I assume you are running Kubuntu, or something? Does this work for you? https://media.discordapp.net/attachments/371759389889003532/1061266592408817705/grafik.png |
12:55:02 | FromDiscord | <ShalokShalom> The test file I used: https://raw.githubusercontent.com/Vindaar/shell/master/shell.nim |
13:12:10 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4kyV |
13:16:31 | * | PMunch joined #nim |
13:21:24 | FromDiscord | <planetis> Add a # " comment where the error starts lol |
13:28:11 | FromDiscord | <jmgomez> In reply to @planetis "Add a # "": what do you mean? |
13:29:22 | FromDiscord | <planetis> Sorry I replied to @ShalokShalom to stop the error in syntax highlighting |
13:29:49 | FromDiscord | <planetis> That's what I do |
13:30:24 | FromDiscord | <jmgomez> ahh sorry, I thought it was an answer to my issue |
13:32:26 | FromDiscord | <ShalokShalom> In reply to @planetis "Add a # "": And then? |
13:32:43 | FromDiscord | <ShalokShalom> It seems to break at that "\\" |
13:32:58 | FromDiscord | <ShalokShalom> So that seems like Kate could use an outdated syntax highlighting file? |
13:33:32 | FromDiscord | <ShalokShalom> (edit) ""\\"" => "`"\\"`" |
13:34:50 | * | Guest46 joined #nim |
13:35:09 | Guest46 | What's up guys. It's quandale dingle here! |
13:35:48 | Guest46 | NimBot |
13:36:12 | * | Guest46 quit (Client Quit) |
13:40:46 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4kyZ |
13:59:21 | * | arkurious joined #nim |
14:04:01 | * | byanka_ quit (Read error: Connection reset by peer) |
14:04:24 | * | byanka_ joined #nim |
14:12:11 | FromDiscord | <planetis> In reply to @ShalokShalom "It seems to break": yes after that add # " |
14:12:45 | FromDiscord | <planetis> it needs fixing, there is no newer version |
14:13:24 | FromDiscord | <ShalokShalom> You mean the source code is wrong? |
14:13:44 | FromDiscord | <ShalokShalom> Since its the package of someone else. I would launch a PR then. |
14:14:01 | FromDiscord | <dlesnoff> I am tinkering with graphviz. I would like to convert a Nim's AST to a GraphViz specification to render it like so for example.↵Has someone already done something similar ? https://media.discordapp.net/attachments/371759389889003532/1061286589457776640/graph.svg |
14:15:12 | FromDiscord | <dlesnoff> https://media.discordapp.net/attachments/371759389889003532/1061286886187999364/graph.jpg |
14:15:20 | FromDiscord | <ShalokShalom> In reply to @planetis "it needs fixing, there": With fixing, you mean the current syntax file |
14:20:33 | FromDiscord | <dlesnoff> Googled it and found this: https://github.com/petermora/nimDot |
14:20:39 | FromDiscord | <ShalokShalom> Since the same file is fine in VSCode, I assume thats down to https://invent.kde.org/frameworks/syntax-highlighting/-/blob/master/data/syntax/nim.xml |
14:20:53 | FromDiscord | <ShalokShalom> @planetis Thanks! |
14:22:30 | FromDiscord | <planetis> Really they use the same file? I thought VScode uses it's own format. |
14:24:16 | PMunch | djazz, you around? |
14:25:54 | FromDiscord | <djazz> In reply to @PMunch "<@81390960805675008>, you around?": Whats up |
14:27:22 | PMunch | Looking at your Futhark PR |
14:27:31 | PMunch | Had a question, but managed to sort it out myslf |
14:29:47 | FromDiscord | <djazz> What about it? |
14:29:58 | FromDiscord | <ShalokShalom> In reply to @planetis "Really they use the": https://bugs.kde.org/show_bug.cgi?id=463969↵↵No, thats what I mean. |
14:30:05 | FromDiscord | <ShalokShalom> VSCode highlights correctly. |
14:30:15 | FromDiscord | <ShalokShalom> And it does use another format. |
14:30:26 | PMunch | @djazz, I was just wondering why you had removed the pragma thing instead of just adding your pragma to it |
14:30:54 | PMunch | But I see that the feature has never been used and your solution is closer to what is done everywhere else in Futhark and a much cleaner solution |
14:30:58 | FromDiscord | <ShalokShalom> In reply to @planetis "Really they use the": I said the same file is fine in VSCode 🙂 |
14:31:18 | FromDiscord | <planetis> Oh ok |
14:31:23 | FromDiscord | <djazz> The old pragma code didnt do anything and added the pragmas in the wrong place, before the |
14:31:40 | FromDiscord | <planetis> Got excited for a moment |
14:32:15 | PMunch | @djazz, yeah that seems to have been some stale code from when I created Futhark |
14:32:15 | FromDiscord | <djazz> Besides, it only worked for pragmas without values |
14:32:44 | PMunch | It has existed in the codebase since the initial commit, but never actually been used for anything |
14:33:07 | PMunch | The PR looks good |
14:33:07 | FromDiscord | <ShalokShalom> In reply to @planetis "Got excited for a": Why? would you like to use Kate |
14:33:16 | PMunch | I wish I had some better testing for Futhark though.. |
14:33:27 | FromDiscord | <djazz> I found another issue last night, when enums contain same value multiple times, futhark makes a const, but without the with defined guards |
14:33:58 | PMunch | Ah, that's not great |
14:33:58 | FromDiscord | <djazz> So it collides with other already defined consts |
14:34:34 | FromDiscord | <djazz> I tried to split lwip into lwip core and lwip apps, with the apps depending on the core. But const collision |
14:35:02 | FromDiscord | <ShalokShalom> @Vindaar By loading your `shell` into my VSCode, I saw that len is declared by not used. ↵https://github.com/Vindaar/shell/blob/master/shell.nim#L54 |
14:35:10 | FromDiscord | <djazz> Works when you only import apps and not apps and core in same nim file |
14:35:20 | FromDiscord | <djazz> (since apps export lwip core) |
14:51:18 | FromDiscord | <djazz> PMunch: dont forget to bump version number if you want |
14:52:19 | PMunch | I will, just working on some other stuff as well |
14:54:01 | FromDiscord | <deech> What is the difference between `std/syncio` and `system/ansi_c`? Both seem to cover similar `FILE` functionality. |
14:59:35 | PMunch | syncio is a nice Nim API to synchronous IO, ansi_c is a raw wrapper of C style file handling |
15:00:06 | PMunch | Oh, and some other things in ANSI C of course |
15:00:22 | PMunch | Like jumps and printf |
15:00:40 | PMunch | The C compiler uses ansi_c for targets that can use it I believe |
15:04:58 | FromDiscord | <dlesnoff> Can we output a Nim's AST in a file ? Dump[Tree,Ast,Lisp] output only appears in the Nim's compiler output.↵Macro output has to be untyped. If I understand correctly, no untyped variable can become a typed variable (it would be at runtime) ? |
15:05:15 | FromDiscord | <dlesnoff> (edit) "untyped. If" => "untyped.↵If" |
15:07:34 | FromDiscord | <pyryrin> sent a code paste, see https://play.nim-lang.org/#ix=4kzk |
15:08:18 | FromDiscord | <planetis> either is fine, you can also write 42'i32 |
15:08:34 | FromDiscord | <pyryrin> what would you prefer planetis |
15:09:14 | FromDiscord | <planetis> the second one |
15:09:20 | FromDiscord | <pyryrin> actually that is very cool doing `42'i32` |
15:09:41 | FromDiscord | <dlesnoff> but is less explicit for newcomers to Nim |
15:10:51 | FromDiscord | <Rika> personally would do 1st or 3rd |
15:11:00 | FromDiscord | <planetis> actually I use all of them, you have to. if you're trying to safe convert a variable, you do myVar.int32 |
15:15:23 | PMunch | @djazz, here you go: https://github.com/PMunch/futhark/releases/tag/v0.7.0 |
15:16:21 | PMunch | @dlesnoff, `result.repr` is what Futhark uses to write Nim AST to a file as proper Nim code |
15:17:12 | PMunch | @pyryrin, I use `42'i32` |
15:20:40 | FromDiscord | <jtv> PMunch, that projecting is fing cool. Definitely going to reach for it first time I need it. |
15:21:51 | PMunch | @jtv, huh? |
15:22:57 | FromDiscord | <Rika> projecting -> project |
15:22:58 | FromDiscord | <Rika> i assume |
15:26:20 | FromDiscord | <jtv> Yes sorry, autocorrect 😦 |
15:27:04 | PMunch | Oh you're talking about Futhark :P Yes it's a pretty neat project |
15:27:52 | PMunch | Works surprisingly well |
15:29:09 | FromDiscord | <djazz> In reply to @PMunch "<@81390960805675008>, here you go:": Thanks! Will try it out later |
15:31:04 | FromDiscord | <dlesnoff> In reply to @PMunch "<@610977647601909781>, `result.repr` is what": Thanks ! I will manage with this. |
15:49:22 | PMunch | @djazz, was it you who had the clang path finder? |
15:49:29 | FromDiscord | <djazz> yeah |
15:51:19 | FromDiscord | <djazz> here https://github.com/daniel-j/nim-picosdk/blob/master/src/picostdlib/private.nim#L7-L19 |
15:51:33 | PMunch | Thanks |
15:52:02 | PMunch | Thanks :) |
15:53:14 | FromDiscord | <djazz> It could be improved |
15:53:35 | FromDiscord | <djazz> More of a demonstration of that it can be done |
15:55:24 | FromDiscord | <djazz> another solution would be that compiling opir would copy the include path inside the nimble thing? so that opir always works |
15:55:36 | FromDiscord | <djazz> even on systems without clang |
15:55:46 | FromDiscord | <djazz> i dunno |
15:56:01 | FromDiscord | <djazz> (if you copy opir to a system without clang) |
15:56:25 | FromDiscord | <djazz> nvm, it links to libclang dynamically |
15:56:50 | FromDiscord | <djazz> maybe opir can add clang's include paths to the json? |
15:57:31 | FromDiscord | <djazz> or as a separate opir --get-clang-includes |
15:59:20 | PMunch | Hmm, that's a good idea |
15:59:24 | FromDiscord | <djazz> hmm, did alias stop work? pretty sure it worked before↵`{"kind":"const","file":".../cyw43-driver/src/cyw43_ll.h","position":{"column":9,"line":101},"name":"CYW43_SUP_KEYXCHANGE_WAIT_M1","type":{"kind":"alias","value":"CYW43_SUP_AUTHENTICATED"}}` |
15:59:35 | FromDiscord | <djazz> i see no const pointing to the other const |
15:59:53 | PMunch | Hmm, if so then that's a bug |
15:59:58 | FromDiscord | <djazz> in nim it would be `const Cyw43SupKeyxchangeWaitM1 = Cyw43SupAuthenticated` |
16:00:13 | PMunch | I added support for your parenthesis constants, that might've broken something else.. |
16:00:19 | PMunch | Do you have a minimal sample I can test with? |
16:00:19 | FromDiscord | <djazz> yeah perhaps |
16:01:12 | FromDiscord | <djazz> these C lines https://github.com/georgerobotics/cyw43-driver/blob/main/src/cyw43_ll.h#L93-L108 |
16:01:22 | PMunch | Hmm, it's Futhark who passes the Clang path to Opir though.. |
16:01:57 | FromDiscord | <djazz> In reply to @PMunch "Hmm, it's Futhark who": ah right... well, opir uses libclang and should know the paths? |
16:02:18 | FromDiscord | <djazz> or maybe thats a feature of the frontend of the compiler |
16:02:25 | PMunch | Yeah I think so |
16:02:34 | PMunch | I need to pass the path in with `-I` for it to work |
16:02:38 | FromDiscord | <djazz> wanna have a look at the alias thing? |
16:02:46 | PMunch | Yeah I'm looking at it now |
16:03:31 | FromDiscord | <djazz> wrapping numbers with parens seems quite common with C macros |
16:03:53 | FromDiscord | <djazz> probably how macros work since they are just working on the text |
16:04:11 | FromDiscord | <djazz> making them more safer to use |
16:04:16 | FromDiscord | <jtv> It's incredibly common otherwise you end up having your numbers bind to the wrong things too easily, yes |
16:04:57 | FromDiscord | <deech> Currently in `std/sync_io`, `close` (https://github.com/nim-lang/Nim/blob/2564b5c938602e4f8820d2ed2b778c6d4f1d0cd5/lib/std/syncio.nim#L326-L329) allows you to close `stdin` and `stderr` which is probably not what the user wants most of the time. Any opinions on whether we should make this an error and add dedicated functions like `closeStdin`? |
16:06:23 | FromDiscord | <djazz> PMunch, you can also do this instead of adding another const, in case the C file doesnt use the correct order: `template Cyw43SupKeyxchangeWaitM1: untyped = Cyw43SupAuthenticated` |
16:06:37 | FromDiscord | <djazz> bit of a hack maybe |
16:06:56 | FromDiscord | <deech> (edit) "`std/sync_io`," => "`std/syncio`," |
16:07:38 | FromDiscord | <djazz> then it will work like C macros xD |
16:07:54 | PMunch | Yeah I don't quite remember why I didn't do that.. |
16:08:51 | FromDiscord | <djazz> C: It's macros all the way down↵Nim: Macros is my speciality! |
16:09:59 | FromDiscord | <djazz> you can also do this for the "constants": `template Cyw43SupAuthenticated: untyped = (4)` although I prefer real consts |
16:10:17 | FromDiscord | <djazz> but for more complex stuff than ints... |
16:11:50 | FromDiscord | <djazz> for C macro "functions" etc |
16:27:25 | FromDiscord | <@thatrandomperson5-6310e3b26da03> Is it possible to parse a nim string into a NimNode at compile-time? |
16:28:59 | FromDiscord | <auxym> In reply to @@thatrandomperson5-6310e3b26da03 "Is it possible to": see parseStmt/parseExpr in https://nim-lang.org/docs/macros.html |
16:29:31 | FromDiscord | <Phil> Is it actually possible to include images into nim docs I wonder |
16:30:03 | FromDiscord | <Gumbercules> They are just rst no? |
16:30:10 | FromDiscord | <djazz> In reply to @Isofruit "Is it actually possible": data uris? 🤣 |
16:30:38 | FromDiscord | <Phil> I have actually only seen rst mentioned, never read actually into what it is so I'm not familiar with anything in that space |
16:31:25 | FromDiscord | <Gumbercules> It's just a markup language that is focused on technical/engineering related documentation |
16:31:48 | FromDiscord | <Phil> Why not just use markdown? |
16:32:06 | FromDiscord | <Gumbercules> Whereas markdown is much more about producing nice looking legible documents |
16:32:24 | FromDiscord | <Phil> But eh, that wasn't the topic, sorry for the diverting question, so rst has image support? |
16:32:40 | FromDiscord | <Gumbercules> Because someone had a hardon for restructured text or had used it previously probably |
16:33:10 | FromDiscord | <Gumbercules> It's also the preferred markup language for Nim forum |
16:33:22 | FromDiscord | <Gumbercules> I believe it does.... Let me do the Google thing |
16:33:42 | FromDiscord | <Phil> The main reason I'm asking about this is because I think about macros fairly graphically, with symbols as individual bubbles |
16:33:48 | FromDiscord | <Phil> Yeh, just found something for that |
16:33:52 | FromDiscord | <Phil> https://sublime-and-sphinx-guide.readthedocs.io/en/latest/images.html |
16:34:14 | FromDiscord | <Gumbercules> https://restructuredtext.documatt.com/element/inline-image.html |
16:34:16 | FromDiscord | <Phil> Which I don't think is rst spec, rather something interpreting rst files or sth |
16:34:25 | FromDiscord | <Phil> Ah check, I'll read into that |
16:34:27 | FromDiscord | <Gumbercules> Yeah it might be an extension or some shit |
16:34:49 | FromDiscord | <Gumbercules> I'd be surprised though if it didn't work |
16:35:22 | FromDiscord | <Gumbercules> I feel like I've seen docs produced with nimdoc that have inline images |
16:36:15 | PMunch | @djazz, it appears to be an order issue I believe |
16:36:26 | FromDiscord | <djazz> hmm |
16:36:30 | FromDiscord | <djazz> the aliasing? |
16:36:35 | PMunch | Yeah.. |
16:36:44 | FromDiscord | <djazz> wrong order in opir output? |
16:36:46 | PMunch | The problem is that Futhark will only create aliases to things it knows about |
16:37:06 | PMunch | Nah, it's dumber than that |
16:37:25 | PMunch | It uses a HashSet to keep track of what is marked as used |
16:37:34 | PMunch | And then it iterates over that and generates stuff |
16:37:43 | FromDiscord | <djazz> ah, so order is pretty much random? |
16:37:48 | PMunch | Yup |
16:38:28 | FromDiscord | <djazz> well, #define doesnt care about order anyway... |
16:39:18 | FromDiscord | <djazz> maybe try the template idea? |
16:39:37 | FromDiscord | <djazz> but im pretty sure it worked before, but then it maybe was just lucky with the hasing... |
16:39:42 | FromDiscord | <djazz> hashing |
16:42:32 | PMunch | @djazz, I've fixed it |
16:42:59 | FromDiscord | <djazz> nice |
16:43:42 | FromDiscord | <djazz> this is now #futhark channel xD |
16:47:07 | FromDiscord | <djazz> should I open an issue about const collision with enums? |
16:47:12 | FromDiscord | <djazz> for futhark |
16:47:41 | FromDiscord | <djazz> I'll try make a minimal example |
16:48:40 | PMunch | Hmm, is there no way to generate a `-d:somevar:somevalue` from config.nims? |
16:49:10 | FromDiscord | <djazz> switch("d", "somevar:somevalue") |
16:49:18 | FromDiscord | <djazz> I use it to set wifi ssid in my embedded thing |
16:50:11 | FromDiscord | <djazz> with `{.strdefine.}` |
16:52:04 | Amun-Ra | is there a way to detect config.nims is included when nim doc is running? |
16:53:18 | PMunch | @djazz, right |
16:53:37 | PMunch | @djazz, uploaded my fix now, and a test case for it ;) |
16:53:41 | Amun-Ra | (it's not "when defined nimdoc", that doesn't work in .nims) |
16:54:28 | FromDiscord | <djazz> tests, nice! |
16:55:25 | FromDiscord | <@thatrandomperson5-6310e3b26da03> thanks!↵(@auxym) |
16:55:55 | FromDiscord | <djazz> PMunch: it also fixed the U16t stuff i was seeing on first compile! |
16:56:07 | FromDiscord | <djazz> awesome |
16:56:16 | FromDiscord | <jtv> Yeah, the adoption of RST is weird. Markdown has the ecosystem, at this point, RST is only really for projects that have been using it for 20 plus years. They'd all use Markdown if starting over |
16:56:28 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4kA6 |
16:56:45 | Amun-Ra | or asciidoc |
16:56:47 | FromDiscord | <4zv4l> like any example on how I could do the same behavior but in Nim ?↵I would have to use sigaction ? |
16:56:51 | PMunch | @djazz, U16t stuff? |
16:56:58 | PMunch | Oh right, you had some weird bug |
16:57:04 | FromDiscord | <djazz> missing types on first build |
16:57:08 | FromDiscord | <jtv> I assume there's a wrapper in posix |
16:57:09 | FromDiscord | <djazz> order issue i guess |
16:57:16 | PMunch | Probably |
16:57:36 | FromDiscord | <jtv> or you can just directly wrap it yourself, since it's always going to be linked in, it's no big challenge |
16:57:48 | FromDiscord | <jtv> But I'm pretty sure it'll be in posix |
16:59:05 | FromDiscord | <djazz> PMunch: add the when not declared wrapper for consts outside enums and I'll be happy 😄 |
17:01:22 | Amun-Ra | btw, you can check config.nims was included by "nim doc" by checking getCommand() |
17:01:39 | PMunch | @djazz, do you have a minimal sample of that not working? If so please create an issue for it and I'll have a look at it after dinner |
17:01:49 | FromDiscord | <djazz> alright |
17:01:53 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4kA8 |
17:02:12 | PMunch | @djazz, are you aware of this? https://github.com/PMunch/futhark/issues/48 :P |
17:02:42 | FromDiscord | <djazz> neat |
17:02:54 | FromDiscord | <djazz> I did not read through all issues when looking for this lol |
17:02:58 | PMunch | I added this to config.nims for the tests: https://github.com/PMunch/futhark/blob/v0.7.1/tests/config.nims |
17:03:04 | PMunch | Should probably be updated to use that |
17:03:11 | FromDiscord | <djazz> yeah |
17:03:58 | FromDiscord | <djazz> make sure it gracefully fails on windows etc |
17:04:06 | FromDiscord | <djazz> aka empty path |
17:04:11 | FromDiscord | <djazz> staticExec should do that though |
17:04:50 | FromDiscord | <djazz> plus /include after the path, with correct dirSep |
17:07:56 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4kA9 |
17:17:46 | FromDiscord | <N4v> Just curious, is there a certain meaning to this Bible verse posted at the top of the Nim roadmap (https://github.com/nim-lang/RFCs/issues/503) ?↵↵See, I am sending an angel ahead of you to guard you along the way and to bring you to the place I have prepared. -- Exodus 23:20 |
17:19:53 | FromDiscord | <@thatrandomperson5-6310e3b26da03> Im trying to search and replace NimNodes, any got any ideas, mine seems to not work\: https://play.nim-lang.org/#ix=4kAc |
17:26:13 | * | pro joined #nim |
17:28:02 | * | pro left #nim (#nim) |
17:28:44 | FromDiscord | <djazz> In reply to @N4v "Just curious, is there": It's a roadmap, angel guarding us along the way to Nim 2.0 😄 |
17:45:14 | FromDiscord | <pyryrin> is in nim `when` like in c `#if` |
17:46:16 | FromDiscord | <demotomohiro> Yes. when statement only works at compile time. |
17:48:08 | FromDiscord | <djazz> PMunch: PR submitted, now dinner time for me 😄 |
18:01:42 | * | ltriant joined #nim |
18:06:13 | * | ltriant quit (Ping timeout: 252 seconds) |
18:40:13 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4kAt |
18:41:15 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=4kAt" => "https://play.nim-lang.org/#ix=4kAu" |
18:43:32 | FromDiscord | <Ailuros 💖🧡💛💚💙💜🖤> sent a code paste, see https://play.nim-lang.org/#ix=4kAv |
18:45:15 | FromDiscord | <Rika> In reply to @sOkam! "<@145405730571288577> you mentioned earlier": It is a pointer tuple essentially, the capacity is stored with the data chunk |
18:51:27 | FromDiscord | <jos> is there any way to forward declare types in nim? |
18:51:59 | PMunch | What do you mean @jos? |
18:52:00 | FromDiscord | <jos> sent a code paste, see https://play.nim-lang.org/#ix=4kAx |
18:52:05 | FromDiscord | <jos> they're in two separate files so i can't feasibly put them in the same type block |
18:52:45 | PMunch | Don't think it's possible across two separate files, no |
18:58:58 | FromDiscord | <jos> interesting, okay |
18:59:16 | FromDiscord | <jos> the only workaround i can think of is to make A generic and then specialize it under B |
18:59:40 | FromDiscord | <jos> sent a code paste, see https://play.nim-lang.org/#ix=4kAy |
18:59:41 | FromDiscord | <jos> i've done this workaround before |
18:59:45 | PMunch | That's a possibility, or place all your types in one file, and import that file in both modules |
19:00:04 | PMunch | What's up with the brackets by the way? |
19:00:10 | FromDiscord | <jos> oh |
19:00:14 | FromDiscord | <jos> i write too much rust |
19:00:30 | PMunch | Haha, okay |
19:00:56 | Zevv | https://github.com/nim-lang/rfcs/issues/6 |
19:06:32 | FromDiscord | <jos> that's a good read |
19:06:51 | FromDiscord | <jos> also unrelated, is there a way to make += and friends work with a setter |
19:06:57 | FromDiscord | <4zv4l> sent a long message, see http://ix.io/4kAB |
19:07:23 | FromDiscord | <jos> probably depends on your priorities |
19:07:30 | FromDiscord | <jos> you could argue either way |
19:08:14 | Zevv | Nim is pretty easy to get started with, which is both a virtue and a curse |
19:08:34 | Zevv | it's obviously nice because, well, it's easy to get started with nim because it's friendly and simeply and pythonish |
19:08:37 | FromDiscord | <4zv4l> so you think that even with Nim the `Python curse` will also happen ? |
19:08:37 | FromDiscord | <jos> personally i wouldn't push them towards nim just because the tooling isn't quite there yet imo |
19:08:55 | FromDiscord | <jos> like ideally they would be able to use a language server with autocomplete, and not have to deal with stuff like `make` or linkers or c compilers |
19:09:10 | Zevv | the curse part is that stuff is not actually always simple; when you learn C or Rust you are forst to actually understand what's happening under the hood. With Nim, you will run into stuff one day and realize you might not have truly understood what you were doing all the time |
19:09:32 | Zevv | s/forst/forced/ |
19:09:32 | FromDiscord | <4zv4l> In reply to @jos "like ideally they would": vscode doesn't have a plugin for Nim ? |
19:10:32 | FromDiscord | <jos> it does, but it's not that great |
19:10:33 | FromDiscord | <4zv4l> yes I understand, it's just for some I think C is too low level to start ↵they don't get result quickly enough↵same goes with Rust which is even worst to me with all the syntax you can get |
19:10:36 | FromDiscord | <jos> it's buggy |
19:10:58 | FromDiscord | <jos> i think c# is a really good first language-- the tooling is top-tier |
19:11:00 | FromDiscord | <4zv4l> like in high school in C we were making shape in the terminal to train our logic↵that's probably not what a person who wanna learn programming want to do xD |
19:11:05 | FromDiscord | <jos> and it's statically typed |
19:11:09 | FromDiscord | <jos> also unity uses c# |
19:11:13 | FromDiscord | <jos> so if they're into games that's a nice motivator |
19:11:18 | Zevv | 4zv4l: true; in that case nim could be a nice tradeoff. But if they have problems grasping low level things in python, that will not be any better with nim |
19:11:30 | Zevv | imho to truly understand nim, you need to understand C |
19:11:37 | FromDiscord | <jos> ^ i agree with that |
19:11:40 | FromDiscord | <jos> especially with the tooling |
19:11:44 | FromDiscord | <4zv4l> yeah I agree too actually |
19:11:48 | FromDiscord | <4zv4l> unfortunately |
19:12:20 | Zevv | 4zv4l: if have a writeup about how nim does basic memory management, if that is any help for them. |
19:12:33 | FromDiscord | <jos> with orc? |
19:12:36 | FromDiscord | <jos> and move semantics |
19:12:47 | Zevv | no, that part is yet to be written :) |
19:12:54 | FromDiscord | <4zv4l> well, they're chinese and learning English, can be a good exercise to learn both I guess |
19:12:59 | Zevv | it's the bare basics: stack, heap, seqs, objects, etc |
19:13:09 | FromDiscord | <4zv4l> oooh that would be great yeah |
19:13:11 | Zevv | https://zevv.nl/nim-memory/ |
19:13:45 | FromDiscord | <4zv4l> thanks ! |
19:13:48 | Zevv | yw |
19:13:49 | FromDiscord | <4zv4l> I'll check that |
19:13:55 | FromDiscord | <4zv4l> you made that in Markdown ? |
19:14:01 | Zevv | yes |
19:15:02 | FromDiscord | <4zv4l> do you mind if I ask for a pdf version ? I don't know if they can access it with the firewall there↵and making a pdf through my browser won't look amazing xD |
19:15:09 | Zevv | gimme a sec |
19:16:16 | Zevv | http://zevv.nl/div/nim-memory.pdf |
19:16:36 | FromDiscord | <4zv4l> thank you ! |
19:17:47 | Zevv | hm sorry that's old, let me convert the latest version |
19:18:51 | FromDiscord | <4zv4l> how do you convert the markdown with the css into pdf ?↵I try with pandoc but I'm not super used to that tool yet |
19:19:02 | Zevv | i forgot, i'm just figuring that out |
19:19:12 | FromDiscord | <4zv4l> oh alright xD |
19:20:21 | Zevv | new version is at the same url, please reload |
19:20:24 | Zevv | I used asciidoctor-pdf |
19:22:05 | FromDiscord | <4zv4l> oooh made in Ruby |
19:22:18 | FromDiscord | <4zv4l> I'll try compiling it myself and see how it goes |
19:22:20 | FromDiscord | <! Nilts> sent a code paste, see https://paste.rs/FYB |
19:25:56 | FromDiscord | <4zv4l> In reply to @Zevv "http://zevv.nl/div/nim-memory.pdf": thank you so much again ! really nice doc |
19:26:07 | FromDiscord | <! Nilts> In reply to @not logged in "Whats going on with": why is empty string trying to be an ident? |
19:50:19 | FromDiscord | <! Nilts> fixed it, compile time errors do be unheplful tho |
19:57:49 | FromDiscord | <jos> sent a code paste, see https://play.nim-lang.org/#ix=4kAI |
19:58:05 | FromDiscord | <jos> am i doing something wrong or does the method call syntax not work in this scenario |
19:58:31 | Zevv | https://nim-lang.github.io/Nim/manual.html#templates-limitations-of-the-method-call-syntax |
19:59:27 | Zevv | well, no, that's not related, is it |
19:59:34 | FromDiscord | <jos> yea |
19:59:43 | FromDiscord | <jos> it might be a limitation but i don't think it falls under one of those two |
19:59:48 | Zevv | right |
20:00:03 | FromDiscord | <Recruit_main707> iirc `discard 123.test[:string]()` worked |
20:00:15 | FromDiscord | <Recruit_main707> or smth like that |
20:01:01 | FromDiscord | <jos> weeeeeeeeeird |
20:01:03 | FromDiscord | <jos> why does that work? |
20:01:10 | FromDiscord | <jos> what does the colon do in that position |
20:06:03 | FromDiscord | <cow> sent a code paste, see https://play.nim-lang.org/#ix=4kAL |
20:07:00 | FromDiscord | <cow> I'm surprised the first example works, since you're passing an int to it and not a uint32 |
20:07:30 | FromDiscord | <cow> maybe the compiler can deduce that it's probably fine to assume you meant an uint32 123 in the first case? |
20:08:26 | FromDiscord | <cow> nevermind it doesn't help to specify that it's an uint32 |
20:09:08 | FromDiscord | <cow> but if you change the type of `ok` to `int` it works |
20:18:05 | Zevv | found it: https://nim-lang.github.io/Nim/manual.html#procedures-method-call-syntax |
20:18:07 | Zevv | bottom of the paragraph |
20:18:11 | Zevv | i knew it was in there |
20:18:16 | Zevv | "The method call syntax conflicts with explicit generic instantiations: p[T](x) cannot be written as x.p[T] because x.p[T] is always parsed as (x.p)[T]. |
20:18:19 | Zevv | See also: Limitations of the method call syntax. |
20:18:21 | Zevv | The [: ] notation has been designed to mitigate this issue: x.p[:T] is rewritten by the parser to p[T](x), x.p[:T](y) is rewritten to p[T](x, y). Note that [: ] has no AST representation, the rewrite is performed directly in the parsing step." |
20:18:45 | FromDiscord | <jos> interesting |
20:18:47 | FromDiscord | <jos> hmmm |
20:18:56 | FromDiscord | <jos> this messes with my api a little but i think i can fix it with a macro |
20:19:59 | FromDiscord | <cow> maybe this is a consequence of [] being both indexing and generics? |
20:20:27 | FromDiscord | <cow> since if you are indexing (p.x)[T] is the right precedence |
20:21:08 | FromDiscord | <huantian> In reply to @jos "this messes with my": you might want to consider using a `typedesc` arg i |
20:21:12 | FromDiscord | <huantian> that might be cleaner for your api |
20:21:18 | FromDiscord | <huantian> kinda like how jsony does it |
20:22:02 | * | pro joined #nim |
20:22:33 | * | pro left #nim (#nim) |
20:27:34 | FromDiscord | <Elegantbeef> It means tuple↵(@sOkam!) |
20:28:24 | FromDiscord | <Elegantbeef> The int is the capacity and the unchecked array is just the allocated block |
20:28:43 | FromDiscord | <Elegantbeef> I'm using endeveour os and it works ine↵(@ShalokShalom) |
20:28:45 | FromDiscord | <Elegantbeef> fine even |
20:40:41 | FromDiscord | <jos> is there any way to get the type from a generic arg in a macro? |
20:41:10 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "I'm using endeveour os": So you mean, out of the box? |
20:41:24 | FromDiscord | <ShalokShalom> Like, you didnt have to configure anything? |
20:42:21 | FromDiscord | <ShalokShalom> And you did that within the last 9 months, since the PR got merged? |
20:58:53 | FromDiscord | <pietroppeter> Hi @ElegantBeef are you planning on doing the this month with Nim Nov/Dec blogpost? I can help (e.g. doing the PR myself) if needed |
21:07:25 | * | jmdaemon joined #nim |
21:20:07 | * | genpaku quit (Read error: Connection reset by peer) |
21:20:51 | * | genpaku joined #nim |
21:27:51 | * | oprypin quit (Read error: Connection reset by peer) |
21:27:58 | * | oprypin_ joined #nim |
21:28:56 | FromDiscord | <Elegantbeef> Oh forgot that juan had so many packages, if you're offering to do it i'd be very thankful 😛↵(@pietroppeter) |
21:29:33 | FromDiscord | <Elegantbeef> What do you mean?↵(@jos) |
21:33:39 | FromDiscord | <jos> In reply to @Elegantbeef "What do you mean?": I wanted to use the inferred generic from a param i.e. macro zzz[T](x: T) |
21:33:49 | FromDiscord | <jos> I found getTypeInst and that worked |
21:43:25 | * | knallvar joined #nim |
21:53:39 | PMunch | @Elegantbeef, just added a `-d:nodeclguards` switch to Futhark which gives you that readable output you've been asking for |
21:54:00 | PMunch | https://github.com/PMunch/futhark/tree/v0.7.2#compatibility-features-and-readability |
21:56:10 | FromDiscord | <Elegantbeef> We did it, bitching and moaning works! 😛 |
22:03:27 | * | knallvar quit (Quit: knallvar) |
22:13:48 | PMunch | Just took what? 7 versions? |
22:14:03 | FromDiscord | <⚶ Zeno> In reply to @Elegantbeef "We did it, bitching": i enter in this server and this is the first thing i see |
22:14:06 | FromDiscord | <⚶ Zeno> LMAO |
22:16:23 | FromDiscord | <planetis> nice |
22:17:51 | PMunch | Damn it, I was supposed to just check out a PR for Futhark this morning before doing what I was going to do. But now I've spent the entire day on Futhark.. |
22:18:44 | FromDiscord | <Elegantbeef> You're welcome/sorry |
22:19:16 | PMunch | Oh that's not your fault, @djazz is the one who made the PR, I blame them |
22:21:06 | FromDiscord | <djazz> Awesome! |
22:21:37 | FromDiscord | <djazz> At this rate, futhark 2.0 will release before nim 2.0 😉 |
22:21:48 | PMunch | Haha, Futhark isn't even 1.0 :P |
22:21:56 | PMunch | I guess it's getting stable enough though |
22:22:02 | FromDiscord | <djazz> 😄 |
22:22:53 | FromDiscord | <Elegantbeef> This is where i bring up the `#define own` |
22:23:04 | PMunch | At least it's better than c2nim and nimterop :) |
22:23:12 | PMunch | @Elegantbeef, don't you dare! |
22:23:21 | PMunch | You'll ruin tomorrow as well at this rate |
22:23:40 | PMunch | That was the varargs issue wasn't it? |
22:23:56 | FromDiscord | <Elegantbeef> Yea clang thinks the procedure is varargs |
22:23:59 | PMunch | I don't think that's fixable in Nim unfortunately, seems like a clang bug |
22:24:06 | FromDiscord | <Elegantbeef> I dont think you can really fix it aside from making an issue with libclang |
22:26:07 | FromDiscord | <djazz> Would be nice to have control over where the generated nim code goes, instead of cache |
22:26:57 | FromDiscord | <djazz> To be able to import it directly |
22:26:59 | FromDiscord | <Elegantbeef> djazz is literally just me |
22:27:09 | PMunch | @djazz, PRs welcome :P |
22:27:21 | PMunch | Why would you import it though? |
22:27:30 | FromDiscord | <djazz> ElegantBeef, you make PR 🙂 |
22:27:34 | PMunch | importc automatically includes it |
22:27:36 | FromDiscord | <Elegantbeef> Lol |
22:27:59 | PMunch | Would be a super simple one-liner on line 518 |
22:28:02 | FromDiscord | <djazz> I dont get syntax highlight etc with futhark importc |
22:28:10 | PMunch | Hmm, strange |
22:28:10 | FromDiscord | <Elegantbeef> Pmunch as much as you dislike it most people would like to be able to ship the bindings 😄 |
22:28:20 | FromDiscord | <Elegantbeef> https://github.com/beef331/miniaudio/blob/master/src/miniaudio.nim#L4-L10 is a bit annoying |
22:28:23 | PMunch | I do, as long as the module is in cache before I open my editor :P |
22:28:58 | PMunch | Why is that annoying? It's the best of both worlds |
22:29:13 | FromDiscord | <djazz> In my case, the bindings depend heavily on a header file with flags on what to include, so it cant be committed |
22:29:14 | FromDiscord | <Elegantbeef> Cause i have to manually copy the file |
22:29:52 | PMunch | Now users who don't have clang/futhark installed can just use that, and if you want to add an extra define or use an updated version of the C library they can just throw that switch and you don't have to do anything |
22:30:19 | PMunch | @Elegantbeef, oh you want a -d:putmyfutharkfilehere:futharkminaudio.nim switch? |
22:31:05 | FromDiscord | <djazz> -d:elegantpath:miniaudio.nim |
22:31:08 | FromDiscord | <Elegantbeef> The annoying part is that i have to manually copy the file like it's the year 2001 😛 |
22:31:09 | FromDiscord | <Elegantbeef> Yes yes PRs welcome |
22:31:19 | FromDiscord | <ted__> sent a code paste, see https://play.nim-lang.org/#ix=4kB6 |
22:31:27 | FromDiscord | <Elegantbeef> A bit simpler pmunch |
22:31:39 | FromDiscord | <Elegantbeef> Just a \`outputPath "somePath" |
22:31:41 | PMunch | Yeah I guess that would be nice |
22:31:54 | FromDiscord | <Elegantbeef> Ted\_ you need a new name for the fields |
22:32:02 | PMunch | It would be super easy to implement, just saying |
22:32:03 | FromDiscord | <Elegantbeef> Field names cannot overlap |
22:32:36 | FromDiscord | <ted__> ok, thanks Elegantbeef, yeah that feels like the only option now, but it's making the code kind of gross |
22:32:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4kB7 |
22:33:07 | FromDiscord | <Elegantbeef> I guess that should be `raiseAssert` |
22:33:52 | FromDiscord | <Elegantbeef> A macro/template could be used to make it a bit less redundant |
22:34:06 | PMunch | TIL raiseAssert |
22:34:25 | FromDiscord | <ted__> hmm, I'll have to think about using a template for pulling out the appropriate field given the `kind` |
22:35:03 | FromDiscord | <ted__> oh, but the `proc x` you defined might work in most of the cases and at least centralizes it |
22:35:16 | FromDiscord | <sOkam!> In reply to @ted__ "I hit a dead-end": I use different names, with aliases for the real names i want to access |
22:36:21 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4kB8 |
22:36:22 | FromDiscord | <sOkam!> you can also do `x=` and assign the value with `x = thing` |
22:36:30 | FromDiscord | <Elegantbeef> Anyway it's kinda redundant |
22:36:53 | FromDiscord | <Elegantbeef> Also need a getter that is `proc x(dim: var DimensionalShape): var int` |
22:37:13 | FromDiscord | <Elegantbeef> But with those you can relatively easily get the desired api with the same safety that Nim provides |
22:37:48 | FromDiscord | <Elegantbeef> Like you said you can make a template to generate getter and setters |
22:38:02 | FromDiscord | <ted__> thanks, those look like the alternatives I was looking for and are cleaner than what I was trying. Hope that RFC gets implemented at some point, but this seems like the best way till then |
22:39:15 | FromDiscord | <Elegantbeef> Shit |
22:39:15 | FromDiscord | <Elegantbeef> 😄 |
22:39:17 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4kB9 |
22:40:30 | FromDiscord | <Elegantbeef> There we go |
22:40:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4kBa |
22:40:38 | FromDiscord | <Elegantbeef> \Add a export marker if you want |
22:41:07 | FromDiscord | <Elegantbeef> Also add a `{.inline.}` if you're really anal |
22:42:21 | FromDiscord | <ted__> wrapping my brain around that now 😀 |
22:42:34 | FromDiscord | <Elegantbeef> Shit i messed that up |
22:42:44 | FromDiscord | <Elegantbeef> There we go |
22:42:48 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4kBc |
22:44:49 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4kBd |
22:44:50 | FromDiscord | <Elegantbeef> Run this code locally and see what `genProps` makes |
22:45:44 | FromDiscord | <ted__> ok, got it, so that'll put the `xVal`, `yVal`, and `zVal` fields as private ones on all variants, but the templates could then be made public so that code calling it would only have access to the `x`, `y`, and `z` generated `proc`s |
22:45:53 | FromDiscord | <Elegantbeef> Yep |
22:46:24 | FromDiscord | <Elegantbeef> Unless you really need the memory savings that a union gives you this is fine |
22:46:43 | FromDiscord | <Elegantbeef> If you need the memory savings then using branches inside the object with accessors is the best you can do in Nim |
22:47:36 | FromDiscord | <ted__> for the real use case I'm looking at right now there are really only a very few (or even one) of these objects that'd be instantiated at any one time, so this totally works |
22:48:17 | FromDiscord | <Elegantbeef> Say you have a 4th branch that doesnt have x,y,z. It has it's own string and whatever else |
22:48:19 | FromDiscord | <Elegantbeef> When you use branches in the typedef there is a hidden union that allows memory to overlap so the type is just the size of the largest branch |
22:48:34 | FromDiscord | <Elegantbeef> Which is partially why you cannot reuse field names |
22:49:14 | FromDiscord | <Elegantbeef> When you can reuse field names you basically need to generate a check of X branches to figure out which offset you actually want |
22:50:00 | FromDiscord | <Elegantbeef> Luckily no one has suggested reusing different field names with different types |
22:50:30 | FromDiscord | <Elegantbeef> That's a complex beast that requires a rust style "To access fields we have to do it inside a concrete pattern" |
22:53:43 | FromDiscord | <ted__> In reply to @Elegantbeef "Luckily no one has": I did see on the RFC that using different types (rust-style) was a suggestion that was had: https://github.com/nim-lang/RFCs/issues/368#issuecomment-820701871↵↵and that seems to be why at least some folks are pushing against the current syntax proposal. That's not something I've needed. But in the short time that I've been using Nim, I've hit this limitation for variants to share a fie |
22:54:46 | FromDiscord | <Elegantbeef> I see i forgot about the entire contents of the RFC 😄 |
23:02:40 | FromDiscord | <pietroppeter> In reply to @Elegantbeef "Oh forgot that juan": Yep no problem, will do it! |
23:28:57 | * | PMunch quit (Quit: leaving) |