00:00:07 | FromDiscord | <Elegantbeef> Hmm seems kate isnt sending a save lsp message |
00:00:09 | PMunch | If you have a broken Nim installation then sure |
00:00:17 | PMunch | @Elegantbeef, well that's silly of it |
00:01:57 | FromDiscord | <Elegantbeef> Yea the only instance of the word (s \| S)ave is in the intialize request |
00:02:43 | PMunch | The problem is that asking nimsuggest for diagonstics is kinda slow.. |
00:02:52 | PMunch | That's why it's only done on save |
00:03:03 | FromDiscord | <Elegantbeef> I mean i know that |
00:03:06 | PMunch | I guess a "if has been able for x seconds" test could be added as well |
00:03:11 | FromDiscord | <luteva> In reply to @Alea "I think I originally": as pmunch said: If you have a broken Nim installation then sure.↵I think many windows guys try it with a new/clean installation whenever "something is wrong". but i do not know. |
00:03:38 | FromDiscord | <Elegantbeef> It's a case of even with saves there is no diagnostic information being exchanged so something somewhere isnt happy |
00:04:40 | FromDiscord | <Elegantbeef> But go back to elden ring i'll toy around |
00:05:13 | PMunch | No worries, I die so frequently that I'm typing while it reloads :P |
00:05:19 | PMunch | I've been playing the whole time |
00:05:38 | PMunch | But do you get the save notification in NimLSP? |
00:05:45 | FromDiscord | <Elegantbeef> No |
00:05:55 | PMunch | Without it it won't send diagnostics, no matter if the file is saved |
00:06:28 | PMunch | So you either need to get Kate to send save notifications, or you need to implement something in NimLSP that sends diagnostics without it |
00:21:03 | PMunch | Well, that's enough gaming for tonight |
00:21:16 | PMunch | Remind me tomorrow about the LSP thing and I'll have a look at it |
00:21:32 | * | PMunch quit (Quit: leaving) |
00:27:33 | FromDiscord | <Elegantbeef> I wonder if it's just my kate is outdated |
00:27:43 | FromDiscord | <Elegantbeef> The source code seems to say i should get different information |
00:39:38 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/957076327805091900/image.png |
00:39:44 | FromDiscord | <Elegantbeef> Pmunch it was ubuntu's fault! |
00:39:48 | FromDiscord | <Elegantbeef> This entire time 😛 |
00:40:17 | FromDiscord | <Elegantbeef> Downloaded the nighly appimage and boom just worked |
00:48:41 | FromDiscord | <Bubblie> is it possible to ping people on IRC |
00:48:48 | FromDiscord | <Elegantbeef> Yea you say their name |
00:58:10 | FromDiscord | <Bubblie> FINALLY |
00:58:13 | FromDiscord | <Bubblie> I got futhark installed |
00:58:15 | FromDiscord | <Bubblie> FUCK YOU WINDOWS |
00:58:19 | FromDiscord | <Bubblie> holy shit |
00:58:26 | FromDiscord | <Elegantbeef> Congrats |
00:58:33 | FromDiscord | <Bubblie> thank you |
00:59:15 | FromDiscord | <Bubblie> PMunch, you should add this as a disclaimer for windows users to help, they should use this command specifically, also restarting your computer before this helps LMAO |
00:59:26 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix= |
00:59:48 | FromDiscord | <Elegantbeef> You can PR it 😛 |
00:59:53 | FromDiscord | <Bubblie> (edit) |
00:59:55 | FromDiscord | <Bubblie> oh right |
01:00:03 | FromDiscord | <Bubblie> let me just do that |
01:09:07 | FromDiscord | <Bubblie> okay |
01:09:08 | FromDiscord | <Bubblie> pr is done |
01:17:57 | FromDiscord | <Bubblie> how do I check what libraries I have installed |
01:17:58 | FromDiscord | <Bubblie> for nim |
01:18:17 | FromDiscord | <Elegantbeef> `nimble list --installed` |
01:18:19 | FromDiscord | <Bubblie> thanks |
01:19:12 | FromDiscord | <Bubblie> weird, vulkanim is installed but it is saying it cannot open the file when I go to import it |
01:19:23 | FromDiscord | <Elegantbeef> How are you building? |
01:20:47 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=3TtN |
01:20:50 | FromDiscord | <Elegantbeef> How are you importing? |
01:20:59 | FromDiscord | <Bubblie> (edit) "https://play.nim-lang.org/#ix=3TtN" => "https://play.nim-lang.org/#ix=3TtO" |
01:21:03 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix= |
01:21:16 | FromDiscord | <Elegantbeef> `vulkanim/vulkan` |
01:21:32 | FromDiscord | <Bubblie> thanks! |
01:21:38 | FromDiscord | <Bubblie> that worked |
01:21:43 | FromDiscord | <Elegantbeef> Of course it did |
01:22:01 | FromDiscord | <Bubblie> bit confused as to why though, I thought I would just need to do vulkanim since vulkan is the only thing there |
01:22:12 | FromDiscord | <Elegantbeef> cause it's inside a vulkanim folder |
01:22:13 | FromDiscord | <Bubblie> unlike nimgl where it is nimgl/vulkan |
01:22:13 | FromDiscord | <Elegantbeef> Whyelse |
01:22:19 | FromDiscord | <Bubblie> In reply to @Elegantbeef "cause it's inside a": ah okay nvm |
01:39:49 | FromDiscord | <System64 ~ Flandre Scarlet> How can I make a nimble package please? |
01:40:20 | FromDiscord | <Elegantbeef> Submit your github repo to `nim-lang/packages` |
01:40:37 | FromDiscord | <Elegantbeef> If you mean how to actually make it compliant do `nimble init` |
01:40:47 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright |
01:41:17 | FromDiscord | <System64 ~ Flandre Scarlet> In fact I want to Nimble that https://media.discordapp.net/attachments/371759389889003532/957091842279735376/unknown.png |
01:41:18 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix= |
01:41:55 | FromDiscord | <Bubblie> sent a code paste, see https://paste.rs/dLJ |
01:42:05 | FromDiscord | <Bubblie> I tried adding an extra slash |
01:42:16 | FromDiscord | <Bubblie> but it isn't properly reading that |
01:45:22 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "If you mean how": should I include the DLL with the nimble package? |
01:45:28 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix= |
01:45:35 | FromDiscord | <Bubblie> it might be related to linux paths and slash usage |
01:45:44 | FromDiscord | <Elegantbeef> No you shouldnt include a dll with the nimble package |
01:45:46 | FromDiscord | <Elegantbeef> Link to how to get it |
01:46:08 | FromDiscord | <System64 ~ Flandre Scarlet> Alright |
01:48:39 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "No you shouldnt include": Okay so I think I created the package, now I guess I have to commit? |
01:50:28 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/packages#adding-your-own-package |
01:56:05 | FromDiscord | <System64 ~ Flandre Scarlet> aaaah alright |
02:01:31 | FromDiscord | <System64 ~ Flandre Scarlet> is that a problem? https://media.discordapp.net/attachments/371759389889003532/957096930972926002/unknown.png |
02:01:52 | FromDiscord | <Elegantbeef> General windows issue |
02:02:09 | FromDiscord | <System64 ~ Flandre Scarlet> so it's bad? |
02:02:19 | FromDiscord | <Elegantbeef> It's not that ba afaik |
02:02:30 | FromDiscord | <Elegantbeef> bad\ |
02:02:46 | * | yiggityswaps joined #nim |
02:02:59 | FromDiscord | <Elegantbeef> Modern unix and windows disagree on what ends a line so it causes tedium for VCS |
02:05:10 | FromDiscord | <System64 ~ Flandre Scarlet> https://github.com/system64MC/NimTilengine↵Okay is it good? |
02:05:57 | * | yoyojambo quit (Ping timeout: 252 seconds) |
02:06:39 | FromDiscord | <Patitotective> Can I somehow include some files directly into the shared library nim's compiler outputs? |
02:06:49 | FromDiscord | <Patitotective> Like resources |
02:19:23 | FromDiscord | <Sabena Sema> you can use `slurp` |
02:19:26 | FromDiscord | <Sabena Sema> and `gorge` |
02:19:43 | FromDiscord | <Sabena Sema> you can also use a linker script when you link |
02:20:08 | FromDiscord | <Sabena Sema> slurp and gorge might technically be better though, as theoretically they give the compiler access to the data for constant folding and the like |
02:20:55 | FromDiscord | <Sabena Sema> you can call them `staticRead` and `staticExec` if you don't like fun |
02:23:32 | FromDiscord | <Patitotective> 🙃 |
02:23:34 | FromDiscord | <Patitotective> Thanks |
02:27:18 | FromDiscord | <Patitotective> But what do I do with the data I get? Like I need to `stbi.load(path, width, height, channels, stbi.Default)`↵There should be another procedure that accepts the file data or? |
02:27:43 | nrds | <Prestige99> Hey beef |
02:27:48 | FromDiscord | <Elegantbeef> Hello |
02:28:16 | FromDiscord | <Patitotective> In reply to @Patitotective "But what do I": Like to read the pixels from the "image data" |
02:28:24 | nrds | <Prestige99> Is your engine open source? Wanted to see how you're doing 3d |
02:28:49 | FromDiscord | <Elegantbeef> https://github.com/beef331/truss3d |
02:29:05 | nrds | <Prestige99> Tyty |
02:29:30 | FromDiscord | <System64 ~ Flandre Scarlet> https://github.com/system64MC/NimTilengine↵Okay it works! |
02:30:59 | FromDiscord | <Elegantbeef> I still need to do a lot for it, but that's pretty much it |
02:31:42 | nrds | <Prestige99> I've only ever tried 2D, my engine is coming along well but I was curious :P |
02:32:53 | FromDiscord | <Elegantbeef> Ah |
02:34:56 | FromDiscord | <Elegantbeef> It's a very hands off api, it's more like raylib than an engine |
02:47:16 | * | Guest2 joined #nim |
02:49:01 | * | Guest2 quit (Client Quit) |
02:51:13 | FromDiscord | <Bubblie> is there any projects with futhark I can look at |
03:18:05 | * | fowl quit (Quit: cya pals) |
03:19:11 | FromDiscord | <Sabena Sema> In reply to @Patitotective "Like to read the": you can just stick the image data in a variable of some description, whatever is nim's version of C const |
03:19:19 | FromDiscord | <Sabena Sema> let I suppose |
03:19:38 | FromDiscord | <Sabena Sema> I think that'll go in .rodata |
03:20:14 | FromDiscord | <Elegantbeef> `const myImageData = staticRead("myImage.png")` |
03:23:43 | FromDiscord | <Elegantbeef> You arent really going to be able to store the loaded PNG at compile time, so yea use that to static read the at runtime convert it to your desired file |
03:24:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Tu4 |
03:24:38 | FromDiscord | <Elegantbeef> `loadFromData` is your runtime procedure that takes in the binary data and loads it into your desired format |
03:25:02 | FromDiscord | <Elegantbeef> If it does require using a path use memfiles and store the image there |
03:27:16 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Tu5 |
03:34:10 | FromDiscord | <Patitotective> sent a code paste, see https://paste.rs/miI |
03:35:15 | FromDiscord | <Elegantbeef> I guess the template could just return the image, sometimes i amaze myself 😛 |
03:35:19 | FromDiscord | <Elegantbeef> I mean i dont know what the issue is |
03:38:25 | FromDiscord | <Patitotective> aren't there other bin2png libraries? |
03:39:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/I5f |
03:39:42 | FromDiscord | <Elegantbeef> Then you can do `let (myImage, width, height, channels) = loadStatically("myImage.png")` |
03:41:09 | FromDiscord | <Elegantbeef> If that doesnt work for you please explain why |
03:42:43 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Tu8 |
03:43:07 | FromDiscord | <Elegantbeef> What stb library are you using? |
03:43:09 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3Tu8" => "https://play.nim-lang.org/#ix=3Tu9" |
03:43:24 | FromDiscord | <Patitotective> `stb_image` https://github.com/define-private-public/stb_image-Nim |
03:44:43 | FromDiscord | <Elegantbeef> then just do `cast[seq[byte]](data)` since they wanted to be so bullheaded about it |
03:47:54 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Tua |
03:48:27 | FromDiscord | <Elegantbeef> change them from cint |
03:48:28 | FromDiscord | <Elegantbeef> to `int` |
03:48:40 | FromDiscord | <Elegantbeef> You also dont need to pass length |
03:49:01 | FromDiscord | <Patitotective> In reply to @Elegantbeef "You also dont need": wdym |
03:49:10 | * | yiggityswaps quit (Quit: Leaving) |
03:49:18 | FromDiscord | <Elegantbeef> `loadFromMemory(buffer: seq[byte]; x, y, channels_in_file: var int; desired_channels: int)` |
03:49:22 | FromDiscord | <Elegantbeef> Read the proc you're invoking |
03:49:27 | FromDiscord | <Elegantbeef> It doesnt take in length it gets it from the sequence |
03:49:38 | * | yoyojambo joined #nim |
03:50:32 | FromDiscord | <Patitotective> 🤩 |
03:50:34 | FromDiscord | <Patitotective> thanks |
03:50:35 | FromDiscord | <Patitotective> 🙃 |
04:07:51 | * | ltriant_ joined #nim |
04:09:06 | FromDiscord | <Patitotective> now the thing is that if i put that procedure in a `src/utils.nim` file and i call it from my main module the path won't be the same since, it would be `src/icon.png` and i want `icon.png` |
04:09:12 | FromDiscord | <Patitotective> is there a way to avoid that? |
04:09:24 | * | ltriant quit (Ping timeout: 240 seconds) |
04:20:32 | * | rockcavera quit (Remote host closed the connection) |
04:44:25 | * | slowButPresent quit (Quit: leaving) |
06:02:55 | * | yoyojambo quit (Read error: Connection reset by peer) |
06:33:53 | * | jmd_ quit (Ping timeout: 256 seconds) |
06:38:25 | * | ltriant_ quit (Ping timeout: 256 seconds) |
07:19:41 | * | ltriant joined #nim |
08:53:47 | * | pro joined #nim |
08:56:06 | * | dtomato quit (Quit: The Lounge - https://thelounge.chat) |
08:56:54 | * | dtomato joined #nim |
08:57:38 | * | dtomato quit (Client Quit) |
08:58:23 | * | dtomato joined #nim |
09:15:57 | * | pro quit (Ping timeout: 240 seconds) |
09:33:26 | * | PMunch joined #nim |
10:00:31 | * | wyrd quit (Remote host closed the connection) |
10:00:50 | * | wyrd joined #nim |
10:27:43 | * | ltriant quit (Ping timeout: 260 seconds) |
10:33:59 | * | pro joined #nim |
10:50:34 | NimEventer | New thread by Luyimoon: Excuse me, how to loop and output each character of the Chinese string?, see https://forum.nim-lang.org/t/9047 |
11:03:39 | * | Gustavo6046 joined #nim |
11:04:58 | * | Gustavo6046 quit (Remote host closed the connection) |
11:05:16 | * | Gustavo6046 joined #nim |
11:10:20 | * | ltriant joined #nim |
11:19:42 | FromDiscord | <Bung> The packed pragma can be applied to any object type. It ensures that the fields of an object are packed back-to-back in memory.↵what does this mean ? "packed back-to-back in memory" |
11:21:03 | PMunch | It means that if you have a char, a char, and an int it will take 10 bytes on a x64 machine and not 16 bytes it would usually take with alignment |
11:28:38 | FromDiscord | <Bung> sorry ,not 6 bytes right ? |
11:29:12 | FromDiscord | <Bung> where 16 bytes coming from |
11:29:16 | FromDiscord | <demotomohiro> !eval echo sizeof(int) |
11:29:18 | NimBot | 8 |
11:31:35 | FromDiscord | <demotomohiro> Padding can be added to 2/4/8 bytes types in object type so that they are placed in multiple of 2/4/8 address. |
11:32:10 | FromDiscord | <demotomohiro> !eval echo sizeof ('a', 'b', 1'i64) |
11:32:12 | NimBot | 16 |
11:36:38 | FromDiscord | <Bung> why there are padding |
11:37:04 | FromDiscord | <Rika> It is more efficient for the processor |
11:37:12 | FromDiscord | <Rika> Processors read words |
11:37:21 | FromDiscord | <Rika> So a 64 bit processor reads 64 bits at a time |
11:37:48 | FromDiscord | <Rika> It would be annoying to use two reads for an integer because there were two bytes used before it |
11:42:04 | supakeen | You get a free short! |
11:44:40 | FromDiscord | <demotomohiro> !eval echo sizeof (1'i64, 'a', 'b') |
11:44:42 | NimBot | 16 |
11:44:48 | supakeen | Honestly, a lot of this is also just based on previous simpler processor designs and simplifications. |
11:46:17 | supakeen | For example I know that Intel unaligned reads are basically free unless they cross a cache line. |
11:46:20 | FromDiscord | <Bung> I think I need a example to understand how the type padding added and how the processors read |
11:46:57 | supakeen | You're not dealing with padding here, Bung. |
11:47:15 | supakeen | You're dealing with a fixed-width type, an i64 or a 64-bit integer, which is always 64-bits and thus 8 bytes. |
11:47:20 | FromDiscord | <auxym> out of curiosity... what's the failure mode of ARC in the presence of cycles? Does it simply fail to collect refs that are part of the cycle? Or will it attempt to collect stuff that's in use and segfault? Or cause an infinite loop / infinite copies / set my computer on fire? |
11:47:24 | supakeen | If you have two of them you always have 16 bytes. |
11:48:18 | supakeen | Now if you have structs it's normal for those to be padded to a multiple of the largest type. |
11:49:21 | FromDiscord | <demotomohiro> echo sizeof (1'i64, 2'i8, 3'i64, 4'i8), ", ", sizeof (1'i64, 3'i64, 4'i8, 2'i8)↵Most of case, padding are added so that 4 byte types are placed on multiple of 4 address and so 8 byte types. |
11:49:25 | supakeen | But again this is both compiler and architecture dependent if it needs to be done, and is not usually something one worries about. |
11:49:29 | supakeen | Unless you do really bad things. |
11:49:30 | FromDiscord | <demotomohiro> !eval echo sizeof (1'i64, 2'i8, 3'i64, 4'i8), ", ", sizeof (1'i64, 3'i64, 4'i8, 2'i8) |
11:49:32 | NimBot | 32, 24 |
11:51:02 | supakeen | Reminds me of the old C best practice of reverse-sorting your structs by size for the least amound of waste 🙂 |
11:51:55 | FromDiscord | <Rika> In reply to @auxym "out of curiosity... what's": Cycles do not get collected; if you make more you hit memory limits |
11:52:18 | FromDiscord | <Rika> If the program ends there will be memory that isn’t freed |
11:52:41 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3TvQ |
11:52:58 | FromDiscord | <Rika> No crashing or freezing yes |
11:53:10 | FromDiscord | <auxym> right. so if I have cycles involving objects that have a lifetime equal to the lifetime of the program it shouldn't cause an issue |
11:53:37 | FromDiscord | <Rika> It would if your operating system is dumb and not freeing memory on end |
11:53:50 | FromDiscord | <Rika> So don’t try it on embedded I guess? |
11:54:47 | FromDiscord | <auxym> well, on embedded (bare metal micros), lifetime of the program = time that the system is powered on. everything is "freed" on a reset / power down 😉 |
11:55:48 | FromDiscord | <Rika> Well sometimes it’s important to free on end anyway |
11:55:51 | FromDiscord | <auxym> thanks for the info on arc btw 👍 |
11:56:09 | FromDiscord | <Rika> ORC could still work on embedded |
11:56:18 | FromDiscord | <Rika> You just lose determinism |
11:56:24 | FromDiscord | <Rika> Might be important for you |
11:56:25 | FromDiscord | <auxym> the cycle collector is run time overhead though, no? |
11:56:26 | FromDiscord | <auxym> yeah |
11:57:24 | FromDiscord | <auxym> i'm toying around with writing a scheduler fyi, which is a global that is always alive (obviously, sort of like an OS), but avoiding cycles is sorta hard |
11:57:51 | FromDiscord | <auxym> might have to resort to manual MM for some of the low level details |
12:01:59 | FromDiscord | <mratsim> In reply to @auxym "the cycle collector is": Only for types that may have cycles, and the collection is still inserted at deterministic location, it's the duration of collection that is non-deterministic< |
12:02:04 | FromDiscord | <mratsim> (edit) "non-deterministic<" => "non-deterministic." |
12:02:38 | FromDiscord | <auxym> In reply to @mratsim "Only for types that": interesting, ty. so can I see where's it's inserted with expandArc? |
12:03:04 | FromDiscord | <Bung> In reply to @demotomohiro "!eval echo sizeof (1'i64,": thanks , this good example, so thats 4 8 and 28 + 1 8 |
12:03:14 | FromDiscord | <mratsim> In reply to @auxym "interesting, ty. so can": Probably, I didn't look much in Nim implementation, I refer to the original Bacon and Dingle paper |
12:03:33 | FromDiscord | <Bung> (edit) "28" => "2 8" | "1" => "1 " |
12:04:16 | FromDiscord | <mratsim> In reply to @auxym "i'm toying around with": where would you have cycles in a scheduler? Your tasks are a direct acyclic graphs |
12:04:58 | FromDiscord | <mratsim> actually a tree |
12:05:13 | FromDiscord | <mratsim> only one parent can spawn a task. |
12:05:47 | FromDiscord | <auxym> scheduler has a ref to tasks, but tasks have a ref to the scheduler so that they can make "syscalls" (yield, acquire lock, etc) |
12:14:38 | NimEventer | New Nimble package! nimlangserver - The Nim language server implementation (based on nimsuggest), see https://github.com/nim-lang/langserver |
13:18:31 | * | Gustavo6046 quit (Ping timeout: 260 seconds) |
13:32:40 | * | wyrd quit (Remote host closed the connection) |
13:32:55 | * | wyrd joined #nim |
13:41:07 | * | rockcavera joined #nim |
13:41:07 | * | rockcavera quit (Changing host) |
13:41:07 | * | rockcavera joined #nim |
14:30:27 | * | mahlon quit (Ping timeout: 256 seconds) |
14:49:51 | FromDiscord | <Patitotective> Is there a compile-time version of the `getCurrentDir()` procedure? https://nim-lang.org/docs/os.html#getCurrentDir↵Like, get the current directory of the nim module and not the binary |
14:54:36 | FromDiscord | <Phil> You want the directory path that the project is in at compile time to use it at runtime? |
14:54:48 | FromDiscord | <Phil> (edit) "You want ... the" added "to hard-code" |
14:54:48 | FromDiscord | <Rika> https://nim-lang.org/docs/macros.html#getProjectPath |
14:55:10 | FromDiscord | <Patitotective> In reply to @Isofruit "You want to hard-code": i think lol |
14:56:22 | FromDiscord | <Patitotective> It's just that in my `main.nim` module I've got the `const` icon path and I want it to be an absolute path since I need to pass it to `src/utils.nim` to read it and get the pixels↵If it's not absolute it would look for it inside `src/` |
14:56:46 | FromDiscord | <spoon> isnt there a way to bake assets into a binary? |
14:57:06 | FromDiscord | <Phil> Hmm I solved that kind of things with a settings file I read in on startup rather than hard-code it into the binary, but I also deal with web-applications rather then actual user applications |
14:57:25 | FromDiscord | <Phil> (edit) "things" => "thing" |
14:58:19 | FromDiscord | <Patitotective> In reply to @Isofruit "Hmm I solved that": but you needed to have the actual file next to the binary i dont want that |
14:58:26 | FromDiscord | <Patitotective> (edit) "In reply to @Isofruit "Hmm I solved that": but you needed to have the actual file next to the binary ... i" added "(?)" |
14:59:44 | FromDiscord | <Phil> You mean the settings file? Yeah that file will need to be at some pre-defined, hard-coded location. But it's a single path rather than multiple paths and gives you a central place for all variable settings you may want to change |
14:59:55 | FromDiscord | <Patitotective> In reply to @spoon "isnt there a way": slurp? https://nim-lang.org/docs/system.html#slurp%2Cstring |
15:00:49 | FromDiscord | <Patitotective> In reply to @Isofruit "You mean the settings": i mean that in the settings file you have the icon path, so that icon path needs to be next to binary (?) |
15:01:37 | FromDiscord | <Phil> In reply to @Patitotective "i mean that in": You can change the icon path to whatever you want at whatever time you want after the binary is compiled. Meanwhile once the binary is compiled you're stuck with whatever is in the binary |
15:01:44 | FromDiscord | <Phil> (edit) "In reply to @Patitotective "i mean that in": You can change the icon path ... to" added "in the settings file" |
15:01:58 | FromDiscord | <Phil> The settings file is not part of your binary, it just gets read in by your binary when you use the binary |
15:02:22 | FromDiscord | <Patitotective> and what is that settings file? ini, toml, yaml, json? |
15:04:09 | FromDiscord | <Phil> I mean, you can pretty much use whatever you want. Depending on which dependencies you have, some might come with easier setup than others.↵Prologue for example by default uses a JSON file as settings file, thus using that is trivial.↵If you have no such framework that makes a semi-opinionated suggestion to you, you can use whatever file-format you find easy to parse/have a simple parser for |
15:04:51 | FromDiscord | <Patitotective> https://patitotective.github.io/niprefs lul |
15:06:28 | FromDiscord | <Phil> The way I use settings files (which I think is the normal way (?) ) is that pretty much everything you might want to swap up after compilation (typical config settings like where is what resource folder, flags of sorts to enable/disable certain behaviours etc., secret keys for cryptography) goes in there |
15:07:00 | FromDiscord | <Patitotective> Thanks 🙃 |
15:07:52 | FromDiscord | <Phil> What are "preferences" in your eyes? |
15:09:34 | FromDiscord | <Patitotective> sent a code paste, see https://paste.rs/N8q |
15:10:04 | FromDiscord | <Phil> Nah, more like in the starting description of your docs you start going with how you store Preferences |
15:10:10 | FromDiscord | <Phil> But preferences in what sense? For what? |
15:10:36 | FromDiscord | <Phil> Do I store my food preferences in there? |
15:10:53 | FromDiscord | <Phil> What is the benefit of me having my favourite potato meal in there? |
15:11:00 | FromDiscord | <Bung> asyncdispatch register raise `Error: unhandled exception: The parameter is incorrect.` anyone know the reason ? |
15:11:21 | FromDiscord | <Bung> on windows |
15:11:38 | FromDiscord | <Patitotective> like the preferences the user can change in the preferences window: theme, lang. or for example if you're making a game the user stats |
15:11:48 | FromDiscord | <Patitotective> the keybindings |
15:12:17 | FromDiscord | <Phil> Ahh, user preferences in a game |
15:12:27 | FromDiscord | <Phil> So no place to store potato goodness, gotcha |
15:12:37 | FromDiscord | <Patitotective> mainly for gui stuff |
15:12:42 | FromDiscord | <Patitotective> In reply to @Isofruit "So no place to": lol hehe |
15:14:04 | FromDiscord | <Phil> In reply to @Bung "asyncdispatch register raise `Error:": I'm sadly not deep enough into async to even have a proper idea of what is meant by asyncdispatch, I'd imagine though that a code sample of a minimal example might be necessary for others with the knowledge (?) |
15:15:38 | FromDiscord | <Patitotective> In reply to @Isofruit "Hmm I solved that": are those applications public somewhere? |
15:15:57 | FromDiscord | <Phil> I only got one that is actually large enough for that, it's nimstoryfont |
15:16:06 | FromDiscord | <Phil> Which is still very much in development might I add |
15:16:21 | FromDiscord | <Phil> Though I can just give you a sample of the json |
15:16:42 | FromDiscord | <treeform> In reply to @Elegantbeef "slappy is treeforms abstraction": You are totally right, slappy uses uses the openAL, but it also ads wav and ogg parsing. |
15:17:57 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3TwM |
15:18:26 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=3TwM" => "https://play.nim-lang.org/#ix=3TwN" |
15:20:42 | FromDiscord | <Patitotective> hmm, if you change your project folder, you would need to all the paths (?) |
15:20:49 | FromDiscord | <Patitotective> that's what i want to avoid |
15:21:38 | FromDiscord | <Phil> you mean I'll need to swap out basedir and mediadir? Yeah pretty much, but just in the settings file which I'll have a copy of on the server with different, adjusted, values |
15:22:22 | FromDiscord | <Phil> (edit) "you mean I'll need to swap out basedir and mediadir? Yeah pretty much, but just in the settings file which I'll have a copy of on the server ... with" added "that the code will be deployed to" |
15:22:29 | * | Gustavo6046 joined #nim |
15:23:08 | FromDiscord | <Phil> But the only path's I'll need to adjust are basedir and mediadir |
15:23:09 | FromDiscord | <Bung> In reply to @Isofruit "I'm sadly not deep": I have same problem like this https://github.com/PMunch/nimlsp/runs/5664209256?check_suite_focus=true it's just asyncFd pass to asyncdispatch's register proc |
15:24:05 | PMunch | Well that error is pretty horrible.. |
15:24:17 | FromDiscord | <Phil> Pmunch to the rescue |
15:24:24 | FromDiscord | <Patitotective> In reply to @Isofruit "But the only path's": and if you're working with someone else he would have to change those paths too, so that config file couldn't be in the github since it's different to everyone? |
15:24:43 | PMunch | To the rescue? |
15:25:44 | FromDiscord | <Bung> am trying to build a watchdog like lib, face same error , for me it's just a simple proc call , no idea what happen |
15:26:22 | PMunch | Oh, that error is apparently from the Nim compiler command line processing |
15:27:22 | PMunch | This is the only reference I found to that error in the sources: https://github.com/nim-lang/Nim/blob/devel/compiler/nim.nim#L121-L122 |
15:27:29 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/XeU |
15:27:44 | * | Gustavo6046 is now known as Gustavo6046\away |
15:28:20 | FromDiscord | <Patitotective> wouldn't just be easier to add the path of the main module to all paths in the settings? |
15:28:31 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=3TwQ" => "https://play.nim-lang.org/#ix=3TwP" |
15:28:50 | FromDiscord | <Phil> Might be sports messing with me, but how do you mean? |
15:29:09 | FromDiscord | <Phil> (edit) "Might be ... sports" added "leftover effects of" |
15:30:07 | PMunch | No idea where Nim creates that error tbh |
15:30:08 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3TwS |
15:30:27 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3TwT |
15:31:13 | FromDiscord | <Bung> In reply to @PMunch "This is the only": uh, that's like else place produce this error and then get last os error take it ? |
15:31:43 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/rfI |
15:32:43 | FromDiscord | <Patitotective> im going to try to do it relative because im making a template for imgui applications ¯\_(ツ)_/¯ |
15:32:45 | FromDiscord | <Phil> The reason I store my media dir within the project folder locally is because it makes developing easier if I don't have to clean up elsewhere |
15:32:45 | * | pro quit (Quit: pro) |
15:33:11 | FromDiscord | <Patitotective> (btw really liked `dev` directory name, gonna copy that lol) |
15:33:17 | FromDiscord | <Patitotective> (edit) "(btw really liked ... `dev`" added "the" |
15:33:50 | FromDiscord | <Patitotective> In reply to @Patitotective "im going to try": so it would be annoying to have to change all the paths if you only want to see an example |
15:33:56 | FromDiscord | <Patitotective> (edit) "In reply to @Patitotective "im going to try": so it would be ... annoying" added "really" |
15:36:55 | FromDiscord | <Phil> sent a long message, see http://ix.io/3Tx1 |
15:37:31 | FromDiscord | <Phil> (edit) "http://ix.io/3Tx1" => "http://ix.io/3Tx2" |
15:37:52 | FromDiscord | <Phil> How you set filepaths and the like, whether absolute compared to one or all relative, is just a detail on how to use that. |
15:38:41 | FromDiscord | <Phil> If the only variable thing in your application is filepath though and you don't need settings, then your original approach of just compiling them all relative to a specific folder is also valid. I just haven't encountered a lot of scenarios where that was the case yet, so I instinctively go for the runtime-settings-approach |
15:39:50 | FromDiscord | <Patitotective> i still need to see how i'm going to "build" an application↵like, appimage, snap or just a binary |
15:40:11 | FromDiscord | <Patitotective> and see if runtime settings work in that case |
15:40:30 | FromDiscord | <Phil> IIRC flatpak was winning the popularity contest, could also be a valid target |
15:41:01 | FromDiscord | <Phil> Well, popularity contest compared to the alternatives of snaps and appimages |
15:42:03 | FromDiscord | <Patitotective> yea, gonna check it too and maybe put all those alternatives in the template so you can choose which one to use or choose all |
15:42:14 | FromDiscord | <Patitotective> (edit) "alternatives" => "build methods" |
15:42:20 | FromDiscord | <Patitotective> (edit) "yea, gonna check it too and maybe put all those build methods in the template so you can choose which one to use or choose all ... " added "of them" |
15:42:44 | FromDiscord | <Phil> ~~Just do only a AUR package for that chaotic neutral alignment vibe~~ |
15:43:53 | FromDiscord | <Patitotective> or a debian one 🙃 |
15:44:04 | FromDiscord | <Phil> Heresyyyyyyy |
15:45:38 | FromDiscord | <Patitotective> In reply to @Isofruit "~~Just do only a": what about snap, appimage, flatpak, binary, aur and debian? so i can spend more time in this side project 💀 |
15:46:09 | FromDiscord | <Phil> I mean |
15:46:28 | FromDiscord | <Phil> If you want to learn about build pipelines and set one up for all of these it might be a good learning experience? |
16:01:17 | * | gsalazar quit (Ping timeout: 240 seconds) |
16:19:58 | FromDiscord | <mlokis> Is a second-degree graph a graph with (n + 1) points and each point has two edges that create an obvious cycle? |
16:26:43 | * | jmdaemon joined #nim |
16:26:53 | * | xet7 quit (Remote host closed the connection) |
16:36:18 | FromDiscord | <Rika> what is a second degree graph? all nodes have degree 2? |
16:36:58 | FromDiscord | <Rika> n+1 is always 3 in that case, and yes theres always a cycle there of course |
16:39:08 | * | slowButPresent joined #nim |
16:53:19 | * | pro joined #nim |
16:53:27 | * | arkurious joined #nim |
16:53:52 | * | yoyojambo joined #nim |
17:21:24 | FromDiscord | <Bubblie> Hey PMunch, can I have some help regarding importing the headers? Something is not working |
17:24:43 | PMunch | @Bubblie, sure |
17:27:11 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
17:27:29 | * | jmdaemon joined #nim |
17:27:43 | FromDiscord | <Alea> anyone seen this error in choosenim? https://media.discordapp.net/attachments/371759389889003532/957330019754049576/unknown.png |
17:28:21 | PMunch | @Alea, haven't seen it personally since I don't use Windows. But that looks like a string interpolation issue |
17:42:15 | FromDiscord | <Alea> it's probably another error caused by having a space in my username :withered: |
17:42:31 | FromDiscord | <Patitotective> How do I open a hyperlink (example https://duckduckgo.com/) with nim? |
17:42:55 | PMunch | @Patitotective, define "open" |
17:43:07 | FromDiscord | <Patitotective> open in the browser |
17:43:23 | FromDiscord | <Patitotective> just like discord |
17:44:18 | PMunch | Platform specific for sure |
17:44:41 | FromDiscord | <ajusa> https://nim-lang.org/docs/browsers.html ? |
17:44:42 | PMunch | On Linux you could probably do `xdg-open "https://duckduckgo.com"` |
17:44:54 | PMunch | Oh, or that apparently :P |
17:45:03 | FromDiscord | <ajusa> in the std library thankfully |
17:45:13 | FromDiscord | <ajusa> also PMunch did you have a chance to look at my PR? |
17:45:15 | FromDiscord | <Patitotective> In reply to @ajusa "https://nim-lang.org/docs/browsers.html ?": 🙃 thanks |
17:45:40 | FromDiscord | <ajusa> or a chance to update the docker/readme instructions? |
17:45:54 | PMunch | For the playground? No I haven't had a chance to look at it |
17:47:09 | FromDiscord | <Alea> is there any way to force the choosenim subcommands to run in verbose mode? |
17:47:22 | FromDiscord | <Alea> maybe I'll see what string formatting fails exactly |
17:58:02 | FromDiscord | <Alea> Judging by the message printed right before the error, it builds the compiler and then makes an early return from the build function before building the tools which is where I would presume this error happens since it mentions nimble.exe ↵https://github.com/dom96/choosenim/blob/950d19e7f5bfe96e95a90781633a4d28029d6f59/src/choosenimpkg/builder.nim#L133 |
18:03:29 | FromDiscord | <Alea> Ok I think the error might be coming from here? https://github.com/dom96/choosenim/blob/b959c84745ff4869d6d7ef0818b7147685b3f494/src/choosenimpkg/switcher.nim#L222 |
18:03:46 | FromDiscord | <Alea> How could this formatting break? |
18:18:50 | FromDiscord | <Alea> Annoying 😮💨 ↵guess I'll have to go with manual install again |
18:24:14 | PMunch | Is this just a normal Windows build? |
18:24:55 | FromDiscord | <Alea> yeah |
18:25:16 | FromDiscord | <Alea> I'm 90% sure it's an error with formatting the filepath because of the space in my username |
18:25:27 | FromDiscord | <Alea> that same error has popped up several times across the nim tools |
18:28:07 | FromDiscord | <demotomohiro> Are you trying to build devel Nim with choosenim? What's error message did you got? |
18:28:18 | PMunch | Yeah spaces are annoying when writing terminal applications |
18:29:31 | FromDiscord | <Alea> It got the step where it says `Compiler: Already Built` and then failed with https://media.discordapp.net/attachments/371759389889003532/957345568903012402/unknown.png |
18:29:53 | FromDiscord | <Alea> It also printed something about running nimble.exe -v |
18:29:57 | FromDiscord | <demotomohiro> You need to quote paths with '' or "" if it contains space. |
18:35:35 | FromDiscord | <demotomohiro> How did you run choosenim? |
18:36:36 | FromDiscord | <Alea> through the runme script, both regular and as admin |
18:37:34 | PMunch | I don't think it's where you thought it was @Alea |
18:37:50 | PMunch | The error message seems like $1 is passed to exec or something like that |
18:38:15 | FromDiscord | <Alea> possible, jumping around on github was tough |
18:38:43 | PMunch | Have you done `--verbose` on the choosenim call? |
18:39:40 | FromDiscord | <Alea> yup, that just printed out a bunch of messages about the disabled analytics |
18:39:50 | FromDiscord | <Alea> nothing about the actual subscripts |
18:40:34 | PMunch | @ajusa, the build error is because I've forgotten to change Dockerfile_nopackages to reflect the _v1 change in Dockerfile |
18:43:01 | PMunch | You can either apply those changes, or you can just build v1.4.8 instead :P |
18:44:50 | FromDiscord | <ajusa> wdym by v1.4.8? do I put that in the one file? |
18:45:26 | PMunch | `echo "v1.4.8" > curtag` |
18:45:31 | PMunch | Then run the Docker command |
18:51:11 | FromDiscord | <ajusa> gotcha, I will try that then with the nopackages file and see if I can get it working locally |
18:52:20 | * | Gustavo6046\away is now known as Gustavo6046 |
18:57:06 | PMunch | I was able to build that one at least |
19:04:26 | FromDiscord | <Require Support> sent a code paste, see https://play.nim-lang.org/#ix=3TxM |
19:04:55 | FromDiscord | <ajusa> hm, tried that and I have the images building but the command to get the versions doesn't seem to work. Additionally, some of the other commands ran by this program require root and certain users? |
19:06:04 | PMunch | Not quite sure what you mean? |
19:06:28 | PMunch | It is a bit hard-coded to the playground production environment I believe |
19:06:33 | PMunch | But I have run it locally in the past |
19:13:52 | FromDiscord | <demotomohiro> In reply to @Require Support "so i have a": If you are just trying to use functions/procedures in .dll file: https://nim-lang.org/docs/manual.html#foreign-function-interface-dynlib-pragma-for-import |
19:18:33 | FromDiscord | <demotomohiro> Nim has `dynlib` module that loads dll: https://nim-lang.org/docs/dynlib.html |
19:28:33 | * | PMunch quit (Quit: leaving) |
19:28:36 | NimEventer | New thread by Mardiyah: Can't have correct Nim nested template. Please explain, see https://forum.nim-lang.org/t/9048 |
19:58:40 | * | vicecea quit (Remote host closed the connection) |
19:59:09 | * | vicecea joined #nim |
20:05:37 | FromDiscord | <Bubblie> In reply to @PMunch "@Bubblie, sure": Sorry I didnt see this my phone died PMunch |
20:06:12 | FromDiscord | <Bubblie> Also for @tting you should use my tag as well so Bubblie#8978 with an @ instead so ill see it |
20:06:39 | FromDiscord | <Bubblie> Let me grab the code I wrote real quick |
21:12:58 | * | yiggityswaps joined #nim |
21:14:31 | * | yoyojambo quit (Ping timeout: 260 seconds) |
21:28:39 | FromDiscord | <Bubblie> Here is the code, sorry this took a while, I can send it on playground too |
21:28:58 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=3Tym |
21:29:36 | FromDiscord | <Bubblie> Not sure if im doing this right |
21:30:09 | FromDiscord | <Bubblie> It specifically doesn’t work with this part |
21:31:26 | FromDiscord | <Bubblie> Im not sure if its because im using the way windows does paths |
21:31:54 | FromDiscord | <Bubblie> Also I made a pr for the windows install PMunch not sure if you saw |
21:31:57 | * | yiggityswaps quit (Ping timeout: 252 seconds) |
21:32:32 | * | yoyojambo joined #nim |
21:43:35 | * | wyrd quit (Ping timeout: 240 seconds) |
21:45:34 | * | wyrd joined #nim |
22:10:20 | FromDiscord | <Patitotective> how do i convert a cstring to a string? |
22:10:35 | FromDiscord | <Elegantbeef> `string(myCstring)` should work |
22:11:40 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3TyD |
22:16:51 | FromDiscord | <Elegantbeef> `$myCstring` |
22:17:35 | * | pro quit (Ping timeout: 252 seconds) |
22:17:39 | FromDiscord | <Patitotective> thanks 🙃 |
22:24:39 | FromDiscord | <hmmm> hi broskis I have a dumb algo question, basically I have a kind of dumb tree structure with parents each many children that can have more children. I have a couple of recursive procs that walk down the structure and harvest data and that was easy because I just put the results in a seq and be done with it. Now I need make a proc that copies the structure itself. I'm stumped because my recursive procs don't tack the different levels of nestin |
22:25:00 | FromDiscord | <Elegantbeef> `deepCopy`? |
22:25:04 | FromDiscord | <hmmm> wot |
22:25:40 | FromDiscord | <Elegantbeef> Deepcopy deeply copies an object |
22:25:49 | FromDiscord | <hmmm> ohrly? |
22:25:54 | FromDiscord | <hmmm> link to something |
22:26:11 | FromDiscord | <Elegantbeef> `myObj.deepCopy` doesnt really need a link now does it |
22:26:13 | FromDiscord | <hmmm> and what if I want to do it by hand |
22:26:56 | FromDiscord | <Elegantbeef> Iterate over the object duplicating the values from one to the other |
22:27:39 | FromDiscord | <hmmm> hmm |
22:27:41 | FromDiscord | <hmmm> that could work |
22:30:00 | FromDiscord | <Elegantbeef> I'd hope so, that's kinda how deep copy works |
22:34:27 | FromDiscord | <Patitotective> how can get the value behind `userData`? https://nimgl.dev/docs/imgui.html#ImGuiInputTextCallbackData |
22:34:52 | FromDiscord | <Elegantbeef> `cast[ptr MyType](myObj)` or similar |
22:36:30 | FromDiscord | <Elegantbeef> You either will need to allocate for that, use a variable you know will never go out of scope or use a reference |
22:36:39 | FromDiscord | <Elegantbeef> The latter requires doing `GcRef` and `GcUnref` |
22:37:37 | FromDiscord | <Patitotective> In reply to @Elegantbeef "You either will need": i'm passing to it a variable of a for loop, i think that it will never go out of scope (?) |
22:38:06 | FromDiscord | <Elegantbeef> It's likely it will |
22:38:49 | FromDiscord | <Patitotective> so, how do i use references lol↵if i was doing `name.unsafeAddr` now i do `ref name`? |
22:38:51 | FromDiscord | <Elegantbeef> for variables are stack allocated generally, so they do not outlive the procedure they're defined it |
22:39:21 | FromDiscord | <Elegantbeef> No |
22:39:47 | FromDiscord | <Elegantbeef> You need to allocate a reference and make sure it outlives the variable |
22:39:50 | FromDiscord | <Elegantbeef> It highly depends on what you're doing |
22:39:53 | FromDiscord | <Elegantbeef> outlives the procedure\ |
22:51:21 | * | yiggityswaps joined #nim |
22:51:27 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3TyL |
22:51:47 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3TyL" => "https://paste.rs/T18" |
22:52:40 | FromDiscord | <Elegantbeef> That seems unsafe |
22:52:41 | FromDiscord | <Elegantbeef> make it a ref string and use `Gcref` and `GcUnref` and it'll be fine, or use `create` |
22:52:47 | FromDiscord | <Elegantbeef> `create` and `dealloc` |
22:53:23 | FromDiscord | <Elegantbeef> Here's an example of how using refs with `pointer`s work similar to this https://play.nim-lang.org/#ix=3TyO |
22:54:27 | * | yoyojambo quit (Ping timeout: 252 seconds) |
22:58:40 | FromDiscord | <Patitotective> like `GcRef[string](name)` instead of `name.unsafeAddr`? |
22:58:53 | FromDiscord | <Elegantbeef> No |
22:59:04 | FromDiscord | <Elegantbeef> `GCRef` does nothing but increment the GC ref counter |
22:59:47 | FromDiscord | <Elegantbeef> You need to do `var myString = new string; myString[] = myStringVal; GcRef(myString);` then `cast[pointer](myString)` |
22:59:56 | FromDiscord | <Elegantbeef> You cannot raise a non `ref` to ref |
23:00:02 | FromDiscord | <Elegantbeef> Actually this is dubm |
23:00:04 | FromDiscord | <Elegantbeef> Actually this is dumb |
23:00:32 | FromDiscord | <Elegantbeef> you can just do `GcRef(myStringVal)` and then `GcUnref(cast[string](data.userData))` inside the callback |
23:01:15 | FromDiscord | <Elegantbeef> I forgot you can do that with strings |
23:02:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3TyR |
23:06:20 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3TyT |
23:06:43 | FromDiscord | <Elegantbeef> The error is unrelated |
23:06:55 | FromDiscord | <Elegantbeef> `app` is a `var T` passed into your procedure |
23:07:00 | FromDiscord | <Elegantbeef> You cannot use it in a closure |
23:07:35 | FromDiscord | <Elegantbeef> Either make `app` a `ref object` or do `var app = app.addr` if you know it's safe to do as such |
23:11:54 | FromDiscord | <Patitotective> In reply to @Elegantbeef "Either make `app` a": i only need to make `type App = ref object`? |
23:12:06 | FromDiscord | <Patitotective> (edit) "In reply to @Elegantbeef "Either make `app` a": i only need to make `type App = ref object`? ... " added "cause it's not working if i only do that" |
23:13:37 | FromDiscord | <Patitotective> isn't easier to use closure scope? https://nim-lang.org/docs/system.html#closureScope.t,untyped |
23:14:23 | FromDiscord | <Elegantbeef> Your callback cannot be a closure anyway |
23:14:35 | FromDiscord | <Elegantbeef> It needs to be `cdecl` |
23:14:48 | FromDiscord | <Patitotective> ok |
23:14:48 | FromDiscord | <Elegantbeef> User data should be `app` |
23:15:31 | FromDiscord | <Elegantbeef> `buf` on the input of the callback has the cstring |
23:16:00 | FromDiscord | <Elegantbeef> You really need to learn low level programming with Nim to make this easier on yourself 😛 |
23:16:51 | FromDiscord | <Elegantbeef> Someone needs to make a low level tutorial for the uninitiated |
23:16:56 | FromDiscord | <Patitotective> In reply to @Elegantbeef "`buf` on the input": yea but i dont need `buf`, i need the key that was used to create that `igInputText` |
23:17:14 | FromDiscord | <Patitotective> (edit) "dont" => "not only" |
23:17:42 | FromDiscord | <Elegantbeef> Imgui doesnt support this |
23:18:05 | FromDiscord | <Patitotective> In reply to @Elegantbeef "Imgui doesnt support this": doesn't support what? |
23:18:13 | FromDiscord | <Elegantbeef> You'd need to make a tuple or object to hold your `app` and `name` |
23:18:25 | FromDiscord | <Elegantbeef> Passing name and holding onto a reference to `app` |
23:18:26 | FromDiscord | <Patitotective> In reply to @Elegantbeef "You'd need to make": 🙃 |
23:18:46 | FromDiscord | <Elegantbeef> I mean you're the one with the wacky design 😛 |
23:21:25 | FromDiscord | <Patitotective> In reply to @Elegantbeef "I mean you're the": hehe, its just so i don't need to create the preferences widgets manually, they are automatically created from config file (which helps because it's a templat) |
23:21:26 | FromDiscord | <Patitotective> (edit) "templat)" => "template)" |
23:21:35 | FromDiscord | <Patitotective> (edit) "template)" => "template for an imgui app)" |
23:25:28 | FromDiscord | <Elegantbeef> Well the issue here is that you need to pass userdata which is a `ref (App, string)` so you then can reference it later |
23:25:56 | FromDiscord | <Elegantbeef> Imgui doesnt allow you to pass custom user data that is multiple objects so you need a single place that has both |
23:26:16 | FromDiscord | <Elegantbeef> So making `App` a reference and `GcRef`ing the string/app will make it work |
23:27:24 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Tz3 |
23:27:33 | FromDiscord | <Elegantbeef> and unref each field |
23:27:39 | FromDiscord | <Patitotective> oh ok |
23:28:26 | FromDiscord | <Elegantbeef> You also could get around the gcref with memory memory allocations(which is basically what gcref/unref does) |
23:29:49 | FromDiscord | <Patitotective> In reply to @Elegantbeef "and unref each field": `GcUnref(cast[App](app))`? `GcUnref(cast[App](cast[UserData](data.userData)).app)`? |
23:30:15 | FromDiscord | <Elegantbeef> Dont need the `cast[App]` |
23:34:01 | FromDiscord | <Patitotective> sent a code paste, see https://paste.rs/GuH |
23:34:22 | FromDiscord | <Elegantbeef> You dont need `GCFullCollect` |
23:35:15 | FromDiscord | <Patitotective> this line `cast[pointer](userData)` complains `Error: expression cannot be cast to pointer` |
23:35:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Tz4 |
23:35:34 | FromDiscord | <Elegantbeef> What's your `UserData` type? |
23:35:41 | FromDiscord | <Patitotective> `UserData = tuple[app: App, name: string]` |
23:35:52 | FromDiscord | <Elegantbeef> `ref` |
23:35:58 | FromDiscord | <Elegantbeef> It needs to be a ref |
23:36:02 | FromDiscord | <Elegantbeef> Like i said it needs to outlive the procedure |
23:36:04 | FromDiscord | <Patitotective> `UserData = ref tuple[app: App, name: string]`? |
23:36:07 | FromDiscord | <Elegantbeef> The only way to do that is with heap allocated memory |
23:36:16 | FromDiscord | <Elegantbeef> As such you need to use `ref`s |
23:38:05 | FromDiscord | <Patitotective> and how do i create a ref tuple? `let userData: ref UserData = (app, name)`? |
23:38:25 | * | mahlon joined #nim |
23:39:09 | FromDiscord | <Alea> sent a code paste, see https://play.nim-lang.org/#ix=3Tz5 |
23:39:09 | FromDiscord | <Alea> Any clues why? |
23:39:35 | FromDiscord | <Elegantbeef> `new (App, string)` |
23:39:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Tz6 |
23:39:59 | FromDiscord | <Elegantbeef> Use an object if you want it to be cleaner |
23:40:13 | FromDiscord | <Elegantbeef> it'd just be `let userData = UserData(app: app, name: name)` |
23:41:34 | NimEventer | New thread by Domogled: Two data bindings in vanilla nim for js app without virtual DOM, see https://forum.nim-lang.org/t/9049 |
23:43:01 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Tz7 |
23:43:08 | FromDiscord | <Elegantbeef> Yes |
23:45:18 | FromDiscord | <Elegantbeef> You can kinda think of `GCref` as "keep this alive" and `GCUnref` as "Ok i'm done with it" |
23:46:06 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Tz8 |
23:46:15 | FromDiscord | <Patitotective> In reply to @Elegantbeef "You can kinda think": Someone needs to make a low level tutorial for the uninitiated |
23:46:19 | FromDiscord | <Elegantbeef> yes |
23:46:26 | FromDiscord | <Elegantbeef> Lol |
23:47:27 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Tz9 |
23:47:56 | FromDiscord | <Elegantbeef> And line 58 is probably `app.x`? |
23:48:32 | FromDiscord | <Elegantbeef> How do you declare \`app? |
23:50:10 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Tza |
23:50:35 | FromDiscord | <Elegantbeef> `app.prefs` |
23:50:40 | FromDiscord | <Elegantbeef> where do you declare the `app` your pass in? |
23:50:42 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Tzb |
23:50:57 | FromDiscord | <Elegantbeef> No |
23:51:12 | FromDiscord | <Patitotective> In reply to @Elegantbeef "where do you declare": in the `main` procedure (?) |
23:52:06 | FromDiscord | <Elegantbeef> Well it's a nil error so have fun finding what's causing it |
23:52:22 | FromDiscord | <Patitotective> In reply to @Patitotective "now a really verbose": then i pass `var app` to these procedures until `drawPrefsModal` |
23:53:19 | FromDiscord | <Patitotective> In reply to @Elegantbeef "Well it's a nil": maybe `app.prefs`, other times it have done the same↵maybe it's time to improve my error messages 🥲 |
23:55:12 | FromDiscord | <Elegantbeef> I'm going to start on a pointers tutorial i guess |