00:00:16 | * | tk quit (Quit: Well, this is unexpected.) |
00:00:43 | * | tk joined #nim |
00:17:23 | * | vicfred joined #nim |
00:40:58 | * | Goodbye_Vincent joined #nim |
01:36:48 | FromDiscord | <Girvo> Hi all 🙂 |
01:37:09 | FromDiscord | <Elegantbeef> Hello |
01:38:00 | FromDiscord | <Girvo> Question: `esp_err_t esp_pthread_set_cfg(const esp_pthread_cfg_t cfg);` that `const ` is causing me dramas, as I don't know how to define a Nim object/var as a C const? |
01:38:18 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3RxW |
01:38:28 | FromDiscord | <Girvo> Thats what I've got from c2nim (slightly modified) |
01:39:06 | FromDiscord | <Elegantbeef> You can use `codegendecl` to manually specify it like so https://github.com/beef331/picostdlib/blob/master/src/picostdlib/tusb.nim#L738-L739 |
01:39:18 | FromDiscord | <Girvo> (edit) "https://play.nim-lang.org/#ix=3RxY" => "https://play.nim-lang.org/#ix=3RxX" |
01:39:31 | FromDiscord | <Girvo> Ah neat |
01:41:24 | FromDiscord | <Girvo> Is there a better pattern I can take when binding this to avoid this issue, out of curiosity? |
01:41:42 | * | flynn quit (Quit: Ping timeout (120 seconds)) |
01:41:42 | FromDiscord | <Girvo> https://github.com/espressif/esp-idf/blob/v4.3/components/pthread/include/esp_pthread.h this is the header for reference |
01:42:51 | * | flynn joined #nim |
01:45:15 | FromDiscord | <Girvo> Oh. Putting a missing `importc, header:` pragma on the object itself and using `let` with `unsafeAddr` compiles now... though thats likely not the right way lol |
01:46:22 | FromDiscord | <Girvo> Oh I don't even need unsafeAddr. It was actually just the missing `importc` and `header` binding to the actual struct in the C header, and now its compiling nicely |
01:46:43 | termer | シ |
01:48:26 | FromDiscord | <Girvo> Even checked the codegen and, while it doesn't have const on it, its working now? |
01:49:02 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3RxZ |
01:49:42 | FromDiscord | <Girvo> Which matches the documentation. I guess the error about it not being a const was _actually_ about the symbol not matching as it was missing the importc, header? |
01:49:46 | FromDiscord | <exelotl> In reply to @Elegantbeef "Who the fuck echo's": `echo (foo, bar)` is really convenient for debug printing lol |
01:54:49 | * | toulene joined #nim |
01:58:52 | FromDiscord | <Elegantbeef> Hush hush hush |
02:01:16 | * | vicfred quit (Ping timeout: 256 seconds) |
02:09:48 | * | arkurious quit (Quit: Leaving) |
02:21:23 | FromDiscord | <huantian> Imagine debug printing with echo and not treeform’a print |
02:21:31 | FromDiscord | <huantian> (edit) "treeform’a" => "treeform’s" |
02:21:33 | FromDiscord | <Elegantbeef> Imagine debugging |
02:30:21 | * | jmdaemon quit (Ping timeout: 245 seconds) |
02:36:27 | NimEventer | New question by itil memek cantik: Nim template's body to definitely be specifc, see https://stackoverflow.com/questions/71375884/nim-templates-body-to-definitely-be-specifc |
02:44:46 | * | toulene quit (Quit: Leaving) |
02:45:10 | * | toulene joined #nim |
02:47:27 | FromDiscord | <Girvo> In reply to @Elegantbeef "Imagine debugging": Yeah! Just write code that works first go duh..... Ez pz 😄 |
02:48:36 | FromDiscord | <Rika> what is the equiv. of `declspec(dllexport)` in nim? |
02:48:48 | FromDiscord | <Rika> ive never done windows programming lmao |
02:50:06 | FromDiscord | <Rika> {.dynlib.} i assume |
02:57:04 | termer | ツ |
02:58:06 | FromDiscord | <Girvo> Question: why would `warning: "_GNU_SOURCE" redefined` be trigged (nimbase.h and stdlib_system.nim.c both seem to define it lol) |
03:02:00 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3Ryd |
03:04:28 | * | jmdaemon joined #nim |
03:13:44 | FromDiscord | <Girvo> Can one view the error value of `createThread` somehow? |
03:14:43 | * | krux02 quit (Remote host closed the connection) |
03:18:46 | FromDiscord | <Girvo> Better question: is there any good docs I should look at for Nim's usage of `pthreads` -- as it seems Nim threads aren't quite supported for FreeRTOS/ESP-IDF right now |
03:19:51 | * | toulene quit (Quit: Leaving) |
03:20:13 | FromDiscord | <Elegantbeef> Should be the same as C |
03:20:45 | FromDiscord | <Girvo> Alrighty |
03:21:39 | FromDiscord | <Girvo> Damn. I really like Nim's thread support lol. Oh well! Might stick with FreeRTOS tasks after all then. Any reason I can't use Channels with a pthread/Task? |
03:22:04 | FromDiscord | <Elegantbeef> Locks should still work afaik |
03:22:29 | FromDiscord | <Elegantbeef> So yea i think channels should be safe |
03:26:21 | * | toulene joined #nim |
03:35:02 | FromDiscord | <Girvo> Awesp,e |
03:35:05 | FromDiscord | <Girvo> (edit) "Awesp,e" => "Awesome" |
03:35:15 | FromDiscord | <Girvo> I'll have a play. Beats having to use the straight C stuff at least |
03:35:43 | FromDiscord | <Girvo> I do wonder what it would take to get Nim's thread module working on ESP32 mind you... might have to do some digging |
03:37:16 | * | symgryph joined #nim |
03:40:52 | symgryph | quick question on VS code for mac with the nim plugin (there seem to be 2 of them, nim 0.6.6 and 0.1.2.5 from nimsaem Neither of them seems to 'check on type' but only 'check on save' any way to have autocheck w/o having to save code? |
03:41:14 | symgryph | aka instatype? |
03:41:30 | FromDiscord | <Elegantbeef> There is not |
03:41:38 | FromDiscord | <Elegantbeef> just enable autosave every Xms |
03:41:58 | symgryph | I see. the videos I was watching made it look like it was instatype' |
03:42:20 | FromDiscord | <Elegantbeef> Yea it's instant with autosave 😛 |
03:43:19 | symgryph | ah. Which nim plugin is the 'best' the 0.6 or the other nimsaem? |
03:43:31 | symgryph | since the 'nim' one seems to have more people |
03:43:31 | FromDiscord | <Elegantbeef> saem's |
03:45:14 | symgryph | Thank you elegant beef. I turned on 'automatic' save with a 1000MS delay seems 'instant' enough now. |
03:46:01 | symgryph | Also shouldn't the message be updated to nim is 1.6.4? |
03:46:06 | symgryph | since 1.6.0 is old now. |
03:46:16 | FromDiscord | <Elegantbeef> message? |
03:46:26 | symgryph | The topic for irc://irc.libera.chat:6697/#nim is: 👑 Nim programming language - http://nim-lang.org/ | https://github.com/nim-lang/Nim/wiki/IRC-guidelines | Latest version: 1.6.0 - https://nim-lang.org/install.html | Forum: http://forum.nim-lang.org/ | IRC logs: http://irclogs.nim-lang.org/ | Bridged to Discord/Gitter/Matrix: https://discord.com/invite/nim | See also irc://irc.libera.chat:6697/#nim-offtopic irc://irc.libera.chat:6 |
03:46:26 | symgryph | 697/#nim-nologs | http://git.io/gHZGCg (10:37) |
03:46:26 | symgryph | Topic for #nim set by [email protected] at 15:29:54 on 11/07/21 (10:37) |
03:46:32 | symgryph | the initial sign on message |
03:46:41 | symgryph | when you first login to the channel |
03:47:42 | FromDiscord | <Elegantbeef> Ah irc |
03:47:49 | symgryph | Yes. |
03:48:00 | symgryph | Should I be using discord, the thing said 'irc is our main' |
03:48:13 | FromDiscord | <Elegantbeef> I use matrix, it's purely up to you |
03:48:27 | FromDiscord | <Elegantbeef> If you prefer IRC use it, otherwise use what you prefer |
03:48:34 | symgryph | Just got liberachat working with cloaking and happy NIC registering. |
03:48:36 | FromDiscord | <Elegantbeef> They're all linked together so it doesnt really matter |
03:49:05 | FromDiscord | <Rika> use whichever |
03:49:19 | FromDiscord | <Girvo> Interesting, `createThread` is failing with `ResourceExhaustedError` -- though createThread really only checks if `!= 0` it seems anyway, so it might be a different error? |
03:49:54 | symgryph | Has anyone used the very nice "nim for beginners' video series on youtube? I tried NIM in action, but its a bit over my head (our first app was a multi-threaded chat app!) |
03:50:09 | FromDiscord | <Rika> probably |
03:50:12 | FromDiscord | <Rika> not me |
03:50:13 | symgryph | The Nim for beginners seems more geared to my level (a former perl programmer) |
03:50:38 | symgryph | Is there anything besides 'nim in action' ? |
03:50:48 | FromDiscord | <Elegantbeef> The nim programming book |
03:51:00 | symgryph | I looked high and low on oreilly safari and could only find that |
03:51:11 | symgryph | URL? |
03:51:48 | FromDiscord | <Rika> theres also https://ssalewski.de/nimprogramming.html maybe |
03:51:53 | FromDiscord | <Elegantbeef> https://ssalewski.de/nimprogramming.html |
03:52:03 | FromDiscord | <Rika> haha slow |
03:52:25 | FromDiscord | <Elegantbeef> Indeed |
03:56:53 | symgryph | Thank you. Its very nice. any epub versions available? |
03:57:27 | symgryph | I did convert it, but was wondering if its natively available in epub version? I use an ebook reader to do most of my programming. |
03:58:28 | FromDiscord | <Rika> not that i know of, no |
04:00:23 | symgryph | Would anyone else have use for a 'epub' version? Should I send to the author? |
04:01:10 | FromDiscord | <Rika> i dont know |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.4) |
04:06:32 | * | supakeen joined #nim |
04:29:12 | * | toulene quit (Remote host closed the connection) |
04:29:31 | * | toulene joined #nim |
04:38:42 | * | toulene quit (Remote host closed the connection) |
04:39:01 | * | toulene joined #nim |
04:43:37 | FromDiscord | <abdu> sent a code paste, see https://play.nim-lang.org/#ix=3Ryl |
04:45:07 | FromDiscord | <Elegantbeef> You probably need to use a macro |
04:45:38 | FromDiscord | <Elegantbeef> Or not |
04:46:20 | FromDiscord | <huantian> there was this thread here <https://forum.nim-lang.org/t/8970> |
04:48:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Ryn |
04:48:03 | FromDiscord | <Elegantbeef> There we go |
04:48:15 | FromDiscord | <huantian> your indents are a tad wonky beef 😛 |
04:48:31 | FromDiscord | <Elegantbeef> What can i say they were wonky from the first paste |
04:57:48 | * | slowButPresent quit (Quit: leaving) |
05:20:44 | * | rockcavera quit (Remote host closed the connection) |
05:20:49 | * | symgryph quit (Quit: Leaving.) |
05:33:12 | * | toulene quit (Remote host closed the connection) |
05:33:31 | * | toulene joined #nim |
05:38:13 | * | user30959 joined #nim |
05:39:00 | * | toulene quit (Ping timeout: 250 seconds) |
05:50:53 | * | user30959 quit (Quit: Leaving) |
05:59:03 | FromDiscord | <Girvo> Where would one find the {.thread.} pragma's definition in the source? |
05:59:33 | FromDiscord | <Elegantbeef> It's compiler magic and equivlent with `gcsafe` |
05:59:57 | FromDiscord | <Girvo> Okay neat |
06:04:47 | FromDiscord | <Girvo> So it will work no worries with pthread_create and/or xTaskCreate, and just give me the GC-variable-access checks? |
06:05:11 | FromDiscord | <Elegantbeef> what is the proc def for those? |
06:06:22 | FromDiscord | <Elegantbeef> Ah it uses `noconv` |
06:10:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3RyI |
06:58:52 | FromDiscord | <Girvo> Interestingly, `{.thread.}` actually causes a fatal crash, but `{.gcsafe.}` works fine. I'm guessing `{.thread.}` does slightly more under the hood? |
06:59:44 | FromDiscord | <Elegantbeef> You still have noconv on both right? |
06:59:48 | FromDiscord | <Girvo> Yep |
07:00:06 | FromDiscord | <Elegantbeef> Odd that thread crashes, i dont think it does anything but ensure it's thread safe |
07:01:18 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#threads-thread-pragma like there is nothing about it changing the code, and i dont recall the compilers internals doing it |
07:01:53 | FromDiscord | <Girvo> Yeah. I think its because the FreeRTOS work that was done for Nim from Nesper isn't entirely complete -- createThread for example always fails, among other things, despite `pthread` support working no worries (including from `import posix`). I might take a look into it and see if I can't fix it myself |
07:02:06 | FromDiscord | <Girvo> But I'm not entirely sure. |
07:02:32 | FromDiscord | <Elegantbeef> Hmm can you show the C gen'd code with thread vs gcsafe? |
07:02:36 | FromDiscord | <Elegantbeef> I'm curious what's actually different |
07:02:37 | FromDiscord | <Girvo> Yeah I can! |
07:03:20 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3RyQ |
07:04:37 | FromDiscord | <Elegantbeef> I'm guessing the thread pragma somehow is changing the code, even though it shouldnt |
07:05:23 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3RyR |
07:05:48 | FromDiscord | <Elegantbeef> Is the call site for `XTaskCreate` the same? |
07:05:53 | FromDiscord | <Girvo> I'll have a look, one tick |
07:08:12 | FromDiscord | <Girvo> It honestly looks like it is lol. I'll have to dig a bit deeper as this is all spread out over some modules. I'll write a much simpler test case to see if I can replicate the issue |
07:08:45 | FromDiscord | <Elegantbeef> Remember you can do `-d:danger` to make the generated C more compact |
07:08:50 | FromDiscord | <Girvo> Oh! |
07:08:55 | FromDiscord | <Girvo> Cheers, I'll do that |
07:09:13 | FromDiscord | <Elegantbeef> It removes all the debug information and many checks, but it also makes it easier to search through imo |
07:10:08 | FromDiscord | <Girvo> Yeah this is so much easier to readl ol |
07:10:46 | FromDiscord | <Elegantbeef> If the function def isnt different and the call site isnt different this is an absurdly weird bug |
07:10:58 | FromDiscord | <Girvo> Hah so, it absolutely _is_ identical in terms of `main.nim` output |
07:11:28 | FromDiscord | <Elegantbeef> Are you certain the gcsafe always behaves properly? |
07:12:08 | FromDiscord | <Girvo> _and_ the tasks.nim which is where the xTaskCreate call lives is also identical. I'm definitely gonna have to look deeper, I think your instincts are right and there is something else at play here |
07:12:34 | FromDiscord | <Girvo> Though I _did_ make the test case as simple as a single task proc that does not much, other than have `{.thread, noconv.}` on it |
07:12:35 | FromDiscord | <Elegantbeef> My present thought is there is some UB being expressed |
07:12:39 | FromDiscord | <Girvo> And yeah I think so too |
07:13:47 | FromDiscord | <Girvo> I'll have a dig around. See if I can't get the simplest test case possible for this, and examine what the C is doing. Will let you know, might make an issue if there is something not-obvious happening |
07:14:17 | FromDiscord | <Elegantbeef> Ok |
07:14:51 | FromDiscord | <Elegantbeef> I had something similar before with gcsafe but between gcsafe and non gcsafe |
07:15:12 | FromDiscord | <Elegantbeef> But different API so i could happily just remove the `gcsafe` annotation and carry on |
07:15:44 | FromDiscord | <Elegantbeef> It also only effected WASM so it was super odd |
07:16:37 | FromDiscord | <Girvo> Yeah. Technically that is sort of what is happening here, the `app_main:` template from Nesper won't have gcsafe on it (nor {.thread.} obviously) is where the `newTask` proc is called which itself calls `xTaskCreate` -- but I'll have a look as mostly all app_main does is make sure some certain things are in place so ESP-IDF can pick up our main function correctly |
07:18:31 | FromDiscord | <Girvo> But yeah theres nothing immediately obvious as to why it would work here with `{.gcsafe.}` and not `{.thread.}` even in terms of the C output. Fascinating |
07:20:17 | FromDiscord | <Girvo> Only thing I can think of is something to do with how stacks and such are setup with Nim and `{.thread.}` compared to how `xTaskCreate` expects things to work. I might change it out from the Task interface to actual `pthread_create` and such, and see whether that has the same problem, too |
07:23:36 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3RyU |
07:23:45 | FromDiscord | <Girvo> (edit) "https://play.nim-lang.org/#ix=3RyU" => "https://play.nim-lang.org/#ix=3RyV" |
07:26:42 | * | jjido joined #nim |
07:36:22 | * | jmdaemon quit (Ping timeout: 272 seconds) |
07:36:37 | FromDiscord | <Girvo> Ah hah! CMake had tripped up somehow, and it _always_ errors even with gcsafe _or_ thread |
07:36:56 | FromDiscord | <Elegantbeef> Ah |
07:37:04 | FromDiscord | <Elegantbeef> That makes 130% more sense |
07:37:09 | FromDiscord | <Girvo> Amen 😂 |
07:37:17 | FromDiscord | <Girvo> I was losing my mind for a moment here |
07:37:50 | * | jmdaemon joined #nim |
07:38:40 | FromDiscord | <Girvo> Oh my gosh |
07:38:48 | FromDiscord | <Elegantbeef> Pmunch you about? |
07:40:28 | FromDiscord | <Girvo> It's noconv, not gcsafe/thread, I think. Let me look a bit deeper. I have a feeling the Nesper `xTaskCreate` binding is missing it, it only expects `{.cdecl.}` so I can't put `{.noconv.}` on the wrapper proc that is actually _passed_ to `xTaskCreate` |
07:41:02 | FromDiscord | <Elegantbeef> what does the C def of XTaskCreate look for? |
07:41:07 | FromDiscord | <Girvo> One moment |
07:43:24 | FromDiscord | <b4mbus> where do I learn more about command syntax? |
07:44:06 | FromDiscord | <Girvo> `TaskFunction_t ` which is: ... annoying to find, one moment lol |
07:44:34 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#procedures-command-invocation-syntax |
07:44:37 | FromDiscord | <b4mbus> (edit) "syntax?" => "syntax?↵I checked tutorial1 tutorial2 and tutorial3 as well as the language manual and the only thing there is is an EBNF with a comment `command syntax`" |
07:44:47 | FromDiscord | <Girvo> Though as pvTaskCode:↵> Pointer to the task entry function (just the name of the function that implements the task, see the example below). |
07:44:54 | FromDiscord | <Girvo> https://www.freertos.org/a00125.html |
07:45:34 | FromDiscord | <b4mbus> In reply to @Elegantbeef "https://nim-lang.org/docs/manual.html#procedures-co": I see, thanks |
07:45:36 | FromDiscord | <Elegantbeef> I'd imagine it should be a `cdecl` proc in Nim but without seeing the C typedef I dont know |
07:47:00 | FromDiscord | <Girvo> It definitely does need to be cdecl yeah. I adjusted the Nim wrapper from Nesper to define it as `{.cdecl, noconv.}` and now passing gcsafe/thread procs to the wrapper function work |
07:47:19 | FromDiscord | <Elegantbeef> `cdecl, noconv` is 100% silly |
07:47:22 | FromDiscord | <Elegantbeef> `noConv` was for the pthread api |
07:47:38 | FromDiscord | <Elegantbeef> The calling convention used is noConv for the posix api |
07:48:02 | FromDiscord | <Elegantbeef> noConv and cdecl are both calling conventions, so they dont make sense to be used in unison |
07:48:08 | FromDiscord | <Girvo> That makes sense to me 🙂 |
07:49:09 | FromDiscord | <Elegantbeef> Guess i'll abuse pmunch later when he's actually on |
07:49:15 | FromDiscord | <Girvo> The pthread API in this instance is actually just a wrapper over the xTaskCreate stuff anyway, interestingly enough |
07:49:31 | FromDiscord | <Girvo> I'm going to have a play with all of that next to see if there are any sharp edges |
07:49:46 | FromDiscord | <Elegantbeef> Ah so you should infact make it take a `{.thread, cDecl.}` procedure |
07:50:11 | FromDiscord | <Girvo> :catnod: |
07:51:34 | FromDiscord | <Elegantbeef> "This has been an episode of 'Beef states the obvious to someone'" |
07:52:39 | FromDiscord | <Girvo> Haha nah its super helpful anyway! Theres so many layers here keeping them all straight in my head is a real task |
07:52:47 | FromDiscord | <Girvo> Or should I say, xTaskCreate |
08:07:09 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3RyZ |
08:07:41 | FromDiscord | <Girvo> And if you do, you'll have a bad time as there is no actual pointer passed now |
08:08:18 | FromDiscord | <Girvo> Hence why I was trying to do a wrapper in the first place, but it had the same error we've been talking about when used with `{.thread, cdecl.}` |
08:08:29 | FromDiscord | <Girvo> (edit) "Hence why I was trying to do a wrapper in the first place, but it had the same error we've been talking about when used with `{.thread, cdecl.}` ... " added "on the wrapper" |
08:10:02 | FromDiscord | <Elegantbeef> What was the wrapper? |
08:10:33 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3Rz0 |
08:11:32 | FromDiscord | <Elegantbeef> Hmmm |
08:12:04 | FromDiscord | <Elegantbeef> And how do you create the task + pass the object? |
08:13:03 | FromDiscord | <Girvo> So this is the "InstrFetchProhibited" code: https://pastebin.com/2QJsZean |
08:13:50 | FromDiscord | <Girvo> `var tModem = newTask(sendAT, "sendAT", (16384 3).SzBytes)` is how its being used |
08:16:01 | FromDiscord | <whisperdev> Wow is Nitter the most well known Nim app in the wild? |
08:16:08 | FromDiscord | <Elegantbeef> Probably |
08:16:18 | FromDiscord | <Elegantbeef> Hmm if result isnt NVRO'd you might have an issue |
08:16:43 | FromDiscord | <Girvo> Yeah I had a feeling I was doing something wrong in that newTask proc |
08:16:55 | FromDiscord | <Elegantbeef> `echo cast[int](result.addr)` `echo cast[int](tModem.addr)` where they belong |
08:17:09 | FromDiscord | <Elegantbeef> That's if it can print before it crashes |
08:17:16 | FromDiscord | <Girvo> Alright I'll give it a try |
08:18:01 | FromDiscord | <Elegantbeef> You might need to make a api that takes a `var Task` |
08:18:37 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Rz1 |
08:19:07 | FromDiscord | <Elegantbeef> I'm just guessing that the issue is that `addr result` is the issue, i'm probably wrong |
08:19:17 | FromDiscord | <Girvo> So thats honestly my guess too |
08:19:23 | FromDiscord | <Girvo> Wanna know something hilarious |
08:19:34 | FromDiscord | <Elegantbeef> Always |
08:19:47 | FromDiscord | <Girvo> Adding those echos? It now works. Removing them? Back to the InstrFetchProhibited 😉 |
08:20:00 | FromDiscord | <Girvo> So I reckon that addr result is on the right track |
08:20:07 | FromDiscord | <Elegantbeef> Echo is thread safe so it's locking the code someehwere long enough |
08:20:10 | FromDiscord | <Girvo> Yeah |
08:20:18 | FromDiscord | <Elegantbeef> Were the addresses the same? |
08:20:28 | FromDiscord | <Girvo> One sec, I'll check again |
08:21:44 | FromDiscord | <Girvo> Yep they are the same |
08:23:11 | FromDiscord | <Elegantbeef> Does it work if you write the code manually outside a proc? |
08:24:41 | FromDiscord | <Girvo> If you mean xTaskCreate itself? Yeah it does |
08:25:32 | FromDiscord | <Elegantbeef> Wait a minute |
08:25:32 | FromDiscord | <Girvo> I'll strip it all back to the simplest things possible and see if I can replicate it. I'm certain it's something to do with how I'm defining this Task object and how it interacts with xTaskCreate memory-wise |
08:25:41 | FromDiscord | <Elegantbeef> What's the `ret` value? |
08:26:00 | FromDiscord | <Girvo> `ret: BaseType_t` -- the returned value from xTaskCreate itself |
08:26:03 | FromDiscord | <Elegantbeef> if it doesnt create teh task and you go to destroy the object it'll error |
08:26:12 | FromDiscord | <Elegantbeef> No i mean is it successful |
08:26:17 | FromDiscord | <Girvo> Oh! |
08:26:20 | FromDiscord | <Girvo> Actually good point |
08:26:23 | FromDiscord | <Girvo> one second please |
08:26:36 | FromDiscord | <Elegantbeef> Fuck no i want the answer now!!!! 😛 |
08:27:39 | FromDiscord | <Girvo> Oh man what the fuck, lol. Its working now. This has to be in UB-land, right? |
08:30:43 | FromDiscord | <Girvo> sent a code paste, see https://paste.rs/D1R |
08:32:57 | FromDiscord | <Girvo> And it still works |
08:32:58 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3Rz2 |
08:33:52 | FromDiscord | <Girvo> Add it into both? And it fails! And fails at `var tModem = newTask(sendAT, "sendAT", (16384 3).SzBytes)` |
08:35:17 | FromDiscord | <Girvo> Something to do with global variables, closures/procs and how that works with cdecl perhaps? I might just ditch this whole Task wrapper and just document how to use xTaskCreate properly instead, because this is starting to hurt my head lol. And using it straight, seems to work no worries even with both lock accesses |
08:38:03 | * | toulene joined #nim |
08:41:51 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
08:42:02 | FromDiscord | <Girvo> Ditching the whole wrapper stuff, sticking to raw `xTaskCreate`, the lock accesses work fine |
08:44:33 | * | PMunch joined #nim |
09:03:29 | * | user30959 joined #nim |
09:04:27 | FromDiscord | <Elegantbeef> Hmm pmunch is alive on offtopic maybe here aswell |
09:04:53 | * | user30959 quit (Remote host closed the connection) |
09:05:07 | PMunch | Good morning |
09:05:37 | * | toulene quit (Ping timeout: 240 seconds) |
09:05:40 | FromDiscord | <Elegantbeef> How to futhark files in `/usr/include/`? |
09:05:49 | PMunch | Just like normal` |
09:06:07 | FromDiscord | <Elegantbeef> Ah so then i'm an idiot |
09:06:13 | PMunch | `sysPath "/usr/include"; "mylib.h"` |
09:06:37 | FromDiscord | <Elegantbeef> Oh i see |
09:06:39 | PMunch | I guess you tried to use `path "/usr/include"` and it blew up from recursion depth? |
09:07:10 | FromDiscord | <Elegantbeef> Nah i did `path "/usr/include/mylib/file"` |
09:07:21 | PMunch | Ah, yeah that's not how it works |
09:07:26 | FromDiscord | <Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3Rza |
09:07:44 | PMunch | `path` is used to specify paths to automatically import required headers from |
09:07:52 | FromDiscord | <Waldecir Santos> (edit) "https://play.nim-lang.org/#ix=3Rza" => "https://play.nim-lang.org/#ix=3Rzb" |
09:08:50 | FromDiscord | <Rika> In reply to @Waldecir Santos "I need to have": It doesn’t look like you need either var written in that proc signature? |
09:09:01 | FromDiscord | <Rika> Remove the one on the result type |
09:09:27 | FromDiscord | <Waldecir Santos> I do need it because the idea is to chain other functions calls, this is just an example. |
09:09:45 | FromDiscord | <Waldecir Santos> The object will be "resolved' as soon I try to iterate or print it. |
09:11:01 | PMunch | https://play.nim-lang.org/#ix=3Rzc |
09:11:22 | PMunch | You don't use var on the return type, the mutability of a symbol is determined by how it's stored by the caller |
09:11:23 | FromDiscord | <Elegantbeef> Aw yay my lack of understanding how C imports should be |
09:11:41 | FromDiscord | <Elegantbeef> `#include <spa/utils/string.h>` in C, should be done how in futhark? |
09:11:46 | PMunch | @Elegantbeef, well this is a bit of an implementation detail in Futhark |
09:12:03 | FromDiscord | <Elegantbeef> I figured it was done the same |
09:12:22 | FromDiscord | <Waldecir Santos> In reply to @PMunch "You don't use var": It fails if I chain the calls I need, I'll try to create a more complete version of the example to be more clear |
09:12:27 | PMunch | `sysPath "<path to clang includes>; path "/usr/include/spa"; "utils/string.h"` is how I'd do it |
09:12:58 | PMunch | That way anything in /usr/include/spa which spa/utils/string.h might need is included automatically |
09:13:13 | PMunch | Or rather, will be included automatically if it uses them |
09:13:49 | PMunch | Or you could just do `sysPath "<path to clang includes>; sysPath "/usr/include"; "spa/utils/string.h"` if you don't want to import anything but the definitions in string.h itself |
09:14:11 | FromDiscord | <Rika> In reply to @Waldecir Santos "It fails if I": Remove var on both the input and output types then |
09:14:16 | FromDiscord | <Rika> Neither seems to be required |
09:14:23 | PMunch | Any objects outside of the string.h module will simply be a `distinct object` so that pointers to it still works but you won't be able to see any of their fields. |
09:14:28 | FromDiscord | <Rika> Chaining calls usually have neither of them as var |
09:14:31 | FromDiscord | <Elegantbeef> Yea i've tried a bunch of these variants of this |
09:14:37 | FromDiscord | <Elegantbeef> It doesnt work |
09:15:24 | PMunch | @Waldecir_Santos, you're probably running into the "an inline call is not mutable" issue, try reading up on `dup`. |
09:15:30 | PMunch | @Elegantbeef, doesn't work? |
09:15:37 | PMunch | Could you be a bit more specific? :P |
09:15:56 | FromDiscord | <Elegantbeef> Nope opir just cries |
09:16:02 | PMunch | About what |
09:16:20 | FromDiscord | <Elegantbeef> Sorry it's unable to parse the output of opir |
09:16:41 | PMunch | By the way @Elegantbeef I tried Elden Ring with first my old Ouya controller, then an Xbox One controller. And the difference between those and mouse+keyboard is night and day :P |
09:16:56 | PMunch | Could you just give me the full error message? :P |
09:17:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Rzf |
09:17:42 | FromDiscord | <Elegantbeef> Oh fuck i didnt see the above messages |
09:17:44 | PMunch | Aha, so that's a libclang error |
09:17:51 | FromDiscord | <Elegantbeef> My bad, i'll go in my hidey hole |
09:18:01 | PMunch | It basically means it wasn't able to parse the files |
09:18:15 | FromDiscord | <Waldecir Santos> In reply to @PMunch "@Waldecir_Santos, you're probably running": yeap, thank you |
09:18:18 | FromDiscord | <Elegantbeef> No no no, dont worry i was missing the actual errors above |
09:19:22 | PMunch | Ah right |
09:19:55 | FromDiscord | <Elegantbeef> My terminal was docked just enough that i seen the parsing of opir output but not the fatal error above |
09:20:06 | FromDiscord | <Elegantbeef> Just a simple include path isssue |
09:20:19 | FromDiscord | <Elegantbeef> 'simple' rather |
09:21:24 | FromDiscord | <Elegantbeef> Unknown type names, now that I can read 😛 |
09:22:39 | FromDiscord | <untoreh> can I `stat` a file at compile time? |
09:23:12 | FromDiscord | <Elegantbeef> You can use `gorge` to run a command at CT |
09:23:45 | PMunch | @Elegantbeef, so everything works fine now? |
09:24:05 | FromDiscord | <Elegantbeef> Well i have an issue with stdint.h but i now know where the errors are |
09:25:36 | FromDiscord | <untoreh> gorge doesn't help with debugging since at runtime I would use stat not exec |
09:26:57 | PMunch | @Elegantbeef, issue with stdint.h? |
09:27:51 | FromDiscord | <Elegantbeef> About 10 of `Error: unknown type name 'uint32_t'` |
09:29:44 | PMunch | From libclang? Or from Nim? |
09:30:01 | FromDiscord | <Elegantbeef> libclang i believe |
09:31:12 | PMunch | It sounds like you haven't set up your clang library imports correctly |
09:31:37 | PMunch | Do you have something like `sysPath "/usr/lib/clang/13.0.1/include"` in your Futhark definition? |
09:31:47 | FromDiscord | <Elegantbeef> i have the syspath setup just as you did and i checked and ensured it exists |
09:31:58 | PMunch | Just as I did? |
09:32:07 | FromDiscord | <Elegantbeef> In the futhark example |
09:32:19 | PMunch | Could you share the futhark definition you're using? |
09:32:47 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3Rzj |
09:34:02 | PMunch | And `find "/usr/lib/clang/12.0.1/include/" -name "stdint.h"` returns a file? |
09:34:15 | FromDiscord | <Elegantbeef> Yes |
09:34:23 | PMunch | You might need to add "/usr/lib/clang/12.0.1/include-fixed/" as well |
09:34:26 | FromDiscord | <Elegantbeef> Like i said i did ensure that path existed |
09:34:34 | FromDiscord | <Elegantbeef> That folder doesnt exist |
09:34:46 | PMunch | Okay, never mind that then :P |
09:34:48 | FromDiscord | <Elegantbeef> There is only `include` and `lib` |
09:36:23 | PMunch | Hmm, it worked for me (albeit with clang 13.0.1) |
09:36:36 | FromDiscord | <Elegantbeef> I can try 13 |
09:36:50 | FromDiscord | <Elegantbeef> Works |
09:36:59 | FromDiscord | <System64 ~ Flandre Scarlet> sent a long message, see http://ix.io/3Rzm |
09:38:55 | PMunch | @Elegantbeef, by the way, if you do this it pulls it about 6x the amount of definitions: http://ix.io/3Rzn/nim because it can now automatically import some more required stuff |
09:39:12 | FromDiscord | <Waldecir Santos> In reply to @PMunch "@Waldecir_Santos, you're probably running": Dup is "working" but the old object is affect too, seems like they have the same reference https://play.nim-lang.org/#ix=3Rzo |
09:39:18 | * | Zectbumo quit (Read error: Connection reset by peer) |
09:39:33 | * | Zectbumo joined #nim |
09:40:10 | PMunch | @System64_~_Flandre_Scarlet, Futhark will never create a ref type. So I believe the `Reference` part there is just because that is the documentation reference :P |
09:40:41 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "@System64_~_Flandre_Scarlet, Futhark will never": Ah alright, but why I can't set the values then? |
09:40:48 | FromDiscord | <Rika> Deep copy is needed because it’s a ref. I assume it only does a shallow copy |
09:41:02 | PMunch | Unions are just like structs, but instead of the fields being one after each other in memory, and you're able to set all the fields at the same time, a union has all the fields in the same memory location, and you're only able to set one of them. |
09:41:28 | FromDiscord | <System64 ~ Flandre Scarlet> it doesn't even purpose me to set the index https://media.discordapp.net/attachments/371759389889003532/950327313587904542/unknown.png |
09:41:33 | FromDiscord | <Waldecir Santos> In reply to @Rika "Deep copy is needed": Correct if I convert back to "non-ref" it works, I'll play around with it, lets see |
09:42:45 | FromDiscord | <System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/950327634305380402/unknown.png |
09:42:56 | PMunch | @System64_~_Flandre_Scarlet, just try it, might be that nimsuggest is broken |
09:43:20 | PMunch | Hmm |
09:43:55 | PMunch | You can try go-to definition for Tlntile and see if that gives you anything |
09:44:05 | FromDiscord | <System64 ~ Flandre Scarlet> wdym? |
09:44:25 | PMunch | Basically tell your editor to open where it is defined |
09:44:31 | PMunch | This should show you the Futhark cache file |
09:44:54 | FromDiscord | <System64 ~ Flandre Scarlet> I copied and renamed the futhark file |
09:45:25 | FromDiscord | <System64 ~ Flandre Scarlet> ah yeah it opens where it's defined |
09:45:57 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Rzp |
09:46:16 | PMunch | And now go to the definition of Tlntile_973078868 |
09:46:27 | FromDiscord | <System64 ~ Flandre Scarlet> ``Tlntile_973078868 = ptr uniontile_973078865`` |
09:46:37 | PMunch | And now to uniontile_973078865 |
09:47:05 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Rzq |
09:47:28 | PMunch | And now to uniontile_973078864 (this should be the last jump) |
09:47:28 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/K5D |
09:47:42 | PMunch | Hmm, weird |
09:47:44 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) |
09:48:15 | PMunch | I think I need to try this myself |
09:48:15 | FromDiscord | <System64 ~ Flandre Scarlet> both values are packed I guess? |
09:48:25 | PMunch | Yeah but it should work fine |
09:51:03 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "Yeah but it should": I dunno why it behaves like this |
09:51:47 | PMunch | Hmm |
09:51:53 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Rzs |
09:52:20 | PMunch | Hmm, it seems to be a Futhark bug |
09:52:56 | * | toulene joined #nim |
09:53:12 | PMunch | What you can do is copy that c2nim definition but name it `uniontile` before you run Futhark |
09:53:19 | PMunch | Or before you import the Futhark file |
09:53:40 | PMunch | All those `when defined()` statements should mean that it now uses your definition instead of the one generated by Futhark |
09:53:40 | FromDiscord | <System64 ~ Flandre Scarlet> it will work? |
09:53:48 | PMunch | Yeah that should work fine |
09:54:12 | PMunch | You can see from what you pasted here: https://play.nim-lang.org/#ix=3Rzq |
09:54:26 | PMunch | That it will grab that definition for uniontile if it exists already |
09:55:36 | FromDiscord | <System64 ~ Flandre Scarlet> so I have to replace that? |
09:55:45 | PMunch | No you don't have to replace anything |
09:56:20 | FromDiscord | <System64 ~ Flandre Scarlet> so what should I do? |
09:56:35 | PMunch | Simply take the definition you have from c2nim (and rename the uint16T stuff to normal Nim uint16) and paste that in before you import the file generated by Futhark (or run Futhark) |
09:57:09 | PMunch | Oh, and in that c2nim snippet, rename Tile to uniontile. |
09:58:06 | FromDiscord | <System64 ~ Flandre Scarlet> Like that I guess? https://media.discordapp.net/attachments/371759389889003532/950331498257592330/unknown.png |
09:58:15 | FromDiscord | <System64 ~ Flandre Scarlet> This is the Futhark file |
09:58:25 | PMunch | Nope |
09:58:31 | PMunch | Don't edit the Futhark file at all |
09:58:35 | PMunch | Never edit the Futhark file |
09:58:51 | FromDiscord | <System64 ~ Flandre Scarlet> alright |
09:59:00 | PMunch | Take line 2-9 in that snippet, and copy it into your project, right before you import that file. |
09:59:30 | PMunch | Oh wait, you should probably `include` that file now that I think about it |
09:59:30 | FromDiscord | <Elegantbeef> "Dont edit the futhark file at all" Jeez pmunch, you're not my mom you cant tell me what to do |
09:59:36 | PMunch | I think that's what Futhark does |
09:59:59 | PMunch | @Elegantbeef, haha, I mean edit it to your hearts desire, but don't come crying to me when stuff stops working :P |
10:00:09 | PMunch | Or when Futhark overrides the file because it is only a cache file |
10:00:36 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "Oh wait, you should": including that file? |
10:01:05 | PMunch | Change `import futhark_<numbers>.nim` to `include futhark_<numbers>.nim` |
10:01:27 | FromDiscord | <System64 ~ Flandre Scarlet> what's the difference? |
10:01:30 | PMunch | If you have copied that file into your project, if you're still running Futhark with importc you don't have to worry about it |
10:01:43 | PMunch | `include` essentially just reads the file and copies it into the current file |
10:01:54 | PMunch | `import` imports it as it's own separate module |
10:02:01 | FromDiscord | <System64 ~ Flandre Scarlet> ah yeah just like C then |
10:02:50 | PMunch | The Futhark `importc` macro returns the AST which it saves to the `futhark_<numbers>.nim` file, or an `include futhark_<numbers>.nim` statement |
10:03:24 | PMunch | And I think that you might need to `include` it for those `when declared` statements to work. But maybe not now that I think about it |
10:04:53 | FromDiscord | <System64 ~ Flandre Scarlet> okay I put this snippet into a separate file and imported the file before futhark |
10:05:12 | FromDiscord | <System64 ~ Flandre Scarlet> Like that (where TilengineBinding is the Futhark file) https://media.discordapp.net/attachments/371759389889003532/950333285261791232/unknown.png |
10:05:25 | PMunch | Hmm, that might work |
10:05:32 | PMunch | Haven't tested that |
10:07:08 | FromDiscord | <System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/950333772040126514/unknown.png |
10:08:05 | PMunch | Ah, it is now in a field called anoTilengine132 |
10:08:14 | PMunch | As you can see in your definition |
10:08:30 | FromDiscord | <System64 ~ Flandre Scarlet> yeah |
10:08:55 | PMunch | So you need to do tile.aneTilengine132.index |
10:11:04 | FromDiscord | <System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/950334760767610930/unknown.png |
10:13:54 | FromDiscord | <System64 ~ Flandre Scarlet> And I tried to cast, doesn't work |
10:14:54 | PMunch | That's because you do `var tile: Types.uniontile` |
10:15:04 | PMunch | That should be `var tile: Tlntile` |
10:16:05 | FromDiscord | <System64 ~ Flandre Scarlet> I have now only access to value |
10:16:40 | PMunch | Not to `anoTilengine132? |
10:16:54 | FromDiscord | <System64 ~ Flandre Scarlet> Not even |
10:17:24 | PMunch | I guess you need to include Types and TilengineBinding |
10:17:29 | PMunch | Instead of importing them |
10:18:25 | FromDiscord | <System64 ~ Flandre Scarlet> changes nothing, it gets even worse |
10:19:34 | PMunch | Worse? |
10:20:02 | FromDiscord | <System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/950337020419506176/unknown.png |
10:20:36 | * | Zectbumo quit (Ping timeout: 240 seconds) |
10:20:51 | * | Zectbumo joined #nim |
10:20:52 | PMunch | I mean that doesn't tell me anything.. |
10:21:17 | FromDiscord | <System64 ~ Flandre Scarlet> Well in fact the binding is imported in every module |
10:21:31 | FromDiscord | <System64 ~ Flandre Scarlet> like I have a module tilemap, it imports the binding |
10:24:51 | PMunch | This works for me: http://ix.io/3RzA |
10:25:38 | FromDiscord | <System64 ~ Flandre Scarlet> ah so I need to redo the Futhark thing? |
10:26:10 | PMunch | Well, what I would do is move TilengineBinding.nim to TilengineBindingRaw.nim |
10:26:27 | FromDiscord | <System64 ~ Flandre Scarlet> I did a copy of TilengineBinding |
10:26:33 | PMunch | And then have `TilengineBinding.nim` be that type definition, and then `include TilengineBindingRaw` at the bottom |
10:26:53 | PMunch | Then you can `import TilengineBinding` like you did before |
10:27:17 | PMunch | But I've gotta run |
10:27:21 | PMunch | Lunch break! |
10:27:25 | FromDiscord | <System64 ~ Flandre Scarlet> sent a long message, see http://ix.io/3RzD |
10:27:28 | FromDiscord | <System64 ~ Flandre Scarlet> Good lunch! |
10:29:28 | FromDiscord | <System64 ~ Flandre Scarlet> Btw this is the Binding https://media.discordapp.net/attachments/371759389889003532/950339391002378270/TilengineBinding.nim |
10:29:46 | FromDiscord | <System64 ~ Flandre Scarlet> It's literally the futhark file |
11:04:53 | * | Gustavo6046 quit (Quit: Leaving) |
11:10:30 | * | Zectbumo quit (Remote host closed the connection) |
11:20:16 | om3ga | Hi! What mean EDB in db/mysql? Is that constant(s), of what type or values? What I mean for example let db = open(..) .... if db == EDb: try... except... <-- will that work? |
11:20:25 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/kJg |
11:23:24 | * | toulene quit (Ping timeout: 256 seconds) |
11:24:33 | * | toulene joined #nim |
11:29:26 | * | toulene quit (Ping timeout: 272 seconds) |
11:32:06 | * | toulene joined #nim |
11:35:41 | PMunch | @System64_~_Flandre_Scarlet, yeah I have the header and my own Futhark set up to wrap it :) |
11:40:58 | * | toulene quit (Ping timeout: 256 seconds) |
11:42:40 | * | rawrrr quit (Quit: Connection closed for inactivity) |
11:44:04 | * | krux02 joined #nim |
11:50:04 | PMunch | Hmm, is there a way to do something like this in Nim? https://gcc.gnu.org/onlinedocs/gcc/Unnamed-Fields.html |
11:50:09 | PMunch | I'm guessing there isn't, right? |
11:54:21 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "@System64_~_Flandre_Scarlet, yeah I have": And can you use it as expected? |
11:54:47 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3RzZ |
11:54:52 | FromDiscord | <ynfle> In reply to @PMunch "Hmm, is there a": What's the purpose of this? |
11:57:27 | FromDiscord | <Rika> In reply to @ynfle "What's the purpose of": It is useful for unions I assume |
11:58:15 | PMunch | @System64_~_Flandre_Scarlet, yeah this works fine for me: http://ix.io/3RA0/nim |
11:58:39 | PMunch | @ynfle, @Rika, yes it's mostly for unions |
11:59:50 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "@System64_~_Flandre_Scarlet, yeah this works": ah alright, will try this, but I guess I need to re-Futhark the file again? |
11:59:54 | PMunch | You could define something like http://ix.io/3RA0/c |
12:00:07 | FromDiscord | <Rika> There isn’t in Nim |
12:00:14 | * | jmdaemon quit (Ping timeout: 256 seconds) |
12:00:22 | FromDiscord | <Rika> Probably nearly trivial to implement via macro |
12:01:02 | PMunch | Yeah I was thinking just some simple templates |
12:01:11 | PMunch | @System64_~_Flandre_Scarlet, nope |
12:01:29 | PMunch | @System64_~_Flandre_Scarlet, the file you have is exactly what would come from the cache right? |
12:02:02 | PMunch | You remember all the `when declared` statements and the weird type pointing to a type pointing to a type stuff we looked at earlier? |
12:02:12 | PMunch | That is to ensure that you can just drop in definitions like this |
12:05:18 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright |
12:05:25 | FromDiscord | <System64 ~ Flandre Scarlet> Okay so I changed the tile https://media.discordapp.net/attachments/371759389889003532/950363540634599454/unknown.png |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.4) |
12:06:30 | * | supakeen joined #nim |
12:07:23 | FromDiscord | <ynfle> In reply to @PMunch "<@757977788056600719>, <@259277943275126785>, yes i": Nim doesn't have unions |
12:07:52 | FromDiscord | <Rika> Nim has unions |
12:08:00 | FromDiscord | <Rika> Pragma union |
12:14:44 | FromDiscord | <Waldecir Santos> How can I print only the pointer of a object "0x1022d52d0" ? |
12:15:13 | FromDiscord | <Waldecir Santos> I've tried `repr obj.addr` but it prints more than the ptr |
12:15:52 | * | jmdaemon joined #nim |
12:16:04 | FromDiscord | <Rika> Cast it into an appropriate size integer then format into a hex string |
12:16:34 | FromDiscord | <Waldecir Santos> Oh nice, let me try it, thank you |
12:23:09 | * | jmdaemon quit (Ping timeout: 256 seconds) |
12:23:58 | PMunch | @System64_~_Flandre_Scarlet, as I said, don't use Types.uniontile |
12:24:15 | PMunch | Rather try to make sure that Futhark agrees with your definition |
12:24:20 | PMunch | Like I showed you in my example |
12:24:45 | PMunch | That way you don't need the cast either, simply tile.addr should yield the correct type for setTilemapTile |
12:29:30 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3RA8 |
12:32:06 | FromDiscord | <Waldecir Santos> In reply to @Rika "Cast it into an": This is what I did `&"{cast[int](qs1.addr):#X}"` that is what you meant, right ? |
12:33:36 | PMunch | @System64_~_Flandre_Scarlet, as I've already told you three times, there was no need to re-futhark the file. Of course it doesn't hurt at all, but it wasn't really necessary. I'm not sure what you're asking about right now, you can move those definitions anywhere you like |
12:33:59 | FromDiscord | <Waldecir Santos> Funny that #X return the hex with upper case letters, but nim normally output them as lower case, /shrug |
12:34:46 | FromDiscord | <Waldecir Santos> Nope the problem is with `#X`, `#x` returns it lower case. |
12:34:59 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright |
12:38:11 | FromDiscord | <System64 ~ Flandre Scarlet> But why doing the importc thing if I already have the futhark file? |
12:40:00 | PMunch | @System64_~_Flandre_Scarlet, if I where you I'd do something like this: https://play.nim-lang.org/#ix=3RAa |
12:40:14 | PMunch | Well Futhark is intended to be run whenever you compile your program |
12:40:18 | PMunch | That's why it caches stuff |
12:40:28 | PMunch | So that it will be fast |
12:40:57 | FromDiscord | <System64 ~ Flandre Scarlet> Aaaah alright! |
12:41:00 | PMunch | The idea is that if I download a more recent version of Tilengine than the one you wrapped it will still work just fine |
12:41:40 | FromDiscord | <System64 ~ Flandre Scarlet> good to know↵And the Raw file, it is the old one right? |
12:45:17 | PMunch | The Raw file is the cache file from Futhark, ref the comment on line 15 |
12:46:27 | PMunch | I guess I could add a flag to Futhark to output to a specific file as well. That way the importc block could simply have a `output "TilengineBindingRaw.nim"` and that snippet would be self contained |
12:47:18 | FromDiscord | <System64 ~ Flandre Scarlet> The problem is the Windows file paths |
12:47:25 | FromDiscord | <System64 ~ Flandre Scarlet> it makes the tool bugged |
12:47:50 | FromDiscord | <System64 ~ Flandre Scarlet> since it understands ``\`` as an escape symbol |
12:50:02 | FromDiscord | <enthus1ast> sent a code paste, see https://paste.rs/I3d |
12:50:20 | FromDiscord | <enthus1ast> regarding nimscripter |
12:58:44 | PMunch | @System64_~_Flandre_Scarlet, "the tool"? |
12:59:16 | FromDiscord | <Rika> probably opir |
13:05:58 | PMunch | Ah, someone who runs Windows and is good at Nim should really have a look at Futhark to fix the path handling |
13:06:13 | PMunch | I'd do it myself, but it's not exactly easy to do without a Windows machine :P |
13:07:02 | FromDiscord | <Rika> add "and also good at windows |
13:07:23 | FromDiscord | <Rika> i have windows, and am good enough at nim, but i have no clue how to do windows shit |
13:07:32 | * | rockcavera joined #nim |
13:07:32 | * | rockcavera quit (Changing host) |
13:07:32 | * | rockcavera joined #nim |
13:14:31 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "@System64_~_Flandre_Scarlet, "the tool"?": Futhark |
13:14:57 | Amun-Ra | and I have the same ammount of winboxes as PMunch has |
13:16:07 | * | jjido joined #nim |
13:16:41 | PMunch | @Rika, haha yeah I need someone who fits the categories "Good at Nim", "Good at Windows", "Good at linking C stuff" |
13:16:54 | PMunch | I just need to get hold of Araq don't I :P |
13:16:56 | FromDiscord | <Rika> unicorn |
13:17:01 | FromDiscord | <Rika> youll have more luck finding a unicorn |
13:17:05 | PMunch | Haha |
13:17:21 | PMunch | I have a friend actually who's dabbled a bit in Nim, maybe he'd be able to help me out |
13:21:30 | FromDiscord | <enthus1ast> the only fix i found was import system/nimscript in os.nim |
13:21:32 | FromDiscord | <enthus1ast> ... |
13:21:37 | FromDiscord | <enthus1ast> bug i guess |
13:50:17 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
13:52:14 | FromDiscord | <System64 ~ Flandre Scarlet> How can I instanciate an anonymous object of a type please |
13:52:27 | FromDiscord | <Rika> ? wdym |
13:53:17 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Rika "? wdym": I want to instanciate Tile objects in the loop https://media.discordapp.net/attachments/371759389889003532/950390682483318864/unknown.png |
13:53:52 | FromDiscord | <Rika> do you have an init proc for them? |
13:54:20 | FromDiscord | <System64 ~ Flandre Scarlet> no, why? |
13:55:28 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3RAw |
14:03:38 | FromDiscord | <System64 ~ Flandre Scarlet> Since when an int is immutable?↵It's not a constant https://media.discordapp.net/attachments/371759389889003532/950393292518989834/unknown.png |
14:04:30 | FromDiscord | <enthus1ast> the parametes to your function are |
14:04:39 | FromDiscord | <enthus1ast> must declare them with x\: var int |
14:04:44 | PMunch | I assume you wanted to change xTemp and not x? |
14:04:59 | FromDiscord | <enthus1ast> yes |
14:05:07 | FromDiscord | <System64 ~ Flandre Scarlet> ah yeah maybe I can do that |
14:05:57 | PMunch | You could also alias them with `var x = x`. That way the parameter will still be immutable, but the number will be copied into a variable in your procedure |
14:06:15 | FromDiscord | <System64 ~ Flandre Scarlet> Ah alright |
14:06:16 | * | slowButPresent joined #nim |
14:06:17 | PMunch | And by the way, why do you have Tilemap.Tile, are you still not doing it how I told you to do this? |
14:06:33 | FromDiscord | <System64 ~ Flandre Scarlet> It's a bit disturbing, coming from Java and C |
14:06:36 | PMunch | If you don't do it the way I told you it will likely mess up in a subtle way |
14:06:41 | FromDiscord | <Rika> what is Tilemap.Tile? |
14:06:45 | PMunch | What is a bit disturbing? |
14:07:04 | FromDiscord | <Rika> nim doesnt inherit much from C |
14:07:17 | FromDiscord | <System64 ~ Flandre Scarlet> I can't change the value of a parameter if it's not explicitly tell |
14:07:32 | FromDiscord | <Rika> thats good? |
14:07:42 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "And by the way,": It conflicts with the original one |
14:07:43 | FromDiscord | <Rika> could be a subtle bug |
14:08:25 | PMunch | @System64_~_Flandre_Scarlet, that is my point exactly. The original one is the one that Futhark will use, so if you don't override it properly, like I showed you, it will likely bug out in subtle ways |
14:10:04 | PMunch | @System64_~_Flandre_Scarlet, of course you can't change the value of a parameter that's not explicitly defined as mutable. C and Java just does this aliasing with `var x = x` by default I believe. In Nim if you do `var int` as the type for a parameter it is analogous to passing in a pointer, it will modify the value you passed in. |
14:25:17 | FromDiscord | <System64 ~ Flandre Scarlet> Oooh alright!↵So even in C and Java, it was always constant! |
14:26:57 | PMunch | Yup |
14:28:18 | FromDiscord | <System64 ~ Flandre Scarlet> Wow, it's good to know |
14:38:35 | * | PMunch quit (Quit: Leaving) |
14:43:39 | * | toulene joined #nim |
14:58:01 | * | toulene quit (Quit: Leaving) |
15:00:41 | * | PMunch joined #nim |
15:04:30 | * | arkurious joined #nim |
15:08:56 | FromDiscord | <System64 ~ Flandre Scarlet> it works well! https://media.discordapp.net/attachments/371759389889003532/950409722471809054/unknown.png |
15:09:25 | FromDiscord | <Rika> When the impostor is sus! |
15:11:36 | FromDiscord | <System64 ~ Flandre Scarlet> Tilengine is now sus! |
15:20:53 | FromDiscord | <abdu> what the Nim infinity set n range keyword symbol ? |
15:21:31 | FromDiscord | <Rika> huh? |
15:22:31 | supakeen | what the Nim infinity set n range keyword symbol ? |
15:23:43 | PMunch | -_- |
15:25:53 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "Yup": But is the importc thing necessary to override? |
15:26:18 | PMunch | What do you mean? |
15:26:52 | FromDiscord | <System64 ~ Flandre Scarlet> http://ix.io/3RA0/c↵Here |
15:27:50 | PMunch | Still not sure what you mean |
15:28:13 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "Still not sure what": from line 12 to 16 |
15:28:42 | PMunch | Yes that is the Futhark stuff |
15:29:23 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright |
15:32:05 | PMunch | As I said earlier, if you don't want your users to have to install Futhark I'd do it like this: https://play.nim-lang.org/#ix=3RBb |
15:32:57 | PMunch | That way if you compile with `-d:useFuthark` it will use the Futhark and wrap the actual header, otherwise it'll grab the pre-generated version |
15:33:27 | FromDiscord | <Ookl> Why does it say I got tagged ? |
15:33:54 | PMunch | Who knows, maybe someone tagged everyone? |
15:33:56 | FromDiscord | <Rika> I do not know |
15:34:16 | PMunch | Or someone on IRC mentioned your name and it auto-converted to a tag :P |
15:37:52 | * | toulene joined #nim |
15:39:33 | FromDiscord | <System64 ~ Flandre Scarlet> Aaaah now I understand |
15:42:29 | * | PMunch quit (Quit: leaving) |
15:53:29 | * | jjido joined #nim |
16:04:54 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
16:13:48 | * | toulene quit (Quit: ZNC - https://znc.in) |
16:20:56 | FromDiscord | <Require Support> are vars under "when isMainModule" considered global? like can other procs access them |
16:30:32 | * | neurocyte0917090 joined #nim |
16:36:57 | FromDiscord | <SolitudeSF> \`when\` doesnt open new scope↵(@Require Support) |
16:39:08 | * | rockcavera quit (Ping timeout: 272 seconds) |
17:08:02 | * | rockcavera joined #nim |
17:08:02 | * | rockcavera quit (Changing host) |
17:08:02 | * | rockcavera joined #nim |
17:18:58 | * | oz quit (Remote host closed the connection) |
17:59:37 | * | ox joined #nim |
18:08:29 | * | jjido joined #nim |
18:29:02 | * | nexeq quit (Quit: WeeChat 3.4) |
18:31:28 | FromDiscord | <gibson> (sry, wrong channel before)↵Is anyone familiar with passing pointers from nim to py with nimpy? Someone asked in issues previously, but removed their own issue. Nimpy doesn't understand pointers so gets confused, and I'm unsure how to use PyCapsules in nimpy to accomplish this. I'd like to create a numpy array from a pointer to existing data (PyArray_SimpleNewFromData). |
18:50:57 | FromDiscord | <Require Support> quick way to convert string into char array? |
18:52:36 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
18:52:50 | FromDiscord | <huantian> In reply to @Require Support "quick way to convert": sequtils as toSeq |
18:52:55 | FromDiscord | <huantian> (edit) "as" => "has" |
18:55:45 | FromDiscord | <Generic> In reply to @Require Support "quick way to convert": char array as in array[n, char]? |
18:56:06 | FromDiscord | <auxym> In reply to @huantian "sequtils has toSeq": this will copy the string into the array, but yes it's probably the best way (unless you're interacting with C and just want to pass a bare pointer to the data) |
18:56:17 | FromDiscord | <gibson> `toOpenArray(x: cstring; first, last: int): openArray[char]` in system |
18:56:22 | FromDiscord | <Generic> yeah |
18:56:39 | FromDiscord | <Generic> there's also an overload which works on normal strings |
18:57:01 | FromDiscord | <gibson> (edit) "cstring;" => "string;" |
19:00:03 | FromDiscord | <Require Support> thanks guys |
19:05:08 | FromDiscord | <gibson> @Require Support there's also cstring: `myString.cstring` is a zero-copy type conversion to a Compatible String (basically pointer to the first char position) |
19:06:00 | FromDiscord | <Require Support> In reply to @gibson "<@!710108871724761128> there's also cstring:": omg, a life saver - that worked perfectly ❤️ |
19:09:32 | * | droidrage quit (Quit: Gateway shutdown) |
19:09:32 | * | qwestion quit (Quit: Gateway shutdown) |
19:27:00 | * | mjsir911 quit (Remote host closed the connection) |
19:27:15 | * | mjsir911 joined #nim |
19:29:39 | FromDiscord | <Phil> Might I ask the more macro heavy folks among you something? |
19:31:34 | FromDiscord | <tandy> is there a way to convert `seq[string]` to `seq[cstring]`? |
19:32:00 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3RCK |
19:38:49 | * | vicfred joined #nim |
19:42:01 | * | vicfred_ joined #nim |
19:44:17 | * | vicfred quit (Ping timeout: 240 seconds) |
19:44:29 | FromDiscord | <Phil> Wait a second |
19:49:50 | FromDiscord | <Phil> Ah yes, reading |
19:49:55 | FromDiscord | <Phil> one uses typed, the other ref object |
19:50:11 | FromDiscord | <Phil> Of course they're not going to work the same since dot is more specific than getField |
20:20:50 | * | jmdaemon joined #nim |
20:28:14 | FromDiscord | <gibson> In reply to @tandy "is there a way": For `seq[string]` to `seq[cstring]` I've been wanting that as well. AFAIK there is no way without looping through the data. You could theoretically do some fancy casting, but as I was recently advised on here, you should not assume the memory layout of the nim string datatype. |
20:42:47 | FromDiscord | <Generic> do you need a const char array for some c api? |
20:44:32 | FromDiscord | <Generic> also you need to be careful with a seq[cstring] the cstrings can very easily outlive their original strings |
20:49:00 | * | vicfred_ quit (Quit: Leaving) |
20:49:35 | * | vicfred joined #nim |
20:54:14 | FromDiscord | <auxym> there's the reverse here: https://nim-lang.org/docs/system.html#cstringArrayToSeq%2CcstringArray |
20:55:05 | * | Zectbumo joined #nim |
21:27:28 | FromDiscord | <Generic> that's where I was going |
21:27:32 | * | jjido joined #nim |
21:27:52 | FromDiscord | <Generic> you can use allocstringarray to convert a seq[string] to cstringarray |
21:28:08 | * | Gustavo6046 joined #nim |
21:42:35 | * | wyrd quit (Ping timeout: 240 seconds) |
21:44:40 | * | wyrd joined #nim |
22:15:19 | FromDiscord | <Elegantbeef> I think it requires a PR to the compiler to make it so it can work, looked at it briefly, there is an issue opened on nimscripter for it |
22:16:26 | FromDiscord | <enthus1ast> i patched my os.nim |
22:16:59 | FromDiscord | <Elegantbeef> Yea i read, that's not a solution though |
22:17:07 | FromDiscord | <enthus1ast> yes true |
22:17:41 | FromDiscord | <enthus1ast> imho just a conditional import was missing |
22:20:21 | FromDiscord | <asampal (Adrian Sampaleanu)> anyone know if the Windows build is currently working? |
22:21:37 | nrds | <Prestige99> for stable it is |
22:22:12 | FromDiscord | <asampal (Adrian Sampaleanu)> running from Powershell and getting pretty unexpected output\:↵`↵` |
22:22:41 | FromDiscord | <enthus1ast> [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org)\: i also don't know yet if nimscripter is the right route for me |
22:22:44 | FromDiscord | <asampal (Adrian Sampaleanu)> would expect it to try using the VS compiler |
22:22:54 | nrds | <Prestige99> asampal I don't see your output |
22:23:54 | FromDiscord | <Elegantbeef> Hey use whatever you want, there are issues with nimscripter when using nim modules that do need fixed or workarounds |
22:24:29 | FromDiscord | <Elegantbeef> Oh you're building fro msource |
22:24:45 | FromDiscord | <asampal (Adrian Sampaleanu)> as opposed to? |
22:24:56 | FromDiscord | <Elegantbeef> Getting a pre compiled binary |
22:24:56 | FromDiscord | <enthus1ast> no offence i just don't know yet what is better, another option i have is direct PNode generation, i guess nimscripter transforms NimNodes to PNodes? |
22:25:07 | FromDiscord | <enthus1ast> (better for my use case i mean) |
22:25:11 | FromDiscord | <Elegantbeef> Nimscripter transforms Nim code into pnodes and vice versa |
22:25:24 | FromDiscord | <Elegantbeef> It doesnt touch nimnodes |
22:25:28 | FromDiscord | <asampal (Adrian Sampaleanu)> well, a precompiled binary wouldn't be building it |
22:25:54 | FromDiscord | <Elegantbeef> Hey i thought the intent was getting a binary, my bad |
22:26:23 | FromDiscord | <Elegantbeef> You dont have gcc in your path |
22:26:42 | FromDiscord | <asampal (Adrian Sampaleanu)> I have Visual Studio installed though |
22:26:52 | FromDiscord | <asampal (Adrian Sampaleanu)> shouldn't the build use that? |
22:26:52 | FromDiscord | <Elegantbeef> In powershell I assume `gcc --version` doesnt work? |
22:27:07 | FromDiscord | <asampal (Adrian Sampaleanu)> nope |
22:27:09 | FromDiscord | <Elegantbeef> No it uses gcc by default, you might be able to force it to use vcc |
22:28:15 | FromDiscord | <Elegantbeef> Install mingw is what i'd say |
22:28:55 | FromDiscord | <Elegantbeef> Dont know where the build.bat file is so dont know how to force vcc to be used |
22:29:01 | FromDiscord | <asampal (Adrian Sampaleanu)> got WSL for Linux-y stuff |
22:29:09 | FromDiscord | <asampal (Adrian Sampaleanu)> don't use mingw any longer |
22:29:45 | FromDiscord | <asampal (Adrian Sampaleanu)> under Windows I would expect VS should be fine - I'll see what's needed to make it use that, I guess |
22:30:05 | FromDiscord | <Elegantbeef> Well mingw is what Nim defaults for a compiler on windows, so you have to override that to be vcc |
22:30:16 | FromDiscord | <Elegantbeef> It should be relatively simple i reason but i dont see how |
22:31:43 | FromDiscord | <Elegantbeef> Ah it's in the csources |
22:32:01 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/csources_v1/blob/master/build.bat#L3-L4 setting these two flags after it clones the csources to be vcc might work |
22:32:19 | FromDiscord | <Elegantbeef> Then you have to pass `--cc:vcc` to all the nim commands |
22:32:29 | FromDiscord | <Elegantbeef> Or change your config to use vcc by default |
22:35:37 | FromDiscord | <Elegantbeef> [enthus1ast](https://matrix.to/#/@sn0re:matrix.code0.xyz)\: what're you working on anywho? |
22:44:52 | FromDiscord | <asampal (Adrian Sampaleanu)> sent a code paste, see https://play.nim-lang.org/#ix=3RDK |
22:58:08 | anddam | do I need to reinstall packages after I upgraded 1.6.2 > 1.6.4 ? |
22:58:28 | FromDiscord | <gibson> In reply to @asampal (Adrian Sampaleanu) "got WSL for Linux-y": Make sure you are using the Visual Studio Development Terminal I forget what it's called but there's a shortcut in your Start menu somewhere. That will call the right script that sets a ton of VS/MS environment variables so nim can call the compiler tools correctly. |
22:58:50 | FromDiscord | <gibson> Do all your compiler stuff in that terminal. |
23:00:47 | FromDiscord | <gibson> https://docs.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2022 |
23:16:32 | FromDiscord | <gibson> Does anyone know a AoS/SoA library for nim? I thought there was an older one, but all I found was this: https://github.com/guibar64/aossoa |
23:16:56 | FromDiscord | <gibson> (edit) "this:" => "this by treeform:" |
23:17:17 | FromDiscord | <gibson> (edit) "this by treeform: https://github.com/guibar64/aossoa" => "this://github.com/guibar64/aossoa" |
23:17:32 | FromDiscord | <gibson> (edit) "this://github.com/guibar64/aossoa" => "this: https://github.com/guibar64/aossoa" |
23:17:42 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
23:17:47 | FromDiscord | <Elegantbeef> No you dont need to update packages |
23:18:17 | FromDiscord | <Elegantbeef> There is https://github.com/liquidev/datarray @gibson |
23:18:52 | FromDiscord | <gibson> @ElegantBeef Ah! That's it, thanks. |
23:20:24 | FromDiscord | <Elegantbeef> It's relatively easily to make with macros eitherway |
23:24:18 | FromDiscord | <gibson> I know, but I'm trying to keep the code that's here legible to newbs on the project, and using something that already has tests and docs as a black box of non-concern is easier for that purpose. |
23:24:28 | FromDiscord | <Elegantbeef> Ah |
23:29:32 | * | jmdaemon quit (Ping timeout: 272 seconds) |
23:44:49 | * | jmdaemon joined #nim |
23:55:03 | FromDiscord | <Alea> So I just saw that post about NimSkull↵Will existing libs be compatible with that? |
23:55:47 | FromDiscord | <Elegantbeef> Presently many, but as time goes on fewer and fewer |
23:59:46 | FromDiscord | <Elegantbeef> Anything with async will not work since they want to use CPS instead |