<< 09-05-2022 >>

00:17:28*nerthus left #nim (Doei!)
00:46:31*Guest97 joined #nim
00:57:33*Zectbumo_ quit (Remote host closed the connection)
01:05:27*noeontheend quit (Ping timeout: 276 seconds)
01:10:40*Guest97 quit (Quit: Client closed)
01:15:07FromDiscord<Zectbumo> Why does nim -c compileToC t.nim make a nimcache and then I delete the folder and delete the executable and re run the command it doesn't create the nimcache files anymore? What is causing it to work once and then continue to fail afterwards?
01:48:21FromDiscord<!Patitotective> In reply to @hmmm "yes pls, uncle hmm": like this? lol https://media.discordapp.net/attachments/371759389889003532/973038685564076032/unknown.png
02:20:59*noeontheend joined #nim
02:21:33FromDiscord<theangryepicbanana> according to the manual, https://nim-lang.org/docs/manual_experimental.html#strict-not-nil-checking-nil should work and be implemented, but as of the current version of nim it is not
02:21:47FromDiscord<theangryepicbanana> anyone know why?
02:22:48FromDiscord<Elegantbeef> What do you mean?
02:23:35FromDiscord<theangryepicbanana> if I have `type A = ref int not nil`, then `A nil` should remove the `not nil` part but currently does not
02:23:55FromDiscord<theangryepicbanana> and instead, it gives an error
02:27:08FromDiscord<Elegantbeef> Seems it's `nil(A)`
02:27:31FromDiscord<theangryepicbanana> huh, weird
02:27:32FromDiscord<theangryepicbanana> thanks
02:27:37FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/BWF
02:28:20FromDiscord<Elegantbeef> I mean it makes more sense than `A nil` since that's just a type conversion from Nil
02:28:48FromDiscord<Elegantbeef> I dont know if it's correct just that it compiles
02:31:43FromDiscord<theangryepicbanana> yeah it seems to work
02:33:03*arkurious quit (Quit: Leaving)
02:46:10FromDiscord<theangryepicbanana> are you not able to have object values inside of non-objects?
02:46:18FromDiscord<theangryepicbanana> (edit) "non-objects?" => "object refs?"
02:46:24FromDiscord<Elegantbeef> What?
02:46:55FromDiscord<Yardanico> waiting for pmunch to wake up to tell him some futhark windows bugs :P i mostly managed to find fixes for them, but there's one libclang issue (I think) about filenames sometimes containing / instead of \\ on Windows which breaks some futhark logic
02:47:09FromDiscord<theangryepicbanana> for example, I have a ref object with a field of a Table value, there's no initial error, but when I go to use said ref object somewhere else, I get an error
02:47:47FromDiscord<Elegantbeef> Min code?
02:47:58FromDiscord<theangryepicbanana> sent a code paste, see https://play.nim-lang.org/#ix=3XkU
02:48:06FromDiscord<theangryepicbanana> this errors at `f`
02:48:07FromDiscord<Elegantbeef> `Foo` is nil by default
02:48:14FromDiscord<theangryepicbanana> yes
02:48:28FromDiscord<theangryepicbanana> but it errors because of the table, as the error goes away when I comment out the table field
02:48:29FromDiscord<Elegantbeef> That compiles fine
02:48:38FromDiscord<theangryepicbanana> hmm
02:48:46FromDiscord<theangryepicbanana> maybe it's a nimlsp issue?
02:48:57FromDiscord<Elegantbeef> Probably nimsuggest false positive
02:49:08FromDiscord<theangryepicbanana> cool, how do I disable this?
02:49:33FromDiscord<theangryepicbanana> this is also probably why I couldn't create a ref to an alias to a table
02:51:20FromDiscord<huantian> disable nimsuggest?
02:51:32FromDiscord<theangryepicbanana> disable this specific kind of error
02:51:37FromDiscord<theangryepicbanana> clearly it's an editor issue
02:51:48FromDiscord<Elegantbeef> It's a bug
02:51:54FromDiscord<theangryepicbanana> pog
02:51:57FromDiscord<Elegantbeef> Nimsuggest has a bug right now in 1.6+
02:52:06FromDiscord<theangryepicbanana> easily fixed or long term?
02:52:18FromDiscord<Elegantbeef> I mean i have a bodge fix but no proper fix
02:52:33FromDiscord<theangryepicbanana> what's the cause?
02:52:53FromDiscord<Elegantbeef> It recreates types/symbols instead of looking if the symbol/type exists. Which means there are multiple reference that are not the same so `==` doesnt work on them
02:53:04FromDiscord<theangryepicbanana> ah
02:53:05FromDiscord<Elegantbeef> That's if it is the issue i think it is
02:53:23FromDiscord<Elegantbeef> The bodge fix is here https://github.com/nim-lang/Nim/pull/19748/files
02:53:23FromDiscord<theangryepicbanana> that would probably just be fixed using a cache, yeah?
02:53:31FromDiscord<Elegantbeef> Well no
02:53:58FromDiscord<Elegantbeef> The issue is that it regenerates the types/symbols, the solution is to look if they exist prior on nimsuggest and if they match
02:54:04FromDiscord<Elegantbeef> If so reuse the old ones then carry one
02:54:14FromDiscord<theangryepicbanana> yeah that's essentially what a cache does
02:54:20FromDiscord<Elegantbeef> So i guess that's a "cache" but not what i'd consider one
02:56:06FromDiscord<theangryepicbanana> how soon do you think the "fix" will be merged/released?
02:56:47FromDiscord<Elegantbeef> If i get a non bodge fix whenever that is otherwise never
02:57:23FromDiscord<theangryepicbanana> great
02:57:37FromDiscord<Elegantbeef> I mean it's a bodge fix it's not proper in any regard
02:57:50FromDiscord<Elegantbeef> The best thing you can do is build nimsuggest/nimlsp with that bodge
02:58:48FromDiscord<theangryepicbanana> hmm perhaps
02:59:27FromDiscord<Elegantbeef> I know where the issue comes from but am not certain how to fix i
03:00:35FromDiscord<theangryepicbanana> maybe I'll look at it idk, not familiar with either codebase
03:01:33FromDiscord<theangryepicbanana> unsure if it helps, but the errors temporarily go away if you save in the file that the "repeated symbols" come from
03:01:35FromDiscord<Elegantbeef> It's possibly unrelated to that
03:01:46FromDiscord<Elegantbeef> I just assume it's related
03:06:01*stkrdknmibalz joined #nim
03:16:06FromDiscord<Elegantbeef> @theangryepicbanana\: if you do get a min repro do send it to me
03:16:28FromDiscord<theangryepicbanana> In reply to @Elegantbeef "<@356108561232953344>\: if you do": will do
03:30:24*noeontheend quit (Ping timeout: 276 seconds)
03:40:19FromDiscord<Yardanico> finally https://media.discordapp.net/attachments/371759389889003532/973066859597430794/unknown.png
03:40:29FromDiscord<Yardanico> sciter with nim on windows
03:49:23*xet7 joined #nim
03:53:58FromDiscord<spoon> saw that looking into html UIs, how good is nim-ui interop compared to something like neel?
03:54:41FromDiscord<spoon> (i didnt see bindings for sciter, just sciter itself)
03:55:17FromDiscord<Yardanico> In reply to @spoon "saw that looking into": i mean, my current sciter bindings are pretty bare-bones, but it's possible to do stuff with them
03:55:34FromDiscord<Yardanico> in Sciter you can develop your app all through native code or leave the UI logic to JS (previously they used TIScript)
03:55:41FromDiscord<Yardanico> the latter is much better because UI logic is asynchronous and stuff
03:55:48FromDiscord<Yardanico> so you can only register some native functions that you want to call
03:56:06FromDiscord<Yardanico> compare https://github.com/Yardanico/nsciter/blob/master/examples/repl/repl1.nim and https://github.com/Yardanico/nsciter/blob/master/examples/repl/repl2.nim
03:56:17FromDiscord<Yardanico> (and check the corresponding .htm files as well)
03:56:19FromDiscord<spoon> can you register a nim procedure as a button press without javascript?
03:56:24FromDiscord<Yardanico> yes
03:56:36FromDiscord<Yardanico> again, you can mostly do anything through native code only, but it'll be more verbose
03:56:47FromDiscord<spoon> ah good, sounds like something ive been looking for
03:57:20FromDiscord<Yardanico> but again, the bindings i have are really rough, there is no high level stuff at all :) they're based on much much much older sciter bindings of someone else, I've changed quite some stuff in them
03:57:33FromDiscord<Yardanico> https://github.com/citrusn/nsciter is the original
03:57:35FromDiscord<spoon> ah
03:57:43FromDiscord<Yardanico> and they forked from sciter-sdk/nsciter
03:58:14FromDiscord<spoon> oh, they have an official nim repo?
03:58:20FromDiscord<Yardanico> yes, but again, it's been abandoned for years
03:58:27FromDiscord<Yardanico> maybe i will upstream my nsciter to there in the future
03:58:43FromDiscord<spoon> kinda expected but still cool
03:59:07FromDiscord<Yardanico> but yeah, sciter isn't actually that hard to wrap, it has a nice C FFI with one big interface-style object that has different function pointers, and you just call into that
03:59:18FromDiscord<Yardanico> original sciter-sdk nsciter was done with manual wrapping
03:59:29FromDiscord<Yardanico> my nsciter was initially based on nimterop, and recently i've changed it to use futhark
03:59:56FromDiscord<Yardanico> but I just save the resulting generated files anyway so the end user doesn't need to have futhark or any libclang stuff installed
04:00:20FromDiscord<Elegantbeef> The way to live πŸ˜„
04:00:57*lumo_e quit (Ping timeout: 276 seconds)
04:01:07FromDiscord<Elegantbeef> I do kinda wish we could do like `writeTo "wasmedge/futharked.nim"` πŸ˜„
04:02:00FromDiscord<Yardanico> but yeah, to be honest I haven't yet made anything with nsciter myself, it's just like a toy project where I fix some stuff from time to time
04:02:13FromDiscord<Yardanico> but at least I have proper SciterValue binding with destructors, sinks and all that stuff
04:02:19FromDiscord<Elegantbeef> It's the russian GUI library afaict πŸ˜›
04:02:32FromDiscord<Yardanico> he emigrated to canada in 90s :)
04:02:55FromDiscord<Elegantbeef> I more joke that a lot of russian relayed tools use it
04:03:05FromDiscord<Yardanico> but yeah, it's an interesting lib in that it's actually really popular (basically all AVs use it, TeamViewer, etc), but not well-known
04:03:14FromDiscord<Elegantbeef> Doesnt gaijan use it for theirs?
04:03:16FromDiscord<Yardanico> well-known in general, compared to other gui frameworks
04:03:21FromDiscord<Yardanico> In reply to @Elegantbeef "Doesnt gaijan use it": only for the launcher, yes
04:03:28FromDiscord<Yardanico> war thunder's launcher, maybe others too
04:03:44FromDiscord<Yardanico> i checked teamviewer binary myself and there are sciter strings in there
04:03:58FromDiscord<Yardanico> they all pay for it so they can statically link :P
04:04:03FromDiscord<Yardanico> and have access to the actual source code
04:04:24FromDiscord<Elegantbeef> Free forces dynamic linking?
04:04:43FromDiscord<Yardanico> yes, they only give you sciter.dll (or similar stuff for other platforms) with no warranty
04:04:49FromDiscord<Yardanico> https://gitlab.com/sciter-engine/sciter-js-sdk
04:05:16FromDiscord<Yardanico> and you must state the fact that you use sciter in your app (in About menu or similar)
04:07:32FromDiscord<Yardanico> I think if it was open-source it'd probably be really popular, even more than it is already
04:07:55FromDiscord<Yardanico> because it's really HTML/CSS for desktop applications done right
04:08:41FromDiscord<Yardanico> the DLL and .so are literally ~8-10mb and this is everything that sciter offers, it has its own custom html, css engines, etc
04:08:49FromDiscord<Yardanico> although yeah, Sciter's CSS is not fully compatible with normal CSS
04:09:05FromDiscord<Yardanico> its HTML is compatible, but there are some Sciter-specific HTML extensions (mostly sugar stuff)
04:25:56FromDiscord<icewater200> is nim h
04:48:27*slowButPresent quit (Quit: leaving)
05:04:06*ecs quit (*.net *.split)
05:04:06*mjsir911 quit (*.net *.split)
05:04:06*LyndsySimon quit (*.net *.split)
05:04:14*ecs joined #nim
05:04:20*mjsir911 joined #nim
05:04:21*mjsir911 quit (Changing host)
05:04:21*mjsir911 joined #nim
05:04:23*LyndsySimon joined #nim
05:11:30*adium quit (*.net *.split)
05:12:12*adium joined #nim
06:08:40*haliucinas quit (Ping timeout: 260 seconds)
06:15:25FromDiscord<pmunch> This in a planned feature
06:15:38FromDiscord<Elegantbeef> Yay!
06:16:24*PMunch joined #nim
06:21:26NimEventerNew Nimble package! resultsutils - Utility macros for easier handling of Result, see https://github.com/nonnil/resultsutils
06:28:45FromDiscord<Rika> Cool
06:44:53*jjido joined #nim
07:16:38*gsalazar joined #nim
07:26:26FromDiscord<jmgomez> Hey guys, when calling NimMain in a dynlib I got a linker error. Can I initialize nim inside my nim dll (i.e. behind a custom function)?
07:26:49FromDiscord<Elegantbeef> You probably should use `--mm:orc`
07:28:46FromDiscord<jmgomez> so you dont have to call NimMain?
07:29:14FromDiscord<Elegantbeef> You only need to call NimMain if there are top level statements with a `orc` dynamic library
07:30:22FromDiscord<jmgomez> Okay, will give that a shot. Also is there a way to do the init from nim?
07:30:34FromDiscord<Rika> I still think you should figure out how to call the function rather than change mm for that
07:30:36FromDiscord<Elegantbeef> I'm testing now
07:31:01PMunch@jmgomez, the way I've done this is to use `--noMain` and then in the init procedure you can call NimMain yourself
07:31:25FromDiscord<Elegantbeef> You have to import your own `NimMain` right?
07:31:33PMunchYes
07:31:38FromDiscord<jmgomez> In reply to @Rika "I still think you": Im looking to see what mm is
07:31:46FromDiscord<Elegantbeef> memory management
07:31:56PMunch`proc nimMain() {.importc: "NimMain".}` something like that
07:32:05FromDiscord<Elegantbeef> refc is the default and it Requires calling `NimMain`
07:32:15FromDiscord<jmgomez> In reply to @PMunch "`proc nimMain() {.importc: "NimMain".}`": okay, that was my next question lol. Thanks!
07:32:19FromDiscord<Elegantbeef> orc/arc only require it if your code has any top level statements
07:32:39FromDiscord<jmgomez> Okay, but it wont do any harm to have it regardless the method, right?
07:32:48FromDiscord<Elegantbeef> Right
07:32:56PMunchYeah, I don't actually call NimMain because I don't have any top-level stuff
07:33:07PMunchBut yeah, no harm in calling it
07:33:29FromDiscord<Elegantbeef> I think it internally has a `once` block
07:33:43FromDiscord<jmgomez> Thanks guys!
07:33:46FromDiscord<Elegantbeef> So you cannot accidently init twice
07:34:16FromDiscord<Elegantbeef> @huantian\: if you care about an update i'm now at the point of calling host functions from wasm πŸ˜„
07:35:23FromDiscord<Elegantbeef> The simples part really is compiling to wasm like this is all i need https://github.com/beef331/wasmedge_playground/blob/master/wasmsources/hooks.nim
07:36:10FromDiscord<Elegantbeef> Though i'd like to import from specific named modules, but dont know if emscripten can do that, right now it's always looking in the `env` moduel
07:57:03FromDiscord<jmgomez> sent a code paste, see https://paste.rs/M0p
07:57:26FromDiscord<jmgomez> (edit) "https://play.nim-lang.org/#ix=3Xly" => "https://play.nim-lang.org/#ix=3Xlx"
07:57:44FromDiscord<Elegantbeef> no it's a global variable
07:58:37FromDiscord<Elegantbeef> Hmm actually it miight dispose but being a global variable makes reasoning hard
07:59:58FromDiscord<Elegantbeef> In the case of normal logic `t: thing` copies `t` and then `obj` owns that string
08:00:10FromDiscord<Elegantbeef> copies `thing`\
08:01:17FromDiscord<jmgomez> That was my expectation but I do get a crash if I dont put thing inside whateverUsesThing
08:02:21FromDiscord<Elegantbeef> What?
08:02:55FromDiscord<Rika> So did you call Nim main in this case
08:04:19FromDiscord<jmgomez> Yes, I did via (I dont get the crash when thing is inside the proc) not sure if that would change with NimMain? It may be that it isnt being correctly called? I did use PMunch's imporc trick
08:04:40FromDiscord<jmgomez> (edit) "via" => ""
08:04:44FromDiscord<Elegantbeef> Using the default mm?
08:05:00FromDiscord<jmgomez> yes
08:05:58FromDiscord<Elegantbeef> you do call `whateverUsesThing` after `NimMain` right? πŸ˜„
08:06:25FromDiscord<jmgomez> Yup
08:06:53FromDiscord<jmgomez> Just did a test to call it without nimMain no make sure it was working and it didnt work at all (not even one time)
08:07:17PMunchHm, it shouldn't dispose it
08:07:36PMunchDo you still have to call setupForeignThreadGC with refc?
08:08:12FromDiscord<Elegantbeef> > This function is available only when --threads\:on and --tlsEmulation\:off switches are used
08:10:53FromDiscord<Elegantbeef> I just tested works fine here
08:11:34FromDiscord<jmgomez> How did you tested it?
08:12:22FromDiscord<jmgomez> I just did another test and got it working once and the second time crashes. I did make it const this time to make sure and it did work
08:12:27FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XlE
08:14:06FromDiscord<jmgomez> I do have another level of nest with the object creation but it should be the same
08:14:18FromDiscord<jmgomez> ohh
08:14:23FromDiscord<jmgomez> did you try with the cpp backend?
08:14:50FromDiscord<jmgomez> (also Im calling it on cpp for getting the crash but the "client" I think shouldnt matter
08:16:08FromDiscord<Elegantbeef> Works fine still
08:19:13FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3XlH
08:20:20FromDiscord<Elegantbeef> Are you accidently using `stdcall` and `cdecl`?\>
08:20:52FromDiscord<Elegantbeef> Like are you actually declaring the procedure with `stdcall`?
08:26:52FromDiscord<jmgomez> I used stdcall because it what the code example on the loadLib documentation shown
08:27:03FromDiscord<jmgomez> but not sure how it may be related, could you elaborate on that?
08:27:07FromDiscord<Elegantbeef> Sure but are you annotating `whateverUsesThing` with it?
08:27:19FromDiscord<Elegantbeef> If your procedure doesnt have the same calling convention it's going to error
08:27:28FromDiscord<Elegantbeef> Either abruptly or silently
08:27:41FromDiscord<Elegantbeef> If you dont know that you need it remove it from the cast
08:28:00FromDiscord<Elegantbeef> There also isnt any reason to cast it to a gcsafe
08:28:05FromDiscord<mratsim> In reply to @jmgomez "I used stdcall because": someone wrote the documentation on a old windows
08:28:36FromDiscord<Elegantbeef> stdcall is a calling convention and mixing calling conventions can cause crashes or silently failures
08:29:07FromDiscord<jmgomez> okay, will remove those and check again if the error is still there
08:29:20FromDiscord<Elegantbeef> So if your code doesnt have a calling convention you can do `cast[proc(): cstring {.nimcall.}](lib.symAddress("whatEverUsesThing"))`
08:29:38FromDiscord<Elegantbeef> Nim's `proc` type defaults to closure so it's somewhat important to add the `nimcall`
08:29:41FromDiscord<Elegantbeef> It's nim's default calling convention
08:29:58FromDiscord<Elegantbeef> I should say it defaults to closure in type settings
08:32:32FromDiscord<jmgomez> gotcha, just did a retest and it keeps happening. Something else that I could check against? Maybe changing the mm?
08:33:08FromDiscord<Elegantbeef> Ok what's your library code and calling code again?
08:33:51FromDiscord<Elegantbeef> > I think those should be completely revamped to use either iterators (require iterator chaining)↡Mratsim this makes me happy to read but after playing around with closure generators it's not great πŸ˜„
08:34:38FromDiscord<Elegantbeef> Presently closure iterators are way too slow
08:36:55*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
08:40:21*duuuuuude joined #nim
08:44:56*jjido joined #nim
08:45:26FromDiscord<Elegantbeef> @jmgomez\: wait a minute are you returning a cstring from a string that's copied?
08:53:50*lumo_e joined #nim
08:54:48FromDiscord<jmgomez> Yes, but as you can see in the image the crash is not happening due to that (which I would love to know the proper way to create/deallocate them anyways πŸ˜… ) https://media.discordapp.net/attachments/371759389889003532/973146006898225182/Screenshot_2022-05-09_at_10.53.19.png
08:55:42FromDiscord<Elegantbeef> Ok but what's your code
08:55:56FromDiscord<Elegantbeef> We know it's erroring with an append
08:56:04FromDiscord<Elegantbeef> But that doesnt show me where it'd run that code
08:56:52FromDiscord<jmgomez> cant post it directly because it
08:57:07FromDiscord<jmgomez> is under NDA. Im trying to get the minimal reproducible
08:57:35FromDiscord<Elegantbeef> Well then have fun
08:58:21FromDiscord<jmgomez> I just told you that Im working on having it reproducible not that Im not posting it or something like that
08:58:56FromDiscord<Elegantbeef> Yes i can read i was telling you to have fun
09:08:38*smvg joined #nim
09:16:48*smvg quit (Quit: smvg)
09:51:57FromDiscord<jmgomez> sent a code paste, see https://paste.rs/tMg
09:53:20FromDiscord<Rika> cdecl and nimcall are different things no?
09:53:35FromDiscord<Rika> Change one to the other, whichever one
09:54:55FromDiscord<jmgomez> In reply to @Rika "cdecl and nimcall are": I set it there due to elegant
09:54:58FromDiscord<jmgomez> 's suggestion
09:55:42FromDiscord<jmgomez> The code above is in one dynlib and the below in another so it allows for hot reloading not sure if what you are saying may be related with the issue
09:55:45FromDiscord<Rika> You need them to agree with each other
09:55:56FromDiscord<Rika> The calling conventions must be the same
09:56:15FromDiscord<Rika> If you need cdecl then change nimcall to cdecl
09:56:21FromDiscord<jmgomez> ok
09:57:28FromDiscord<jmgomez> Will do that, thanks. The crash is the second time I call whateverUsesThingFFI when it tries to append baseUrl with "/"
09:58:25FromDiscord<jmgomez> sent a code paste, see https://paste.rs/xrx
09:58:58FromDiscord<jmgomez> (edit) "https://play.nim-lang.org/#ix=3XlY" => "https://play.nim-lang.org/#ix=3XlX"
09:59:07FromDiscord<Rika> I don’t know what’s wrong in this case
10:00:03FromDiscord<jmgomez> Notice I just updated the snippet with the url that was missing (the one it's being disposed)
10:00:40FromDiscord<jmgomez> if the url is inside the whateverUsesThingFFI there is no crash
10:00:48FromDiscord<jmgomez> (or if it's const)
10:01:48FromDiscord<Rika> Does it have to be let
10:02:08FromDiscord<Rika> Will running this through a debugger work
10:05:50FromDiscord<jmgomez> I did hook it to the lldb one via the UE entry point and it does crash where I posted before (doing the append)
10:05:56FromDiscord<jmgomez> In reply to @jmgomez "Yes, but as you": here
10:06:28*jmdaemon quit (Ping timeout: 248 seconds)
10:44:09*smvg joined #nim
10:44:41*xet7 quit (Remote host closed the connection)
10:47:57*xet7 joined #nim
11:02:57*smvg quit (Quit: smvg)
11:03:50*smvg joined #nim
11:04:10*smvg quit (Client Quit)
11:06:45*smvg joined #nim
11:10:43*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
11:22:00*smvg quit (Quit: smvg)
11:25:27*smvg joined #nim
11:36:13*jjido joined #nim
11:49:27FromDiscord<d4rckh> is there any equivalent of sizeof from c++ in nim?
11:49:53FromDiscord<jmgomez> size()?
11:56:56PMunch@d4rckh, yes, it's called sizeof :P
11:57:03PMunch!eval echo sizeof(int)
11:57:06NimBot8
11:57:16FromDiscord<jmgomez> sent a code paste, see https://paste.rs/Ml2
11:57:46FromDiscord<jmgomez> In reply to @jmgomez "size()?": I meant sizeOf too sorry
11:58:13FromDiscord<Rika> In reply to @jmgomez "Another unrelated topic (not": idk; maybe because the callback handles it whether failed or successful
11:58:22FromDiscord<Rika> so it cant just pass T because it might have failed
11:58:42FromDiscord<jmgomez> so at that point the future is resolved in the happy path?
11:59:09FromDiscord<Rika> in cb it can either be failed or successful i assume
11:59:48PMunchIf you want to assign the same top-level procedure to multiple different futures it's nice to be passed the future in question as an argument
12:09:21*FromDiscord quit (Remote host closed the connection)
12:09:35*FromDiscord joined #nim
12:12:21FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3Xmu
12:13:13FromDiscord<Rika> it will, waitfor will block
12:13:17FromDiscord<Rika> wait
12:13:22FromDiscord<Rika> huh>
12:13:31FromDiscord<Rika> thats strange
12:13:47FromDiscord<Rika> i dont think it will block no
12:13:53FromDiscord<Rika> reeeeeee callback reeeeeee
12:14:19PMunch@jmgomez, you don't have to use waitFor in those callbacks
12:14:23FromDiscord<Rika> f.finished will be true in callbacks so you dont need to waitfor
12:14:25PMunchIt won't hurt though
12:14:27FromDiscord<Rika> just .get
12:14:50FromDiscord<jmgomez> gotcha
12:14:53FromDiscord<jmgomez> thanks!
12:15:23PMunchYou also don't need return type void
12:16:20FromDiscord<jmgomez> yeah, that I know but I prefer to have it there for clarity (FFI functions tend to grow in oddness)
12:16:32PMunchFair enough
12:16:55PMunchRelated to that you can also combine argument types like `username, password: cstring`
12:17:49FromDiscord<jmgomez> for some reason I thought that it only allows you to do it at the end but good to know you can do it at any point
12:21:03PMunchI'd probably write it like this: https://play.nim-lang.org/#ix=3Xmy
12:21:22PMunch(if you still wanted the void return types, personally I'd remove those as well)
12:22:07PMunchIf you have multiple of those a collection pragma would also help shorten things down, similar to how the callback type shortens the signature down
12:22:33*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
12:22:44FromDiscord<jmgomez> nice, much clearer!
12:23:07FromDiscord<jmgomez> not sure, I tried with ffi:genFilePath and no way I could do it (it's a custom one)
12:23:31FromDiscord<jmgomez> the others are there because using push also pushes things into the cb
12:24:24PMunchSyntax might not be 100% correct here, but you could also do the callback without assigning the future https://play.nim-lang.org/#ix=3XmB
12:24:54PMunchI believe the pushing issue would be fixed by declaring the callback type outside the signature
12:26:13FromDiscord<jmgomez> cool, I got an issue with name collisions using get
12:26:26FromDiscord<jmgomez> I think it conflicts with httpclient.get
12:26:38PMunchHmm, that's odd
12:26:46PMunchI meant something like this with the pragma https://play.nim-lang.org/#ix=3XmC
12:26:56FromDiscord<Xzayler> what advantages are there to using godot-nim over the native gdscript?
12:27:06PMunchNot sure if you can move `ffi` into there because I don't know how it is implemented
12:27:09FromDiscord<Xzayler> I don't really understand how this integration works
12:27:54PMunch@Xzayler, well it's mostly for people who want to do gamedev with Godot in Nim, the benefits are those of Nim: expressivity, speed, type safety
12:28:06FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3XmD
12:29:05PMunchRight, I don't think you can add macro-pragmas into a pragma (it's silly and confusing, I know..)
12:30:14FromDiscord<jmgomez> unfortunate but not a big issue
12:30:28FromDiscord<jmgomez> on the get conflicting with the http module, what can be done?
12:38:29PMunchDepends on the nature of the conflict
12:38:50PMunchIt shouldn't really be a conflict since only one of them matches the arguments given
12:40:56FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3XmE
12:43:04PMunchOh whoops, it's not `get` it's `read`. `get` is for options
12:43:07*smvg quit (Quit: smvg)
12:43:35PMunchThat error just tells you that there is no `get` declared for Futures
12:43:35FromDiscord<jmgomez> okay!
12:43:40*lumo_e quit (Ping timeout: 250 seconds)
12:44:05FromDiscord<jmgomez> IMO they should be a bit more consistent with monodics apis
12:46:22PMunch@jmgomez, what do you mean?
12:48:01*jjido joined #nim
12:49:07FromDiscord<jmgomez> Just that Future, Seqs, Options (not sure if Either/Results is around), etc. should have the same name for the same pattern
12:49:54PMunchWait, how does seqs fit into that?
12:50:03PMunchWith those you just access the data with []
12:50:05*pch joined #nim
12:50:27FromDiscord<jmgomez> You can take them out of the equation if you want, but Im referring to the fact that they are monads too
12:50:43PMunchBut I agree that Options and Futures could have the same operation
12:52:37*smvg joined #nim
12:54:47*slowButPresent joined #nim
12:59:26*rockcavera joined #nim
12:59:26*rockcavera quit (Changing host)
12:59:26*rockcavera joined #nim
12:59:59*rockcavera quit (Remote host closed the connection)
13:00:25*lumo_e joined #nim
13:02:07*kayabaNerve_ joined #nim
13:04:28*kayabaNerve quit (Ping timeout: 250 seconds)
13:24:09*duuuuuude quit (Ping timeout: 256 seconds)
13:25:15*duuuuuude joined #nim
13:32:43FromDiscord<Rika> In reply to @jmgomez "You can take them": seqs are monads?
13:33:12*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
13:38:19FromDiscord<ambient> is there something like Jupyter for Nim?
13:39:58*smvg quit (Quit: smvg)
13:42:18NimEventerNew thread by Yglukhov: Async musings, see https://forum.nim-lang.org/t/9149
13:54:12FromDiscord<jmgomez> In reply to @Rika "seqs are monads?": https://en.wikibooks.org/wiki/Haskell/Understanding_monads/List
13:54:49FromDiscord<jmgomez> In reply to @ambient "is there something like": closest thing I heard of is iNim but never used it. It would be great if someone who has shared its experience
13:55:21PMunch@ambient, there is nimibook which is kind of similar
13:56:46FromDiscord<fbpyr> to me, inim felt more like a raw python repl for nim (which I love for testing a quick snippet), than the full jupyter.
14:00:48FromDiscord<jmgomez> In reply to @fbpyr "to me, inim felt": so do you use it? I want to try it out.. said it because I didnt know about nimibook neither. But now that Im looking at it seems inim is more close to it. Wasnt jupyter built on top of iphython?
14:00:52FromDiscord<spoon> heah inim was more like python command line shell
14:01:15FromDiscord<ambient> there's also https://github.com/stisa/jupyternim which I'm looking at right now
14:02:20FromDiscord<jmgomez> In reply to @ambient "there's also https://github.com/stisa/jupyternim wh": that's great wonder what backends it supports
14:03:26FromDiscord<jmgomez> In reply to @jmgomez "so do you use": indeed it was https://blog.jupyter.org/the-big-split-9d7b88a031a7
14:03:52*smvg joined #nim
14:04:20FromDiscord<fbpyr> @jmgomez\: yes I do, as I am a big fan of this interactive poking at things to learn...↡but I also miss a lot of convenience functionality from pyt\_python bpython (autocompletion, doc strings, etc)
14:06:25FromDiscord<fbpyr> ..but also my use case is actually not jupyter but closer to bpyhton/pt\_python..
14:08:25FromDiscord<stisa> let me know if you do try it! it's been a while since the last update but it should work fine, if a little slow. If you don't need C imports, you can try `nim secret`in a terminal, if it wasn't removed from the compiler it should work as repl using nim vm↡(@ambient)
14:08:52*PMunch quit (Quit: Leaving)
14:08:58FromDiscord<ambient> is there a possibility to display audio, or is that something I must patch in manually?
14:10:50FromDiscord<stisa> you mean a plot of the waveform? you'd need to do that yourself
14:11:13FromDiscord<ambient> directly play audio through web, like generate a sine procedurally and then play it through the speakers
14:11:52FromDiscord<stisa> no idea, I've never seen that done in jupyter
14:12:05FromDiscord<stisa> I guess if you set the right mime type it could work?
14:12:39*pch quit (Quit: Leaving)
14:13:08*arkurious joined #nim
14:13:33FromDiscord<ynfle> I'm trying to fix up some old code. What is `nnktypedList` and `nnkBracetUntyped`?
14:13:54*pch joined #nim
14:17:29FromDiscord<ambient> @stisa something like this https://gist.github.com/amb/2c9314b1991e07ab3e21097aab97cfae
14:17:56FromDiscord<ambient> The Audio() plays the sample
14:22:42FromDiscord<stisa> mmh judging by https://github.com/ipython/ipython/blob/master/IPython/lib/display.py#L226 they just output some html and base64 encode the audio track
14:22:54FromDiscord<ambient> ok I'll give it a shot
14:24:00FromDiscord<stisa> this should display html\: https://github.com/stisa/jupyternim/blob/master/src/jupyternimpkg/display.nim#L73 so it should "just" need to output the same as theirs
14:25:21FromDiscord<stisa> or with this one\: https://github.com/stisa/jupyternim/blob/master/src/jupyternimpkg/display.nim#L132
14:33:50*duuuuuude quit (Remote host closed the connection)
14:48:43*pch quit (Remote host closed the connection)
14:49:40*pch joined #nim
14:57:39*duuuuuude joined #nim
14:59:05*lumo_e quit (Quit: Quit)
15:02:41*firq quit (Quit: WeeChat 3.5)
15:05:46*firq joined #nim
15:10:44FromDiscord<ynfle> How do I turn warnings and hints off with a pragma?
15:41:53FromDiscord<pmunch> Hmm, where should nimsuggest bugs be raised? The nimsuggest repo, or the main Nim repo?
15:43:50FromDiscord<ynfle> In reply to @ynfle "I'm trying to fix": Nvm. text substitution error on my part
16:17:54*vicfred joined #nim
16:20:39*duuuuuude quit (Ping timeout: 276 seconds)
16:34:53*haliucinas joined #nim
16:42:38FromDiscord<Yardanico> In reply to @pmunch "Hmm, where should nimsuggest": I'll report my issues on GitHub, but basically it's two main things: 1) On Windows nimble creates a .cmd file to execute binaries instead of a symlink, so gorge/staticExec doesn't work with that 2) staticExec redirects stderr to stdout so if opir shows warnings after spitting out json, futhark will take the wrong line from the json
16:43:15FromDiscord<Yardanico> 3) libclang for some reason gives away paths that have / instead of \ for sciter include folder, fixed by manually replacing / with \
16:43:25FromDiscord<Yardanico> Three main things :P
16:43:45FromDiscord<Yardanico> and 2 from the output, not json
16:46:21FromDiscord<Yardanico> 3 is really important because futhark's logic regarding whether to include specific symbols in the Nim file or not depends on the filenames they come from, but with a different path separator some paths appear differently
16:46:52FromDiscord<Yardanico> But again, it's libclang that gives those strings, so not sure if there's a real fix for it except just manually replacing / with \
16:49:15*noeontheend joined #nim
16:56:06FromDiscord<Yardanico> Apart from that it works really well, I was afraid that it'd fail because it has to analyze windows headers as well, but it didn't :)
16:57:49*xet7 quit (Quit: Leaving)
16:59:16FromDiscord<Yardanico> And the C++ issue was there due to a bug in sciter headers - it defines CPP11 if _MSC_VER >= 1600 which is wrong
16:59:22*kenran joined #nim
16:59:33FromDiscord<Yardanico> Because clang defines that as well (it tries to be compatible with msvc on Windows somewhat)
17:16:36FromDiscord<ambient> sent a code paste, see https://play.nim-lang.org/#ix=3XnU
17:17:15*smvg quit (Quit: smvg)
17:24:56FromDiscord<Yardanico> In reply to @ambient "I'm wrapping Tinywav library": I'll try to help a bit later
17:31:28FromDiscord<Yardanico> @ambient https://github.com/mhroth/tinywav ?
17:31:48FromDiscord<ambient> @Yardanico yeah that's it
17:32:37FromDiscord<ambient> I'll probably later write the entire lib in Nim, so I can get better access to where I want to save/load, but the error is still confusing and something that would be nice to figure out if I'm to use Futhark in the future
17:32:39FromDiscord<Yardanico> honestly for tinywav it would be quite easy to just rewrite it in Nim, but I'll see why it errors :)
17:35:32FromDiscord<Yardanico> In reply to @ambient "<@177365113899057152> yeah that's it": not sure what error you're talking about - I uncommented the code, but it's wrong because you're comparing a `cint` to a `nil`
17:35:52FromDiscord<Yardanico> maybe you got a different error with nimsuggest? can you try checking with the compiler itself?
17:36:28FromDiscord<Yardanico> you should instead compare if the return code is non-zero
17:36:47FromDiscord<ambient> yeah now it works, but the error message was very confusing
17:36:57FromDiscord<Yardanico> where did you get it specifically? vscode or the compiler?
17:37:04FromDiscord<Yardanico> i mean in the actual command line
17:37:06FromDiscord<ambient> nim c -r my_code.nim
17:37:17FromDiscord<Yardanico> hmm, quite weird, I didn't get anything like that
17:37:21FromDiscord<Yardanico> maybe you put it to `const` by accident?
17:37:26FromDiscord<Yardanico> `wavefoo` I mean
17:37:32*PMunch joined #nim
17:37:32FromDiscord<Yardanico> or put a `static` block somewhere by accident
17:38:20FromDiscord<ambient> ctrl-f const, static == nothing
17:38:30FromDiscord<Yardanico> but now it doesn't error as you said
17:38:33FromDiscord<Yardanico> also, what's your nim version?
17:38:45FromDiscord<Yardanico> and another thing - use `doAssert` instead of `assert` for checking return codes of API calls, because asserts can be disabled (either by `--assertions:off` or `-d:danger`)
17:38:56FromDiscord<Yardanico> so if you compile with `-d:danger` calls to the API with `assert` will simply not be compiled
17:39:01FromDiscord<ambient> 1.6.4 7994556f3804c217035c44b453a3feec64405758
17:39:14FromDiscord<Yardanico> hm, well, I'm on devel, maybe that's a bug in 1.6.4 specifically
17:40:37FromDiscord<ambient> yeah, on devel it gives a very good error message
17:40:43FromDiscord<ambient> so looks like 1.6.4 bu
17:41:21FromDiscord<Yardanico> can you try updating to 1.6.6 and see if the bug is still there?
17:41:35FromDiscord<Yardanico> although I don't remember 1.6.6 having any commits related to things like that
17:42:03FromDiscord<ambient> 1.6.6 also works fine, no issues
17:42:16FromDiscord<Yardanico> okay, good then
17:42:52*duuuuuude joined #nim
17:52:17YardanicoPMunch: i'll try that advice you shared, meanwhile I'm trying to reproduce the issue with executing opir from futhark to make an issue
17:57:26PMunchIf you're lucky it's timing based :P
17:57:46PMunchMaybe we need to flush stdout and stderr before echoing the output
17:58:19YardanicoPMunch: that can be true, yes, opir takes a while before it starts spitting out json for sciter
17:58:23Yardanicolike 2 seconds
17:59:17PMunchThat long?
17:59:25*Zectbumo joined #nim
17:59:31Yardanicoyes
17:59:34Yardanicothe resulting json file is like 9MB
17:59:42PMunchAh right :P
17:59:57PMunchI mean it essentially compiles the entire project
18:00:05Yardanicoyeah
18:00:06PMunchOr at least parses and does a lot of the work
18:04:53YardanicoPMunch: i think i know the root cause of the command issue, but I don't get why it works on Linux and not Windows
18:05:08Yardanicobasically gorge (staticExec) doesn't use poUsePath and swallos errors
18:05:29Yardanicowith my own myStaticExec copied from the compiler impl it errors Additional info: Requested command not found: 'opir test args'. OS error: [OSError] with "opir"
18:05:35Yardanicoit will work with "opir.cmd" directly though
18:06:07Yardanicoi guess it just has to do with the fact that linux doesn't have extensions for binaries while windows does :)
18:06:33Yardanicothe simplest way for futhark to fix this is just use opir.cmd instead of opir on Windows, but this assumes that the user uses futhark with nimble
18:06:40Yardanicowhich is probably true I mean, but still a bit dirty
18:07:59Yardanicoah actually even poUsePath won't help here
18:09:04PMunchBut wouldn't simply moving the echo to be the last thing work?
18:09:43YardanicoPMunch: the issue is that opir just doesn't get executed
18:09:57PMunchOh what?
18:10:17YardanicostaticExec doesn't have exceptions, so if a command fails to execute it just returns an empty string with -1 as the exit code
18:10:26Yardanicoi mean it has exceptions, but it catches them in the proc itself
18:10:31Yardanicohttps://github.com/nim-lang/Nim/blob/devel/compiler/gorgeimpl.nim#L62
18:11:11Yardanico-1 exit code in case of an exception is not documented as far as I know :)
18:12:54YardanicoCalling stuff as `bin` without extension on Windows only works if `bin.exe` is in PATH, it doesn't apply to `bin.cmd` which nimble uses to "symlink" (alias) the actual binary
18:19:41PMunchRight..
18:19:58PMunchBut people have run Futhark on Windows before, right?
18:20:13YardanicoI don't know how it worked for them Β―\_(ツ)_/Β―
18:20:22Yardanicowindows magic
18:21:05Yardanicoalso about timings - I think yeah, it's just enough to add flushFile calls to stderr and stdout in opir before `echo output`
18:21:23FromDiscord<eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3Xob
18:22:29FromDiscord<Yardanico> "and put it into the same directory." that's the issue
18:22:48FromDiscord<Yardanico> on Linux it's only checked that cacert.pem is in default paths for Linux, current dir is not checked
18:23:21FromDiscord<Yardanico> you can make it use your cacert.pem by creating your own ssl context with `newContext` with CVerifyPeerUseEnvVars as verifymode
18:23:35FromDiscord<Yardanico> and then put path to your cacert.pem into `SSL_CERT_FILE` env var
18:25:45Yardanicohmm flushFile approach for futhark doesn't seem to work actually, lemme experiment with it a bit more
18:25:48FromDiscord<eyecon> Thank you, let me check the docs on that
18:26:35FromDiscord<Yardanico> In reply to @eyecon "Thank you, let me": oh I don't know if that is in docs, I just checked the source code of finding root certs ;)
18:26:55FromDiscord<Yardanico> it is apparently
18:27:04FromDiscord<Yardanico> https://nim-lang.org/docs/net.html#newContext%2Cstring%2Cstring%2Cstring%2Cstring "if verifyMode is set to CVerifyPeerUseEnvVars, the SSL_CERT_FILE and SSL_CERT_DIR environment variables are used"
18:27:22FromDiscord<Yardanico> ah right, newContext just has a `certFile` argument
18:27:28FromDiscord<Yardanico> caFile
18:31:58FromDiscord<eyecon> ...and `caDir` which is useful
18:32:23FromDiscord<eyecon> OK, that upgraded me to a `400 Bad Request`, that's progress
18:32:36FromDiscord<Yardanico> probably get request to a post endpoint, or the other way
18:32:57FromDiscord<Yardanico> yeah, ntfy.sh is PUT and POST
18:32:57FromDiscord<eyecon> Yes, that's solvable πŸ˜„
18:33:10FromDiscord<eyecon> There's GET too actually
18:33:47FromDiscord<eyecon> https://ntfy.sh/docs/publish/#webhooks-publish-via-get
18:33:57FromDiscord<Yardanico> yeah i already found that page :)
18:34:10PMunchYardanico, wait, if you install Futhark via Nimble then Opir should already be in the path (if you've installed nimble correctly)
18:34:27YardanicoPMunch: opir.cmd is in PATH, not opir.exe
18:34:36PMunchOh..
18:34:46Yardanicoopir.exe is placed in C:\Users\dian\.nimble\pkgs\futhark-0.6.1
18:34:56Yardanicoand then opir.cmd calls opir.exe with that path
18:35:04Yardanico@"%~dp0\..\pkgs\futhark-0.6.1\opir.exe" %*
18:35:14PMunchRight..
18:35:49YardanicoI'm still trying to figure out why json isn't being output as the last line in the output even with flushFile
18:38:42Yardanicoi think i know why :
18:38:44Yardanico:D
18:38:54FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/973292998525857862/unknown.png
18:39:07Yardanicolast line is empty, so splitLines returns an empty line as the last one
18:40:09FromDiscord<eyecon> In reply to @Yardanico "yeah, ntfy.sh is PUT": Worse, forgot a trailing comma in JSON... It works now, thanks a lot!
18:40:49Yardaniconot sure why it only happens on Window, but I guess the fix would be to skip empty lines?
18:40:57Yardanicosomehow
18:41:59FromDiscord<eyecon> Can I embed the certificates somehow? I can `slurp` the file but `newContext` doesn't accept the contents
18:42:01Yardanicoanyway, I added that info to the futhark issue
18:42:38FromDiscord<Yardanico> @eyecon don't think so
18:42:46FromDiscord<eyecon> Meh
18:42:55FromDiscord<eyecon> Thanks anyway
18:43:00FromDiscord<Yardanico> it'd be really really bad practice anyway
18:43:26FromDiscord<eyecon> In reply to @Yardanico "it'd be really really": Surely not worse than delivering a manually downloaded certificate file?
18:43:43FromDiscord<Yardanico> not worse, because users can replace this cacert.pem themselves easily
18:43:51FromDiscord<Yardanico> also, on virtually all linux distros it's already available
18:43:59FromDiscord<eyecon> But Windows :/
18:44:37FromDiscord<Yardanico> I don't really get the "one binary only" "cult", sorry. We have installers and archives, is it really that bad to pack your app (being multiple files) into an archive/installer?
18:44:47FromDiscord<Yardanico> especially on Windows
18:44:49FromDiscord<eyecon> "Cult"?
18:44:57FromDiscord<Yardanico> but if you really want, you can use tools like https://enigmaprotector.com/en/aboutvb.html
18:45:03FromDiscord<Yardanico> to pack multiple files into one "binary"
18:45:22FromDiscord<Yardanico> but AVs are usually more suspicious towards binaries that are packed like that
18:46:25FromDiscord<eyecon> I get what you mean, and I understand the viewpoint too, but surely calling the opposite viewpoint a "cult" is a bit too much?
18:46:33FromDiscord<Yardanico> that's why I used quotes
18:46:52FromDiscord<Yardanico> also, you'll also have to ship two ssl .dlls unless you link openssl statically
18:47:03FromDiscord<Yardanico> along with cacert.pem
18:47:17FromDiscord<Yardanico> Nim uses OpenSSL for SSL
18:47:44FromDiscord<Yardanico> in the standard library I mean, there are some third-party packages like puppy that use OS-native APIs, but they're less flexible in amount of features compared to httlpclient
18:48:06FromDiscord<Yardanico> https://github.com/treeform/puppy
18:49:54*rockcavera joined #nim
18:49:54*rockcavera quit (Changing host)
18:49:54*rockcavera joined #nim
18:50:30FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3Xon
18:50:39FromDiscord<d4rckh> I tried passing it using `addr aProcesses` and `aProcesses`
18:50:56FromDiscord<d4rckh> but its throwing a type mismatch error
18:51:04FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3Xoo
18:51:09FromDiscord<Yardanico> just cast it
18:51:32FromDiscord<Yardanico> Nim is more strict than C in type definitions, so in Nim a pointer to an array is different than just a pointer to an element, while in C it's the same
18:51:47FromDiscord<d4rckh> thanks, should i do the same with the second parameter? an int is returned by sizeof but i need a dword :think:
18:51:51FromDiscord<d4rckh> (edit) ":think:" => "πŸ€”"
18:51:59FromDiscord<Yardanico> you use a type conversion for things like numbers
18:52:04FromDiscord<d4rckh> ah, right
18:52:10FromDiscord<Yardanico> so DWORD(myint)
18:52:13FromDiscord<d4rckh> got it
18:54:33FromDiscord<d4rckh> seems like i got 231 processes returned πŸ˜„
18:54:35FromDiscord<d4rckh> thanks
18:55:20*gsalazar quit (Remote host closed the connection)
18:58:10*duuuuuude quit (Ping timeout: 240 seconds)
19:00:51FromDiscord<d4rckh> what would be the nim equivalent for this? `TCHAR szProcessName[MAX_PATH]`
19:01:30FromDiscord<Yardanico> `var szProcessName: array[MAX_PATH, TCHAR]`
19:01:37FromDiscord<Yardanico> where MAX_PATH is some number
19:01:51FromDiscord<Yardanico> but in your case you probably want WCHAR instead of TCHAR as you're using ANSI Windows functions anyway
19:02:31FromDiscord<d4rckh> i see, thanks
19:04:57YardanicoPMunch: would futhark work with libclang 14 ?
19:05:07YardanicoI want to try it to see if it would fix the filename path issue
19:10:26PMunchI don't see why it wouldn't
19:10:31PMunchBut I haven't tried
19:10:53Yardanicoyeah, it works, but that issue is still there
19:10:54FromDiscord<d4rckh> what about here GetModuleBaseNameA's nSize parameter? https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-getmodulebasenamea
19:10:57FromDiscord<d4rckh> (edit) removed "here"
19:11:00Yardanicoand what's funny is that it's also there for some windows headers
19:11:05YardanicoC:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um/objidl.h
19:11:20FromDiscord<Yardanico> In reply to @d4rckh "what about GetModuleBaseNameA's nSize": what about it?
19:11:32FromDiscord<Yardanico> "The size of the lpBaseName buffer, in characters."
19:11:50FromDiscord<Yardanico> LPSTR is just a pointer to a typical ASCII char array
19:11:56FromDiscord<Yardanico> so you can use a nim string for that directly
19:11:57FromDiscord<d4rckh> one sec
19:12:04FromDiscord<d4rckh> thats cool πŸ€”
19:12:15FromDiscord<d4rckh> and if i use a nim string, what should i pass to that param?
19:12:26FromDiscord<Yardanico> `mynimstring.cstring`
19:12:34FromDiscord<Yardanico> i mean to the lpBaseName
19:13:00FromDiscord<d4rckh> yup
19:13:48YardanicoPMunch: i've tried searching stuff about this issue, but seems like no one uses libclang on windows :D
19:14:38PMunchI guess it's time to stop using Windows then :)
19:14:41FromDiscord<d4rckh> and to the nSize?
19:14:47FromDiscord<d4rckh> (edit) removed "the"
19:15:19FromDiscord<Yardanico> In reply to @d4rckh "and to nSize?": just `mynimstring.len`? haven't you already used other winapi functions?
19:15:30FromDiscord<Yardanico> and then resize the string to the len returned by the api call
19:15:31FromDiscord<Yardanico> with `setLen`
19:15:42YardanicoPMunch: or maybe https://reviews.llvm.org/D99580 is related
19:16:17Yardanicobut this is for debuginfo, not for libclang API
19:16:29Yardanicoso do you think it's worth adding those workarounds to futhark or not?
19:16:34FromDiscord<d4rckh> In reply to @Yardanico "just `mynimstring.len`? haven't you": well this function doesnt work like that
19:16:37*lumo_e joined #nim
19:16:48FromDiscord<Yardanico> In reply to @d4rckh "well this function doesnt": ?
19:17:34FromDiscord<d4rckh> i dont think this function needs to be called twice
19:17:46FromDiscord<Yardanico> i didn't say it should be called twice
19:17:59FromDiscord<d4rckh> i think i will give in `MAX_PATH`
19:18:00FromDiscord<Yardanico> In reply to @d4rckh "i dont think this": and the one we talked about before doesn't need to be called twice either if the buffer is big enough
19:18:18FromDiscord<d4rckh> i see
19:19:28FromDiscord<d4rckh> weird i am getting error 87 param not correct
19:19:37FromDiscord<Yardanico> In reply to @d4rckh "weird i am getting": well, can you show the code?
19:20:04FromDiscord<d4rckh> yeah one sec let me select the pieces
19:20:21FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3Xoz
19:20:26FromDiscord<d4rckh> aProcesses[i] is a DWORD with the pID
19:21:31FromDiscord<Yardanico> you didn't actually allocate a buffer for the string
19:21:54FromDiscord<Yardanico> and why MAX_PATH specifically for GetModuleBaseNameA
19:22:23FromDiscord<d4rckh> ive seen some examples using MAX_PATH as the name size
19:23:21FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XoA
19:23:22FromDiscord<Yardanico> and you don't need `bitor`, just use builtin `or`
19:24:57PMunchYardanico, feel free to add whatever you want as long as you get it working :)
19:25:04*duuuuuude joined #nim
19:25:21PMunchI believe there are also some pathing issues on Windows, or maybe it's just that Windows users are more likely to have spaces in their paths..
19:25:44Yardanicoah yeah, I didn't stumble upon that issue as I don't use spaces in paths myself
19:27:09YardanicoBut basically what I needed to fix for myself: opir.cmd instead of opir, replace / with \, hide warnings and pick the first line from splitLines in futhark instead of the last one
19:27:58FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3XoB
19:28:18PMunchYardanico, you don't want to pick the first line
19:28:35PMunchOpir can spit out a lot of messages
19:28:36Yardanicoyes yes I know, it was just my workaround
19:28:46Yardanicothe proper way would be to clean empty lines
19:28:51PMunchYou should move the echo on line 399 to the end instead
19:29:29PMunchAnd maybe add a stdout.flushFile
19:29:35Yardanicothat didn't help as I showed in the screenshot
19:29:41Yardanicothe issue is that there's an empty line for some reason
19:29:56PMunchAh..
19:30:09PMunchMaybe some stripWhitespace before splitLines?
19:30:22Yardanicoyeah, I just hope it won't be too slow for very big strings :P
19:32:00FromDiscord<theangryepicbanana> sent a code paste, see https://play.nim-lang.org/#ix=3XoC
19:35:58YardanicoPMunch: yeah, apparently both flushFile and stripping are needed together
19:36:01YardanicoI'll PR that change
19:36:57PMunch:+1:
19:37:13PMunchDoes Discord turn that into an emoji?
19:37:15Yardanicoyes
19:37:20PMunch:nimrawr:
19:37:22Yardanicono
19:37:28Yardanico:nimRawr:
19:37:31Yardanicostill doesn't :P
19:37:33PMunchOr whatever the one for the badger is
19:37:40Yardanicobecause discord emojis are different from normal emojis
19:38:17YardanicoPMunch: maybe I should also add it so that futhark fails if opir has a non-zero exit code?
19:38:20PMunchHuh, but I wrote color plus one colon
19:38:24FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3XoE
19:38:28PMunch:nimRawr:
19:38:33FromDiscord<Yardanico> In reply to @d4rckh "is there any way": just check that sz is 0 ?
19:38:37PMunchHmm, silly Discord
19:38:40FromDiscord<spoon> nim emojis look like <emotename:somenumericalid> when you actually upload them
19:38:44FromDiscord<Yardanico> yes
19:38:45FromDiscord<spoon> i meant discord but you get it
19:38:58PMunchThat is probably a good idea Yardanico
19:39:13PMunchAh..
19:39:30PMunchWell when you use the badger on Discord I see :nimRawr: I think
19:39:39FromDiscord<Yardanico> yeah i handle that in ircord
19:39:49FromDiscord<Yardanico> i don't handle irc -> discord for discord emojis though :)
19:40:15FromDiscord<Yardanico> https://github.com/Yardanico/ircord/blob/master/src/utils.nim#L238
19:41:40FromDiscord<d4rckh> weird, that i am getting a bunch of blank space
19:41:45FromDiscord<d4rckh> https://media.discordapp.net/attachments/371759389889003532/973308815460167720/unknown.png
19:41:53FromDiscord<Yardanico> In reply to @d4rckh "weird, that i am": did you not forget the `setLen` call ?
19:41:55FromDiscord<d4rckh> sent a code paste, see https://paste.rs/bny
19:42:20FromDiscord<Yardanico> it changes the string length to what was returned by the API call to remove empty chars
19:42:35FromDiscord<d4rckh> yes i did forget
19:42:48FromDiscord<d4rckh> it works now
19:42:56FromDiscord<d4rckh> thanks, now i can sleep
19:43:19FromDiscord<d4rckh> I feel like the windows api is overcomplicated
19:43:28FromDiscord<d4rckh> But i think this is just because it's written in a low level language
19:43:56FromDiscord<Yardanico> In reply to @d4rckh "I feel like the": it's maybe just verbose, not overcomplicated
19:44:32FromDiscord<d4rckh> Well, from my perspective, it's complicated
19:51:51FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3XoH
19:52:06FromDiscord<Yardanico> wdym "being compiled"?
19:52:22FromDiscord<jmgomez> like you are imported from a config.nim file
19:52:44FromDiscord<jmgomez> I should compile time instead of beign compiled, sorry
19:52:55FromDiscord<jmgomez> (edit) "I should ... compile" added "say"
19:53:01FromDiscord<Yardanico> during normal Nim compilation you can use `when nimvm`, but I don't know about nimscript
19:53:29FromDiscord<jmgomez> okay, that may work. Thanks!
19:58:46YardanicoPMunch: https://github.com/PMunch/futhark/pull/38
19:58:57Yardaniconot sure if I should make a PR making futhark use opir.cmd on Windows
19:59:08FromDiscord<ambient> sent a code paste, see https://play.nim-lang.org/#ix=3XoK
19:59:14Yardanicoas I hacky workaround I can make another proc that calls opir and checks if it exists, and then does the same for opir.cmd
20:00:19FromDiscord<Yardanico> In reply to @ambient "Is there a better": you can create (or take someone else's) `doWhile` template and use it for this, but it won't really shorten your code as you still need `chunk` to be defined outside of the loop
20:00:41FromDiscord<ambient> ok ty
20:00:51*jmdaemon joined #nim
20:02:34PMunchYardanico, I guess it could check if it is able to run "opir.cmd" if it is unable to run "opir"
20:03:00Yardanicosure, I'll add a compileTime proc then that does this for windows
20:04:43YardanicoPMunch: would http://ix.io/3XoO work ?
20:04:46Yardanicoi mean "be fine"
20:06:21Yardanicoah wait stupid :DD
20:06:38Yardanicoopir exits with -1 code on correct execution as well, although it does have stuff in the output
20:07:08Yardanicoi guess i need to add opir output to my other PR
20:07:13Yardanicoif output isn't empty
20:08:05PMunchAre you sure it isn't just because the program returns -1 when called without arguments?
20:08:32YardanicoPMunch: yeah, I just mean that output isn't empty with -1 if opir exits on its own
20:08:40Yardanicobut gorgeEx returns -1 and empty output if command execution failed
20:08:57Yardanicoi don't really know a good way to add error handling for this :P
20:13:27*duuuuuude quit (Ping timeout: 240 seconds)
20:16:31*daemilk joined #nim
20:18:25FromDiscord<jmgomez> how can one write to a file in nimVM? cant use open/staticWrite/staticExec
20:19:14FromDiscord<Yardanico> writeFile
20:19:26FromDiscord<Yardanico> In reply to @jmgomez "how can one write": wait wdym?
20:21:30YardanicoPMunch: is it intended that opir doesn't exit on CXDiagnostic_Error and only exits on CXDiagnostic_Fatal ? Does it still try to generate stuff even if clang gave a CXDiagnostic_Error ?
20:22:05FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3XoV
20:22:38*xet7 joined #nim
20:23:57FromDiscord<jmgomez> oh no sorry that was something else. Let me try it again, I have a mess of trials and errors around here
20:24:19FromDiscord<Yardanico> yeah, because `writeFile` and `staticRead` work in the VM
20:24:32FromDiscord<Yardanico> actually `readFile` does as well
20:26:10*mahlon quit (Ping timeout: 260 seconds)
20:28:01FromDiscord<jmgomez> yes, just tried it. I was trying with open/staticRead... etc. So three envs, VM, compiler and backends. Have to keep that in mind for some reason I thought that everything that works in the compiler will work too in the vm
20:36:10*duuuuuude joined #nim
20:40:26PMunchYardanico, it's all based on this: https://clang.llvm.org/doxygen/group__CINDEX__DIAG.html#gabff210a02d448bf64e8aee79b2241370
20:40:38PMunchI figured as long as it produces results I'm happy
20:40:42FromDiscord<Yardanico> yeah, that's fine then
20:57:48YardanicoPMunch: it's actually kind of surprising that libclang can be used for generating Nim stuff in such a short amount of code (even including libclang bindings themselves)
20:58:00YardanicoI wonder nimterop or other previous projects didn't use the libclang approach before
20:58:03Yardanicowhy*
20:58:13PMunchI know right
20:58:37PMunchI was surprised by how little was required to get a working result, and how few changes I've had to make since the release
20:59:16*kenran quit (Quit: WeeChat info:version)
20:59:36Yardanicoyeah, and it works wonders because libclang understands C code pretty good :P
20:59:50Yardanicomuch much better than parsers like tree-sitter
21:00:12Yardaniconeed to remake my https://github.com/Yardanico/nim-libvlc/ with futhark just for fun
21:00:46Yardanicobut yeah, I hope you add a "standalone file binding" mode in the future that beef asked about as well
21:00:53Yardanicoi mean all those when declared etc and type aliases
21:01:20PMunchHaha, yeah that is the plan
21:01:35PMunchWouldn't be too hard, I just need to find the time..
21:01:55PMunchIf only I could work on general Nim stuff full time..
21:02:44PMunchAnd yeah, using a C compiler to read C code is quite a neat trick. I mean the level of macro-fuckery it handles is really nice
21:03:51PMunchI mean I wrote the entire project because my hand-written bindings for a library I was using at work where crumbling under the constant updates that library received. And none of the other Nim tools even came near after days of trying to get them to work.
21:04:08PMunchI think I spent less time writing Futhark from the ground up than I did struggling with c2nim and nimterop :P
21:06:15*mahlon joined #nim
21:10:17YardanicoPMunch: yeah just wrapped libvlc :)
21:10:57Yardanicothe only small issue is that after using my rename callback to remove libvlc_ prefix from functions libvlc's main function is called "new", and when declared(new) returns true because nim also has a "new" function already (with different arguments though)
21:12:24PMunchHaha, yeah that's a bit of a weird situation
21:12:47PMunchIt was basically done so that you could declare your own versions of types before calling futhark
21:12:59Yardanicoohh okay, so I can just declare my own new then
21:13:14PMunchOr you can have a special case in your rename callback
21:13:19FromDiscord<Yardanico> true
21:13:21PMunchAnd call it something else
21:13:59PMunchAll that logic is based on a gripe I had with the other wrapping tools which was that if it messed up there was no easy way to say "hey I know what I'm doing, just use this definition instead"
21:14:27PMunchTurns out, Futhark is really good and messes up a lot less often, so I haven't really used the feature nearly as much as I thought I would.
21:15:18PMunchNow it mostly just ensures that it doesn't create errors because it tries to redefine something like file or int
21:26:26*PMunch quit (Quit: leaving)
21:35:24*averell quit (Quit: .)
22:07:08*jmd_ joined #nim
22:07:50*jmdaemon quit (Ping timeout: 240 seconds)
22:10:57FromDiscord<ambient> sent a code paste, see https://play.nim-lang.org/#ix=3Xpl
22:17:24*cyraxjoe quit (Ping timeout: 250 seconds)
22:19:33*Gustavo6046_ joined #nim
22:19:37*Gustavo6046 quit (Ping timeout: 248 seconds)
22:20:28*Gustavo6046_ is now known as Gustavo6046
22:33:29*cyraxjoe joined #nim
22:41:44FromDiscord<!Patitotective> I'm having problems with mingw not founding `libwinpthread-1.dll` and I was wondering if choosenim did add mingw to the path when it downloaded it? https://github.com/xmonader/nimassets/issues/14
22:42:03FromDiscord<!Patitotective> (edit) "did add" => "adds" | "when it downloaded" => "after downloading"
22:48:54*averell joined #nim
23:09:51*ltriant joined #nim
23:12:21*ltriant_ quit (Ping timeout: 256 seconds)
23:13:17*lumo_e quit (Remote host closed the connection)
23:22:11*jmdaemon joined #nim
23:22:28*jmd_ quit (Ping timeout: 246 seconds)
23:27:18rockcaveraPatitotective you can try install tdm gcc, it compile static binary, without dependency
23:27:30rockcaveraor compile with --passC:-static
23:28:37rockcaverahow did you install Nim?
23:31:14FromDiscord<!Patitotective> im installing it from a github workflow https://github.com/iffy/install-nim/blob/master/install-nim.sh#L163 :p
23:31:20FromDiscord<!Patitotective> (edit) "from" => "though"
23:31:25FromDiscord<!Patitotective> (edit) "though" => "through"
23:31:35FromDiscord<!Patitotective> in windows
23:33:56rockcaverado you know if gcc is in the %PATH% variable?
23:34:30rockcaveraopen cmd and type: gcc -v
23:35:13rockcaverausually this dll is in the "bin" folder of the mingw compiler
23:36:50*duuuuuude quit (Ping timeout: 240 seconds)
23:41:30FromDiscord<!Patitotective> ?
23:41:31FromDiscord<!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Xpy
23:41:33FromDiscord<!Patitotective> sent a code paste, see https://paste.rs/dkn