00:00:42 | FromDiscord | <Gustavo6046> oops |
00:00:50 | FromDiscord | <Gustavo6046> i redid the generic way and somehow it worked this time lol |
00:01:34 | FromDiscord | <Gustavo6046> so |
00:01:46 | FromDiscord | <Gustavo6046> i have an iterator that iterates on possibly multiple chunks of struct-of-arrays values |
00:02:12 | FromDiscord | <Gustavo6046> what if i don't want arrays that aren't used in the for loop's body to be fetched by the iterator? |
00:02:43 | FromDiscord | <Gustavo6046> like, `for ray in ray_iterator(my_ray_list): ray.position[0] += ray.direction[0] ray.stepSize; # ...` |
00:03:08 | FromDiscord | <Gustavo6046> i would want this iterator to fetch position, direction, and stepSize, but not attenuate, numBounces, or sourcePos |
00:03:13 | FromDiscord | <Gustavo6046> I could implement a naive iterator like this |
00:07:09 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wYa |
00:07:50 | FromDiscord | <Gustavo6046> but `getValue` involves constructing a `RayValue` by fetching values from all of the respective arrays in each ray chunk's `RaysValuesArray` |
00:08:07 | FromDiscord | <Gustavo6046> So I guess the crux of the question is, is there some way to lazy construct an object? |
00:09:53 | FromDiscord | <Gustavo6046> Oo |
00:09:55 | FromDiscord | <Gustavo6046> maybe using a closure! |
00:09:59 | FromDiscord | <Gustavo6046> But can a closure argument be like a block? |
00:13:55 | * | auxym_ quit (Ping timeout: 252 seconds) |
00:27:21 | FromDiscord | <Gustavo6046> Ah it can |
00:27:22 | FromDiscord | <Gustavo6046> I'm dumb |
00:29:12 | FromDiscord | <impbox [ftsf]> `for i in 0..size - 1:`↵btw you can use `for i in 0..<size:` |
00:36:08 | FromDiscord | <Gustavo6046> \:o |
00:36:09 | FromDiscord | <Gustavo6046> thanks |
00:42:15 | madprops | so this is not permitted it seems: https://dpaste.org/rcQv |
00:49:00 | FromDiscord | <impbox [ftsf]> why do you say it's not permitted? |
00:50:59 | FromDiscord | <impbox [ftsf]> what kind of value do you want to return? |
00:52:04 | FromDiscord | <impbox [ftsf]> the return type needs to be determinable at compile time |
00:52:11 | madprops | either float or int |
00:52:27 | madprops | i guess i have to pick one |
00:52:54 | FromDiscord | <impbox [ftsf]> or return a variant object |
00:53:11 | FromDiscord | <impbox [ftsf]> what's your use-case? |
00:54:08 | madprops | well I have a proc that changes words to numbers, like "three hundred twelve" == 312 . But there can also be decimals "two point two" == 2.2 |
00:54:31 | FromDiscord | <impbox [ftsf]> but what are you using it for? |
00:54:36 | FromDiscord | <impbox [ftsf]> what do you use the numbers for? |
00:55:00 | madprops | it's for a library, so it's for the users to decide |
00:55:33 | madprops | maybe returning float all the time is not that bad |
00:55:37 | FromDiscord | <impbox [ftsf]> well it's probably better to return a float |
00:55:53 | FromDiscord | <impbox [ftsf]> or have two procs |
00:58:37 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3wYh |
01:00:41 | madprops | generics |
01:01:01 | FromDiscord | <Gustavo6046> aa finally I did it and the tests passed |
01:01:27 | FromDiscord | <Gustavo6046> In reply to @impbox "what's your use-case?": updating certain arrays of the RaysValueArray object type selectively, which should be more CPU-cache-friendly |
01:01:41 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wYk |
01:01:46 | FromDiscord | <Gustavo6046> (edit) "https://play.nim-lang.org/#ix=3wYk" => "https://paste.rs/u09" |
01:02:02 | FromDiscord | <Gustavo6046> for example, updating position using direction shouldn't require loading attenuation or the # of bounces |
01:03:15 | FromDiscord | <impbox [ftsf]> awesome (sorry my q was for madprops) |
01:08:16 | * | krux02 quit (Remote host closed the connection) |
01:10:06 | * | xet7 quit (Remote host closed the connection) |
01:11:14 | * | xet7 joined #nim |
01:14:56 | * | auxym_ joined #nim |
01:17:01 | madprops | so I made this thing https://play.nim-lang.org/#ix=3wYm |
01:25:54 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3wYo |
01:25:54 | FromDiscord | <retkid> you ever find a solution for thijs |
01:25:56 | FromDiscord | <retkid> (edit) "thijs" => "this" |
01:28:01 | FromDiscord | <impbox [ftsf]> madprops, cool, can you make it do fractions too? eg "one hundredth" |
01:28:21 | madprops | hmm that's an interesting idea |
01:28:50 | madprops | could make another proc for that |
01:29:05 | FromDiscord | <impbox [ftsf]> "one and three quarters" |
01:29:28 | FromDiscord | <impbox [ftsf]> also localisation support? =p |
01:29:38 | FromDiscord | <retkid> is there anyway to just install the nim compiler |
01:29:48 | FromDiscord | <retkid> for windows |
01:29:53 | FromDiscord | <retkid> so i dont have to crosscompile |
01:30:07 | * | auxym_ quit (Ping timeout: 240 seconds) |
01:30:11 | FromDiscord | <retkid> (edit) "crosscompile" => "crosscompile, thats just giving too many issues" |
01:32:52 | FromDiscord | <retkid> oh look at that its working |
01:32:53 | FromDiscord | <retkid> cool nevermind |
01:33:02 | FromDiscord | <impbox [ftsf]> you can install nim on windows... not sure if you can install it without the other stuff |
01:33:25 | FromDiscord | <retkid> is cross compiling from linux to bsd and macos easier? |
01:36:59 | FromDiscord | <impbox [ftsf]> easier cross-compiling from linux to windows than, anything to macos |
01:37:06 | FromDiscord | <impbox [ftsf]> i've done it in the past but it was a massive pain |
01:46:44 | FromDiscord | <Gustavo6046> Is there a fast inverse square root? |
01:46:51 | FromDiscord | <Gustavo6046> Oh wait |
01:47:08 | FromDiscord | <Gustavo6046> It's in the x86 extensions ever since Carmack did it in Quake 3, isn't it |
01:47:13 | FromDiscord | <Gustavo6046> (edit) "It's in the x86 extensions ever since ... Carmack" added "John" |
01:47:24 | FromDiscord | <Gustavo6046> But there should be a proc in math that does FISR if it's not hardware available |
01:47:37 | FromDiscord | <Gustavo6046> Rather than calling sqrt, which probably is just opaque enough that it can't be optimized by a compiler into a FISR |
01:47:40 | FromDiscord | <Gustavo6046> I dunno |
01:54:38 | FromDiscord | <Gustavo6046> Okay that's just curiosity |
01:55:04 | FromDiscord | <Gustavo6046> In reply to @impbox "awesome (sorry my q": oh ok, sorry |
02:16:41 | * | arkurious quit (Quit: Leaving) |
02:18:41 | FromDiscord | <retkid> In reply to @impbox "easier cross-compiling from linux": really |
02:18:52 | FromDiscord | <retkid> ugh |
02:19:21 | FromDiscord | <impbox [ftsf]> https://github.com/tpoechtrager/osxcross i think i used this |
02:19:23 | nrds | <R2D299> itHub: 7"Mac OS X cross toolchain for Linux, FreeBSD, OpenBSD and Android (Termux)" |
02:19:23 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/880275197364686858/unknown.png |
02:19:34 | FromDiscord | <retkid> what i got so far |
02:19:43 | FromDiscord | <retkid> windows32 doesn't work so im figuring that out |
02:20:18 | FromDiscord | <impbox [ftsf]> are you using mingw32? |
02:20:21 | FromDiscord | <Elegantbeef> If you're on linux and want to make a windows binary you may be able to just install mingw |
02:20:27 | FromDiscord | <impbox [ftsf]> (edit) "mingw32?" => "mingw32/64?" |
02:20:38 | FromDiscord | <retkid> it was being weird so i just installed nim in wine |
02:20:41 | FromDiscord | <impbox [ftsf]> yeah, cross compiling using mingw was pretty easy |
02:21:12 | FromDiscord | <Elegantbeef> "being weird? |
02:21:39 | FromDiscord | <retkid> lemme get the command i was using |
02:24:09 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3wYz |
02:24:32 | FromDiscord | <retkid> easier just to use wine |
02:24:44 | FromDiscord | <Elegantbeef> Ehhh |
02:25:16 | FromDiscord | <Elegantbeef> What's the program you were making, simple exported hello world still? |
02:27:00 | FromDiscord | <retkid> theres some more complex stuff but just hello world testing stuff |
02:27:07 | FromDiscord | <retkid> by complex i mean just tests |
02:27:14 | FromDiscord | <retkid> nothing actually useful |
02:27:25 | FromDiscord | <retkid> iterators and there was hashmaps i think |
02:28:24 | FromDiscord | <retkid> but now im testing this library for packaging native libraries to give the illusion of things being platform independant |
02:28:24 | FromDiscord | <Elegantbeef> You did install mingw? |
02:28:29 | FromDiscord | <retkid> (edit) "independant" => "independent" |
02:28:35 | FromDiscord | <retkid> yea i have mingw |
02:29:45 | FromDiscord | <Elegantbeef> I can only say for some reason you dont have the header files |
02:29:58 | FromDiscord | <Elegantbeef> Which fixing makes more sense than to use wine |
02:31:26 | FromDiscord | <retkid> Not having headerfiles for c itself sounds like an arch related rabbithole |
02:31:31 | FromDiscord | <retkid> that i dont wanna deal with |
02:32:25 | FromDiscord | <impbox [ftsf]> `external compiler program 'gcc` looks like it's not using mingw's gcc |
02:32:55 | FromDiscord | <retkid> which makes sense |
02:33:02 | FromDiscord | <retkid> but how else do i engage it beside d:mingw |
02:33:03 | FromDiscord | <impbox [ftsf]> you can tell nim which gcc to use in config.nims |
02:33:10 | FromDiscord | <Elegantbeef> Oh i see the issue |
02:33:14 | FromDiscord | <Elegantbeef> you're doing `--os:windows` |
02:33:16 | FromDiscord | <Elegantbeef> That's not needed |
02:33:22 | FromDiscord | <Elegantbeef> just do `-d:mingw` |
02:33:25 | FromDiscord | <Gustavo6046> (edit) "https://play.nim-lang.org/#ix=3wYA" => "https://paste.rs/q3q" |
02:33:26 | FromDiscord | <Gustavo6046> sent a code paste, see https://paste.rs/Ehw |
02:33:31 | FromDiscord | <Gustavo6046> sadly this is pre-1.5 and thus pre-`random.randState()` |
02:33:35 | FromDiscord | <retkid> In reply to @Gustavo6046 "can I set an": probably predefine them |
02:33:47 | FromDiscord | <Gustavo6046> ? |
02:34:15 | FromDiscord | <retkid> declaring a proc and assigning something to a variable is very different and i think the way to do that is to define the function then assign it |
02:34:24 | FromDiscord | <impbox [ftsf]> `let randfunc = if rng == nil: ... else: ...` |
02:34:24 | FromDiscord | <retkid> but maybe im wrong thats just general coding stuff |
02:34:35 | FromDiscord | <Elegantbeef> Yea imp has the proper solution |
02:35:07 | FromDiscord | <retkid> new compiler |
02:35:11 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3wYB |
02:35:11 | FromDiscord | <retkid> (edit) "new compiler ... " added "problems" |
02:35:19 | FromDiscord | <retkid> should probably rename helloworld\ |
02:35:21 | FromDiscord | <retkid> (edit) "helloworld\" => "helloworld" |
02:35:22 | FromDiscord | <Gustavo6046> ahh |
02:35:34 | FromDiscord | <impbox [ftsf]> compiler is working! now it's just your linker |
02:35:45 | FromDiscord | <impbox [ftsf]> progress |
02:35:49 | FromDiscord | <Gustavo6046> thing is |
02:35:55 | FromDiscord | <retkid> oh haha |
02:35:58 | FromDiscord | <retkid> sorry wrong biot |
02:36:07 | FromDiscord | <retkid> (edit) "biot" => "bit" |
02:36:10 | FromDiscord | <Gustavo6046> it's just so rng.rand is used if rng is passed, otherwise the random module-level rand |
02:36:25 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3wYC |
02:36:33 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wYD |
02:36:37 | FromDiscord | <retkid> thats what i would do |
02:36:37 | FromDiscord | <Gustavo6046> but sadly that is not the case |
02:36:40 | FromDiscord | <Elegantbeef> Can we see the entire proc? |
02:36:44 | FromDiscord | <retkid> why not just define them |
02:36:55 | FromDiscord | <impbox [ftsf]> retkid, where's the error? |
02:36:56 | FromDiscord | <Gustavo6046> sure |
02:37:01 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wYE |
02:37:06 | FromDiscord | <retkid> In reply to @impbox "retkid, where's the error?": that is the entire output |
02:37:10 | FromDiscord | <Gustavo6046> ignore that `ref` |
02:37:31 | FromDiscord | <Gustavo6046> actually no don't ignore that `ref` |
02:37:36 | FromDiscord | <impbox [ftsf]> @retkid if you run that command does it output anything? `/usr/bin/x86_64-w64-mingw32-gcc -shared -o /home/retkid/Desktop/downloads/jnim/nimcompile/src/helloworld.dll /home/retkid/.cache/nim/helloworld_d/stdlib_io.nim.c.o /home/retkid/.cache/nim/helloworld_d/stdlib_system.nim.c.o /home/retkid/.cache/nim/helloworld_d/@mhelloworld.nim.c.o -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now` |
02:38:08 | FromDiscord | <retkid> same error |
02:38:12 | FromDiscord | <impbox [ftsf]> what error? |
02:38:32 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3wYF |
02:38:45 | FromDiscord | <impbox [ftsf]> ok, you didn't show that error above |
02:39:01 | FromDiscord | <retkid> it... is |
02:39:20 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3wYG |
02:39:23 | FromDiscord | <retkid> sorry i have a bit of a birthday headache |
02:39:24 | FromDiscord | <retkid> haha |
02:39:46 | FromDiscord | <retkid> can you see why i just like used wine |
02:39:55 | FromDiscord | <impbox [ftsf]> because you wanted more of a headache? |
02:39:59 | FromDiscord | <Elegantbeef> What's the issue with the code you provided hustavo? |
02:40:01 | FromDiscord | <retkid> well, the wine worked fine |
02:40:06 | FromDiscord | <impbox [ftsf]> wine -> hangover |
02:40:43 | FromDiscord | <impbox [ftsf]> https://stackoverflow.com/questions/55418931/ld-exe-unrecognized-option-z |
02:40:45 | FromDiscord | <retkid> the only thing i cant work with wine is the x32 but thats probably because i need to figure out how to install ming32 |
02:40:50 | FromDiscord | <impbox [ftsf]> apparently -z doesn't exist on windows |
02:40:55 | FromDiscord | <impbox [ftsf]> where is that command coming from? |
02:41:18 | FromDiscord | <retkid> somewhere within nim |
02:41:28 | FromDiscord | <retkid> because im not supplying anything with a z in it |
02:41:31 | FromDiscord | <impbox [ftsf]> what is your build command? |
02:41:33 | FromDiscord | <Elegantbeef> Gustavo here you go https://play.nim-lang.org/#ix=3wYI |
02:41:41 | FromDiscord | <impbox [ftsf]> are you passing --os:windows ? |
02:41:42 | FromDiscord | <retkid> nim c -d:mingw --app:lib --gc:arc src/( |
02:41:44 | FromDiscord | <retkid> (edit) "src/(" => "src/" |
02:41:54 | FromDiscord | <Elegantbeef> need to dereference the rng to make it work |
02:41:55 | FromDiscord | <retkid> lets try with arc |
02:42:21 | FromDiscord | <Elegantbeef> Now the real question gustavo is can this be resolved at compile time? |
02:42:38 | FromDiscord | <impbox [ftsf]> retkid, you're already using arc? try adding --os:windows |
02:43:45 | FromDiscord | <retkid> well, if i ad --os:windows with mingw it creates a different problem |
02:43:50 | FromDiscord | <retkid> (edit) "ad" => "add" |
02:43:55 | FromDiscord | <impbox [ftsf]> which is? |
02:44:12 | FromDiscord | <Elegantbeef> Like does this work for your use case gustavo? https://play.nim-lang.org/#ix=3wYK |
02:44:16 | FromDiscord | <retkid> In reply to @Elegantbeef "you're doing `--os:windows`": a |
02:44:41 | FromDiscord | <impbox [ftsf]> that was when you were using the wrong compiler |
02:44:53 | FromDiscord | <Elegantbeef> when passing `--os:windows` to the nim compiler you get a nice cannot find header error it seems to me |
02:45:04 | FromDiscord | <retkid> yea |
02:45:05 | FromDiscord | <retkid> i do |
02:45:11 | FromDiscord | <retkid> if i use mingw with windows |
02:45:21 | FromDiscord | <retkid> if i used use mingw i get a more complicated error |
02:45:28 | FromDiscord | <retkid> (edit) "used" => "just" |
02:45:54 | FromDiscord | <retkid> with no clear or definite solution besides "use wine lol" |
02:45:57 | FromDiscord | <retkid> which works |
02:46:28 | FromDiscord | <Elegantbeef> Can i get the exact code you're using? |
02:47:19 | FromDiscord | <retkid> im gonna delete all the code and just do a echo "Hello World" to try and isolate the issue |
02:47:53 | FromDiscord | <Elegantbeef> Well i have an exported proc + hello world echo'd and mine runs fine |
02:48:00 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3wYL |
02:48:01 | FromDiscord | <retkid> > echo "hello world" |
02:50:36 | FromDiscord | <Elegantbeef> Hmm your mingw is newer than mine so perhaps it's a version issue? |
02:50:53 | FromDiscord | <Elegantbeef> Does it compile fine without `--app:lib`? |
02:50:54 | FromDiscord | <impbox [ftsf]> nim version? |
02:51:36 | FromDiscord | <retkid> In reply to @Elegantbeef "Does it compile fine": same issue |
02:51:54 | FromDiscord | <retkid> 1.4.8 |
02:52:19 | FromDiscord | <retkid> should i submit an issue to nim github? |
02:53:18 | FromDiscord | <impbox [ftsf]> There's one already, but maybe add some detail |
02:54:16 | FromDiscord | <retkid> but yea |
02:54:22 | FromDiscord | <impbox [ftsf]> https://github.com/nim-lang/Nim/issues/17441 |
02:54:23 | FromDiscord | <retkid> wine is really the only way to gabout this right now |
02:54:41 | FromDiscord | <retkid> > Arch-specific |
02:54:44 | FromDiscord | <retkid> always cool\ |
02:54:45 | FromDiscord | <retkid> (edit) "cool\" => "cool" |
02:54:55 | FromDiscord | <impbox [ftsf]> Or figure out what's causing the -z to be added and remove it |
02:54:59 | FromDiscord | <retkid> its a matter of tracking down whatever the fuck arch is mixing |
02:55:01 | FromDiscord | <retkid> (edit) "mixing" => "missing" |
02:55:40 | FromDiscord | <retkid> i'll add a stack trace to the issue |
03:00:22 | FromDiscord | <retkid> alright time to see how im gonna cross compile to macos |
03:00:28 | FromDiscord | <impbox [ftsf]> Good luck |
03:00:49 | FromDiscord | <retkid> im scrolling for the tool you linked |
03:01:11 | FromDiscord | <retkid> but i might just do the wine thing but with darling |
03:01:58 | * | rockcavera quit (Remote host closed the connection) |
03:02:06 | FromDiscord | <retkid> why does apple wanna make compiling to their platform hard |
03:02:14 | FromDiscord | <retkid> wouldn't a logical company make and maintain a gcc fork |
03:03:56 | FromDiscord | <Elegantbeef> Apple likes walled gardens |
03:04:05 | FromDiscord | <Gustavo6046> oops |
03:04:31 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wYS |
03:04:33 | FromDiscord | <Gustavo6046> currently complains with |
03:04:43 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wYT |
03:04:52 | FromDiscord | <Gustavo6046> and realy I min min, not max, but beside that |
03:05:02 | FromDiscord | <retkid> In reply to @Elegantbeef "Apple likes walled gardens": to quote wendell |
03:05:17 | FromDiscord | <retkid> "while apple perverts the unix ethos" |
03:06:31 | FromDiscord | <j-james> Could I get some structural feedback on my wlroots wrapper? |
03:06:33 | FromDiscord | <j-james> https://github.com/j-james/wlroots |
03:06:35 | nrds | <R2D299> itHub: 7"Nim bindings for wlroots." |
03:06:54 | FromDiscord | <Elegantbeef> The issue gustavo is your concept gives a typedesc in the second slot |
03:07:00 | FromDiscord | <Elegantbeef> It should be like `default Vector3` or similar |
03:07:15 | FromDiscord | <Gustavo6046> oh |
03:07:16 | FromDiscord | <Gustavo6046> (edit) "oh" => "oh?" |
03:07:39 | FromDiscord | <Elegantbeef> `Vector3` is a type description so that procedure will never match |
03:07:43 | FromDiscord | <Gustavo6046> ahh |
03:07:55 | FromDiscord | <Gustavo6046> ah I se |
03:07:57 | FromDiscord | <Gustavo6046> (edit) "se" => "see" |
03:08:01 | FromDiscord | <Gustavo6046> huh |
03:08:08 | FromDiscord | <Gustavo6046> it still complains, but now for an unrelated line |
03:08:10 | FromDiscord | <j-james> I'd mostly like to know if I'm wrapping things right |
03:08:21 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wYU |
03:08:23 | FromDiscord | <Gustavo6046> this time here: |
03:08:29 | FromDiscord | <j-james> Since that can't really be tested until it's finished and working |
03:08:50 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wYV |
03:09:30 | FromDiscord | <Gustavo6046> (line 37 char 24, though I indented the original line with one single extra space to fit the comment's # because I wanted the "arrow" to be as wide as the offset of 24) |
03:10:40 | FromDiscord | <Elegantbeef> james depending on the level of these bindings i do have to ask if you want to use C bitsets or Nim? \:D |
03:10:55 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wYW |
03:17:45 | FromDiscord | <Elegantbeef> You dont have a `collidable(Vector3, Vector3)`? |
03:17:55 | FromDiscord | <Elegantbeef> Rather `checkCollidable` |
03:25:21 | FromDiscord | <j-james> In reply to @Elegantbeef "james depending on the": Fair, haha! My goal was to get working bindings and then try to remove pointer use as much as possible with `var` and so forth |
03:26:01 | FromDiscord | <j-james> It's just an annoyingly large library to get working |
03:26:09 | FromDiscord | <Elegantbeef> Yea i can see |
03:26:47 | FromDiscord | <Elegantbeef> I dont know the api much so aside from telling you to remove `wlr` from everything and also making the flags nim bitsets not much i can say \:D |
03:30:48 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=3wYZ |
03:34:41 | FromDiscord | <retkid> i pinged you because i found you posted the error |
03:35:04 | FromDiscord | <retkid> it was the nim installer someone made that has no need because nim already comes with a good one |
03:35:19 | FromDiscord | <retkid> i was setting up nim on wine |
03:39:24 | FromDiscord | <impbox [ftsf]> retkid the -z is coming from /etc/nim/nim.cfg most likely |
03:42:34 | FromDiscord | <impbox [ftsf]> chuck a nim.cfg in your project dir with `gcc.options.linker = ""` and test |
03:43:21 | FromDiscord | <impbox [ftsf]> on arch i was able to compile with `nimc c -o:main.exe -d:mingw main.nim` |
03:43:38 | FromDiscord | <impbox [ftsf]> after i added that nim.cfg |
03:51:59 | FromDiscord | <Gustavo6046> In reply to @Elegantbeef "Rather `checkCollidable`": no, `check_collision` is meant to be a signed distance function |
03:52:11 | FromDiscord | <Gustavo6046> positive numbers mean outside, negative means inside, 0 is right on the surface |
03:52:14 | * | stkrdknmibalz joined #nim |
03:52:20 | FromDiscord | <Gustavo6046> the larger the number, the larger the distance (in or uot) |
03:52:24 | FromDiscord | <Gustavo6046> (edit) "uot)" => "out)" |
03:52:58 | FromDiscord | <Gustavo6046> so it's not meant to compare two points |
03:53:03 | FromDiscord | <Gustavo6046> that would be their distances |
03:53:26 | FromDiscord | <Gustavo6046> but heh |
03:53:28 | FromDiscord | <Gustavo6046> that makes it work |
03:53:28 | FromDiscord | <Gustavo6046> funny |
03:54:06 | FromDiscord | <Gustavo6046> I guess having an overload of something that is `Collidable` but not `CollidableWorld` in the same module hints at the compiler that there can be _other_ overloads with `Collidable` |
03:54:07 | FromDiscord | <Gustavo6046> neat! |
03:55:19 | FromDiscord | <Gustavo6046> Btw I made a test case for the normal finder, for a plane whose positive side faces -Y, and it seems to get something near <0, -1, 0> pretty consistently \:D |
03:55:28 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wZ0 |
03:55:33 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wZ1 |
03:55:36 | FromDiscord | <Gustavo6046> Yay! |
04:01:40 | FromDiscord | <Elegantbeef> Well @Gustavo6046 concepts are so you can abstract procedures to operator on a type that fulfils a prerequisite so there are always overloads when calling a procedure with a concept that then calls procedures on it |
04:01:51 | FromDiscord | <Gustavo6046> Ah |
04:02:17 | FromDiscord | <Gustavo6046> hmm |
04:02:25 | FromDiscord | <Gustavo6046> wait that's confusing |
04:02:40 | FromDiscord | <Gustavo6046> procedures _to_ operator? |
04:02:50 | FromDiscord | <Elegantbeef> to operate on a type\ |
04:02:52 | FromDiscord | <Gustavo6046> ah |
04:03:10 | FromDiscord | <Gustavo6046> I see |
04:03:16 | FromDiscord | <Gustavo6046> how does a concept call procedures on itself? |
04:03:26 | FromDiscord | <Gustavo6046> it doesn't run anything, it's just a structural definition |
04:03:30 | FromDiscord | <Elegantbeef> It doesnt of course |
04:03:36 | FromDiscord | <Gustavo6046> ah |
04:03:39 | FromDiscord | <Gustavo6046> you said at the end |
04:04:26 | FromDiscord | <Elegantbeef> In your example you've made it so there is a `checkCollision` procedure that you want for this procedure, which means any call to that procedure has an type overloaded version of that procedure |
04:05:20 | FromDiscord | <Elegantbeef> Well i say "has" but i just mean there is overload which matches the concept so it pretty much has one |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.2) |
04:06:30 | * | supakeen joined #nim |
04:06:39 | FromDiscord | <impbox [ftsf]> @retkid updated the issue with a fix, error might be coming from arch's/etc/nim/nim.cfg |
04:07:54 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/880302511272116344/nim.cfg |
04:07:56 | FromDiscord | <retkid> theres mine |
04:08:04 | FromDiscord | <retkid> if you need it |
04:08:12 | FromDiscord | <retkid> lemme upload it as .txt |
04:08:51 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/880302752037752835/nim.txt |
04:10:30 | FromDiscord | <impbox [ftsf]> I don't, but try the suggested fix and see if it solves it for you |
04:18:10 | FromDiscord | <retkid> In reply to @impbox "I don't, but try": return 0 |
04:18:13 | FromDiscord | <retkid> 👍 |
04:18:34 | FromDiscord | <impbox [ftsf]> \o/ |
04:19:00 | FromDiscord | <retkid> however, you failed to get it to me before midnight, it does not count as a birthday gift |
04:19:24 | FromDiscord | <retkid> i kid |
04:19:27 | FromDiscord | <retkid> i appreciate you <3 |
04:24:58 | FromDiscord | <Gustavo6046> Imo, if any concept in the same module has that proc's name, the compiler should assume that proc _will_ be overloaded by other types that satisfy this trait at some point, and if there is only one concrete implementation of this proc in this moduile, it should not attempt to assume that this proc is the implementation and that its type signature overrides the one implied by this concept. |
04:25:16 | FromDiscord | <Elegantbeef> I dont follow what you mean |
04:25:21 | FromDiscord | <Gustavo6046> As in |
04:27:05 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wZ6 |
04:28:03 | FromDiscord | <Gustavo6046> Compiling this should probably error because↵1. it assumes that `getName` only accepts `NameTag` because that's the only implementation the compiler sees;↵2. `NameTag::content` is a `Named`, not a `NameTag`, which does not satisfy this preliminary type signature `getName(NameTag)`. |
04:28:41 | FromDiscord | <Elegantbeef> Well `Named` is not a concrete type |
04:28:50 | FromDiscord | <Gustavo6046> True, but this has no reason to error. |
04:29:06 | FromDiscord | <Gustavo6046> I assume that the compiler parses concepts before it deals with procs' type signatures, right? |
04:29:35 | FromDiscord | <Elegantbeef> I believe concepts checked at instantiation |
04:30:26 | FromDiscord | <Yardanico> In reply to @impbox "<@217459674700578816> updated the issue": Yeah, seems like it's yet another bug of Nim installed from a package manager |
04:30:39 | FromDiscord | <Yardanico> @retkid are you on arch or on an arch based distro? |
04:31:27 | FromDiscord | <Gustavo6046> In that case, when the compiler sees `Named`, it sees the condition `getName(n) is string`. Since `n` is a _concept variable_, as soon as it sees `getName(n)` and no further, it should automatically consider `getName(typeof n)`, in this case `getName(Named)`, as a valid signature for future passes, and only bark if in the specific future instance that `getName` _is_ called, that specific implementation doesn't exist. |
04:32:14 | FromDiscord | <Gustavo6046> Of course, a proc that takes a `Named` and then calls `getName` on that value, is guaranteed that such a `getName` implementation exists by the mere virtue of taking a `Named` because `Named` by definition requires that a `getName ` is defined for it. |
04:32:22 | FromDiscord | <Elegantbeef> but `getName(n)` != `getName(typeof(n))` |
04:32:35 | FromDiscord | <Elegantbeef> You might very well have a procedure which takes a type description |
04:32:37 | FromDiscord | <Gustavo6046> In reply to @Elegantbeef "but `getName(n)` != `getName(typeof(n))`": the latter was a type signature thing |
04:32:44 | FromDiscord | <Gustavo6046> not an actual expression |
04:32:50 | FromDiscord | <Gustavo6046> it should consider that as a valid signature |
04:33:11 | FromDiscord | <Gustavo6046> That is a very simple example that has no reason to cause a compiler error and yet it does |
04:33:18 | FromDiscord | <Gustavo6046> So let's look at where else the issue could be |
04:33:35 | FromDiscord | <Elegantbeef> Can you provide an example that isnt invalid code? |
04:33:37 | FromDiscord | <Gustavo6046> `getName(tag: NameTag)` tries to call `getName(tag.content: Named)` |
04:34:04 | FromDiscord | <Elegantbeef> IE remove the vector and also write the NameTag properly |
04:34:14 | FromDiscord | <Gustavo6046> `tag.content` is a Named, therefore the compiler should assume that there is an implementation for it, and only check in instantiations of `tag.content`. |
04:34:34 | FromDiscord | <Elegantbeef> And you can do that |
04:34:37 | FromDiscord | <Gustavo6046> Oh wait |
04:34:53 | FromDiscord | <Gustavo6046> `NameTag` isn't a concrete type, is it? |
04:35:06 | FromDiscord | <Gustavo6046> Since `Named` isn't a concrete type and we're basically trying to define a member variable `content` that is |
04:35:10 | FromDiscord | <Gustavo6046> Yep! |
04:35:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/I06 |
04:35:21 | FromDiscord | <Gustavo6046> I think that would work |
04:35:42 | FromDiscord | <Elegantbeef> Well it's what i think you were trying to describe with that odd `NameTag = type` and `content: Named` \:D |
04:36:02 | FromDiscord | <Gustavo6046> That works |
04:36:16 | FromDiscord | <Gustavo6046> Ehehe |
04:36:29 | FromDiscord | <Gustavo6046> Well |
04:36:35 | FromDiscord | <Gustavo6046> turns out the other code barked a different thing |
04:36:45 | FromDiscord | <Gustavo6046> Which would be the right error message |
04:36:49 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wZ8 |
04:36:50 | FromDiscord | <Gustavo6046> But in the real world example it was actually a seq |
04:37:20 | FromDiscord | <Elegantbeef> well if you ever feel equipped to improve the state of concepts it's one PR away to contribute 😀 |
04:38:03 | FromDiscord | <Elegantbeef> I do know they're rather cryptic error wise, and often result in some weird issues |
04:38:23 | FromDiscord | <Elegantbeef> And there's also the new concept syntax |
04:38:50 | FromDiscord | <Elegantbeef> where you do `getName(n: Self): string` instead of the `getName(n) is string` |
04:39:10 | FromDiscord | <Gustavo6046> Odd |
04:39:11 | FromDiscord | <Gustavo6046> this worked too |
04:39:24 | FromDiscord | <Gustavo6046> it was very similar to the example that didn't work |
04:39:27 | FromDiscord | <Gustavo6046> sent a code paste, see https://paste.rs/F4j |
04:40:29 | FromDiscord | <Gustavo6046> which implemented a concept for a seq where each item also satisfied this concept, and involved calling a 'concept method' on each element of this seq |
04:41:25 | FromDiscord | <Gustavo6046> (edit) "seq" => "seq," | "concept," => "concept (`seq[X] satisfies X`)," | "where each item also satisfied thisconcept (`seq[X] satisfies X`),and involved calling a 'concept method' on each element of this seq ... " added "(`f(s) where s: seq[X] involves f(s[0]), f(s[1]), ...`)" |
04:41:35 | FromDiscord | <Elegantbeef> Well i know it's a multi file project so you could throw what you have on https://doongjohn.github.io/nim-playground/ and i could see if i can reason the issue |
04:41:38 | FromDiscord | <Gustavo6046> (edit) "f(s[0]), f(s[1]), ...`)" => "f(s[i]) for every i in s`)" |
04:42:21 | FromDiscord | <Gustavo6046> My case was fixed simply by implementing `f` for its own return type (`f(T): T`), or I guess could be any other overload (`f(X): T`) |
04:42:29 | * | FromDiscord quit (Remote host closed the connection) |
04:42:42 | * | FromDiscord joined #nim |
04:43:53 | FromDiscord | <Gustavo6046> I'm just astonished that, when there was only implementation for `checkCollision`, the compiler assumed that it was only for `CollidableWorld = seq[Collidable]` when it should have considered that `Collidable` by definition implied a `checkCollision` implementation for itself and that we were only calling `checkCollision` on the items of this seq (which were `Collidable`s) |
04:44:21 | FromDiscord | <Gustavo6046> Like how did it even once ever think that. |
04:44:24 | FromDiscord | <Gustavo6046> That's what gets me. |
04:44:50 | FromDiscord | <Gustavo6046> My nametag example doesn't seem to reproduce this strange issue even if I make it closer to what the real example was. |
04:45:09 | FromDiscord | <Elegantbeef> I dont follow, it got a type mismatch and printed the procedure(s) which was closest to what you wanted |
04:45:20 | FromDiscord | <Gustavo6046> In reply to @Elegantbeef "Well i know it's": It's simple, though, and in this case I think one module suffices it show it. |
04:45:23 | FromDiscord | <Gustavo6046> A) works, B) doesn't. |
04:45:24 | FromDiscord | <Gustavo6046> A): |
04:45:31 | FromDiscord | <Gustavo6046> B): |
04:45:37 | FromDiscord | <Gustavo6046> sent a code paste, see https://paste.rs/ebh |
04:45:51 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wZc |
04:45:55 | FromDiscord | <Elegantbeef> "one module suffices"... `import vector` 😀 |
04:46:11 | FromDiscord | <Gustavo6046> `Vector3` is just a `array[3, float64]` with some operator overloads |
04:46:23 | FromDiscord | <Gustavo6046> I don't see why that would cause issues |
04:46:33 | FromDiscord | <Gustavo6046> Nonetheless, I did your suggestion of implementing `check_collision` for two `Vector3` . That somehow fixed the error. |
04:46:38 | FromDiscord | <Elegantbeef> Well i meant for me to test the code and see the error |
04:46:41 | FromDiscord | <Gustavo6046> Ah |
04:48:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3wZd |
04:49:49 | FromDiscord | <Gustavo6046> Yep |
04:50:38 | FromDiscord | <Gustavo6046> But for some reason, without implementing the `check_collision(Vector3, Vector3)`, calling it in the implementation of `check_collision(CollidableWorld)` raises errors. |
04:51:40 | FromDiscord | <Elegantbeef> I'm trying to understand why you think it shouldnt cause an error |
04:52:37 | FromDiscord | <Elegantbeef> You're attempting to call a procedure `checkCollision` that takes `Vector3, Vector3` which doesnt exist |
04:53:41 | FromDiscord | <Gustavo6046> In reply to @Elegantbeef "You're attempting to call": `CollidableWorld` items are `Collidable`, not `Vector3`. |
04:55:29 | FromDiscord | <Elegantbeef> Ok so what's your present input data then |
04:55:45 | FromDiscord | <Elegantbeef> Like https://play.nim-lang.org/#ix=3wZe |
04:58:24 | FromDiscord | <Gustavo6046> Ah well |
04:58:30 | FromDiscord | <Gustavo6046> it works in play.nim-lang.org if I merge it into one module |
04:58:32 | FromDiscord | <Gustavo6046> but not for me |
04:59:02 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wZg |
04:59:11 | FromDiscord | <Gustavo6046> Where do you think I'm calling it for Vector3? I'm not |
05:00:04 | FromDiscord | <Elegantbeef> I thought the one error said that mismatch, but looking back seems i was wrong |
05:02:42 | FromDiscord | <Gustavo6046> It was this |
05:02:58 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wZj |
05:03:09 | FromDiscord | <Gustavo6046> (edit) "https://play.nim-lang.org/#ix=3wZj" => "https://play.nim-lang.org/#ix=3wZk" |
05:03:17 | FromDiscord | <Gustavo6046> (the other lines are because test case) |
05:03:18 | FromDiscord | <Gustavo6046> (edit) "https://play.nim-lang.org/#ix=3wZk" => "https://play.nim-lang.org/#ix=3wZl" |
05:04:09 | FromDiscord | <Elegantbeef> Whatever the `Collidable` is in this case is missing a `checkCollision` procedure |
05:04:51 | FromDiscord | <Elegantbeef> Collidable isnt a concrete type remember, it's just a type that quacks like that concept |
05:09:52 | FromDiscord | <Gustavo6046> Well, nothing is calling `check_collision` for `CollidableWorld` yet |
05:10:03 | FromDiscord | <Gustavo6046> It was just for a `YPlane` in this test case: |
05:10:23 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3wZo |
05:10:53 | FromDiscord | <Gustavo6046> Ignore that last part where I printed 30 of them and posted them here earlier lol |
05:11:36 | FromDiscord | <Gustavo6046> (edit) "https://play.nim-lang.org/#ix=3wZo" => "https://play.nim-lang.org/#ix=3wZp" |
05:12:25 | FromDiscord | <Elegantbeef> Which line is the error? |
05:14:13 | FromDiscord | <Gustavo6046> It was earlier in `ray_interface` in the line that called `check_collision` for `obj` (which was also `world[ind]`) |
05:16:51 | FromDiscord | <Elegantbeef> Ah so this just might be the odd binding of concepts, and the procedure not being accessible |
05:23:26 | FromDiscord | <Gustavo6046> Ah |
05:24:47 | FromDiscord | <ondrejoda> sent a code paste, see https://play.nim-lang.org/#ix=3wZt |
05:25:15 | FromDiscord | <Elegantbeef> Cause color is a reference object in this case so you need to do `new result` |
05:25:23 | FromDiscord | <ondrejoda> oh |
05:25:28 | FromDiscord | <ondrejoda> and it returns itself? |
05:26:03 | FromDiscord | <ondrejoda> by that i mean that i don't have to write `return result` at the end of the proc |
05:26:36 | FromDiscord | <Elegantbeef> result is an implicit return value |
05:27:27 | FromDiscord | <Elegantbeef> Also is there a reason you're using a `ref object` for colour? |
05:28:12 | FromDiscord | <codic> yeah you often don't need to |
05:28:34 | FromDiscord | <codic> you can also write `(r, g, b, a: uint8)` |
05:28:42 | FromDiscord | <ondrejoda> well i wanted to make my own object |
05:28:51 | FromDiscord | <codic> you can use plain object |
05:28:56 | FromDiscord | <ondrejoda> but i didn't know that it doesn't have to be a ref |
05:28:57 | FromDiscord | <codic> no real need for ref object in this case |
05:29:11 | FromDiscord | <codic> ref object = passed around by reference |
05:29:25 | FromDiscord | <codic> it's just a shorthand for in every plcae you use it making the type ref T instead of T iirc |
05:29:46 | FromDiscord | <ondrejoda> i get that↵ok, so i will replace that |
05:30:09 | FromDiscord | <Elegantbeef> With that change you dont need `new result` |
05:30:18 | FromDiscord | <Elegantbeef> since `new` initializes a reference |
05:30:40 | FromDiscord | <ondrejoda> figured |
05:32:03 | FromDiscord | <Elegantbeef> also you'll want to rename it `initColor` since it's a non reference |
05:32:19 | FromDiscord | <Elegantbeef> That's the convention atleast |
05:36:07 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://paste.rs/6BN |
05:36:31 | FromDiscord | <Elegantbeef> Indeed, with ref or non ref aswell |
05:36:37 | FromDiscord | <impbox [ftsf]> yep |
05:36:49 | FromDiscord | <Elegantbeef> Or you can drop the `result =` and be cool |
05:36:56 | FromDiscord | <impbox [ftsf]> that's too confusing for me |
05:37:26 | FromDiscord | <impbox [ftsf]> `proc newColor(r:uint8, g:uint8, b:uint8, a:uint8): Color = Color(r: r, g: g, b: b, a: a)` |
05:37:44 | FromDiscord | <impbox [ftsf]> (edit) "newColor(r:uint8, g:uint8, b:uint8, a:uint8):" => "newColor(r,g,b,a: uint8):" |
06:05:59 | * | PMunch joined #nim |
06:07:29 | FromDiscord | <retkid> In reply to @Yardanico "<@217459674700578816> are you on": arch\ |
06:28:52 | FromDiscord | <enthus1ast> @Gustavo6046\: btw you can annotate the concept with the {.explain.} pragma then it should give more hints why a concept does not match |
06:29:03 | FromDiscord | <Gustavo6046> ahh |
06:30:08 | FromDiscord | <Gustavo6046> In reply to @codic "ref object = passed": Isn't it better for large values to pass by reference rather than copying the raw values everytime? Or is that only when "copying"? |
06:30:18 | FromDiscord | <Gustavo6046> I remember Rust makes a big deal of things like this |
06:30:28 | FromDiscord | <Gustavo6046> Anyway I'm of to bed now |
06:30:29 | FromDiscord | <Gustavo6046> Cya! |
06:30:38 | FromDiscord | <Elegantbeef> Depends what you're doing Nim passes by reference for large objects |
06:30:52 | FromDiscord | <Elegantbeef> Nim doesnt do copy on write for variable assignment though |
06:31:20 | FromDiscord | <Gustavo6046> ah |
06:31:47 | FromDiscord | <Elegantbeef> you can also annotate the typedef with `{.byCopy.}` or `{.byRef.}` to force it to always be one |
06:57:14 | madprops | how can I raise with a simple message? |
06:57:20 | madprops | do I have to specify an exception type? |
06:58:20 | madprops | oh I think not |
06:58:33 | FromDiscord | <Rika> you can use a generic `CatchableError` for your exception type |
06:58:41 | FromDiscord | <Rika> i think its called catchable error, i forget |
07:00:21 | madprops | thanks that works |
07:12:21 | madprops | is doAssertRaises a way to check if a call "succesfully" raises and exception on integration tests? |
07:14:30 | madprops | I just want to check some cases where the proc is supposed to raise an exception, or is that silly? |
07:15:03 | FromDiscord | <Elegantbeef> That's what `doAssertRaises` is for |
07:15:34 | madprops | don't think I understand it though.. |
07:16:03 | madprops | tried something like https://dpaste.org/tooa |
07:16:39 | FromDiscord | <Elegantbeef> Yea that block doesnt raise `CatchableError` |
07:18:23 | FromDiscord | <Elegantbeef> Something like this is proper https://play.nim-lang.org/#ix=3wZJ |
07:18:44 | FromDiscord | <Elegantbeef> Imagine the raise is done by giving incorrect data instead of the bool |
07:20:04 | madprops | ah I see, thanks |
07:24:56 | madprops | what's the purpose of: Warning: No nimblemeta.json file found in ...[path] on every compilation ? |
07:25:06 | madprops | it's from a program unrelated to the current project |
07:25:11 | madprops | which I installed with nimble |
07:26:50 | madprops | actually only happens on `nimble test` |
07:28:17 | madprops | can't remove the package |
07:28:44 | madprops | Error: unhandled exception: cannot read from file: thepackage/nimblemeta.json [IOError] |
07:29:34 | madprops | when I removed it manually |
07:29:47 | madprops | well* |
07:32:33 | * | Vladar joined #nim |
07:54:01 | * | max22- joined #nim |
07:56:42 | PMunch | I've seen some errors recently with regards to the playground. Turns out it OOMed when the log file from a container got too large (whoops). I've tweaked the server to truncate logs now, and also done some changes to the OOM policy on the server, so the playground should be much more stable and resilient to malicious code now :) |
07:59:21 | FromDiscord | <Elegantbeef> Nice, i'll try not to crash it so much |
07:59:34 | FromDiscord | <Yardanico> there are also some alternatives (not saying that playground is bad :P) |
07:59:36 | FromDiscord | <Yardanico> e.g. wandbox.org |
07:59:46 | FromDiscord | <Yardanico> replit.com (they finally updated to 1.4.8) |
07:59:55 | FromDiscord | <Yardanico> wandbox.org even has a devel version |
08:00:42 | FromDiscord | <Elegantbeef> Pmunch following behind 😛 |
08:00:49 | FromDiscord | <Elegantbeef> "falling" is the proper verb, my brain is dumb |
08:01:03 | PMunch | Yeah I know, still nice to have the official playground a bit more stable :P |
08:01:06 | FromDiscord | <Yardanico> apparently in replit you even get access to a shell https://media.discordapp.net/attachments/371759389889003532/880361197390680064/unknown.png |
08:01:29 | FromDiscord | <Yardanico> (the dir name is the default random name of the repl session) |
08:02:21 | PMunch | I'd like to build devel images on the playground as well, but it's not the most powerful of things so I fear it might make it pretty slow or fill up the disk.. |
08:02:49 | FromDiscord | <Elegantbeef> Could get nightlies |
08:03:08 | FromDiscord | <Elegantbeef> Not the best but hey some devel |
08:03:47 | PMunch | Yeah that is what I was thinking |
08:04:18 | PMunch | Hmm, I guess it wouldn't have to build them from scratch. Could just grab the latest nightly in a container |
08:05:00 | * | Vladar quit (Quit: Leaving) |
08:06:37 | FromDiscord | <Elegantbeef> I may take a look at adding some stuff tomorrow, mostly the local storing of files and ability to give the parameters to the compiler directly |
08:07:12 | FromDiscord | <Elegantbeef> The local storing is front end only so easier t odo |
08:08:25 | PMunch | The frontend should really get a touch-up as well |
08:09:59 | FromDiscord | <Yardanico> also a really small nitpick which can probably be fixed with a really small fix - reverse ordering in the version selection dropdown |
08:10:05 | FromDiscord | <Yardanico> so it sorts from v1 to v0 and not the other way |
08:12:06 | PMunch | I just sorted it lazily that way so latest would be on top and the default :P |
08:12:24 | PMunch | But yeah, that'd be an easy fix as well |
08:18:43 | * | jjido joined #nim |
08:45:03 | PMunch | Hmm, not sure if Nim in general has just gotten better or if my standards have dropped. But I feel like lately that stuff increasingly "just works" when I program in Nim |
08:45:30 | PMunch | Just downloaded 16 month old bindings for libclang and they work perfectly |
08:46:53 | FromDiscord | <Rika> You’re probably doing less sketchy stuff |
08:51:27 | PMunch | Hmm, maybe.. But somehow I doubt it :P |
08:58:08 | FromDiscord | <Varriount> Anyone want to guess how long writing this comment took? https://github.com/nim-lang/RFCs/issues/411#issuecomment-906221395 |
09:00:00 | FromDiscord | <hugogranstrom> 3 days? :P |
09:00:13 | FromDiscord | <Elegantbeef> Rumour has it he's still writing |
09:00:29 | FromDiscord | <hugogranstrom> xD |
09:02:27 | FromDiscord | <xflywind> In reply to @Varriount "Anyone want to guess": links are broken |
09:03:02 | FromDiscord | <xflywind> > nim-lang/Nim#17898 had a perfectly viable solution without modifying how initRand works.↵> nim-lang/Nim#18729 has a miniscule amount of overhead - amortized over time, it's a single boolean check. Overhead must always be considered in the context it occurs in. |
09:03:31 | FromDiscord | <Varriount> Gosh darn it |
09:03:46 | FromDiscord | <Elegantbeef> Now for the joke of "clearly not enough time spent writing" |
09:04:01 | FromDiscord | <Varriount> 4 hours |
09:08:38 | FromDiscord | <enthus1ast> I also have this impression, thanks to stable releases and back porting effort I guess↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
09:12:28 | FromDiscord | <Varriount> In reply to @Elegantbeef "Now for the joke": You try digging through Intel's instruction set documentation and Linux's source code for 4 hours, and see if your head doesn't spin. |
09:13:50 | FromDiscord | <Varriount> Though, actually, Intel's documentation was rather well organized. |
09:14:03 | PMunch | Given a table from something to a sequence, is there an easy way to add something to that sequence given a key, creating a new sequence to add to if the key doesn't exist in the table? |
09:14:47 | FromDiscord | <Varriount> getOrDefault? |
09:14:52 | FromDiscord | <Elegantbeef> It's not lazily evaluated but `hasKeyOrPut` |
09:15:19 | FromDiscord | <Neko~Neko~ni> sent a long message, see http://ix.io/3x08 |
09:15:55 | PMunch | mgetOrPut seems like what I need |
09:15:57 | FromDiscord | <Elegantbeef> well you have an unscoped global variable |
09:16:01 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
09:16:03 | FromDiscord | <Elegantbeef> Nim's variables have sensible scope |
09:16:22 | FromDiscord | <Elegantbeef> you can do `var someVar {.global.} = 100` inside a procedure to make it global but scoped to the function |
09:17:12 | FromDiscord | <Elegantbeef> Uncertain what the code looks like so cannot say much to what's best |
09:18:13 | FromDiscord | <Neko~Neko~ni> In reply to @Elegantbeef "you can do `var": Sorry but what do you exactly mean by that? |
09:19:30 | FromDiscord | <Elegantbeef> For instance |
09:19:34 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3x0a |
09:20:45 | FromDiscord | <Neko~Neko~ni> i see,thanks |
09:21:17 | FromDiscord | <Elegantbeef> If that doesnt help feel free to write a minimal example and i'll suggest something else |
09:45:37 | * | jjido joined #nim |
09:52:22 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
10:09:05 | * | Pyautogui joined #nim |
10:11:01 | * | Pyautogui quit (Client Quit) |
10:38:58 | * | xet7 quit (Remote host closed the connection) |
10:41:31 | * | xet7 joined #nim |
10:42:58 | * | Vladar joined #nim |
10:53:03 | * | auxym_ joined #nim |
10:59:09 | FromDiscord | <gogolxdong (liuxiaodong)> How to get the home dir of current user, like windows is C\:/Users/admin |
11:00:54 | FromDiscord | <Yardanico> https://nim-lang.org/docs/os.html#getHomeDir |
11:01:10 | FromDiscord | <Yardanico> you can just search "home" in the search bar in docs |
11:04:32 | FromDiscord | <gogolxdong (liuxiaodong)> ok, thanks |
11:05:50 | * | jjido joined #nim |
11:13:41 | * | max22- quit (Quit: Leaving) |
11:15:45 | * | auxym_ quit (Ping timeout: 248 seconds) |
11:41:36 | * | stkrdknmibalz quit (Quit: WeeChat 3.0.1) |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.2) |
12:06:31 | * | supakeen joined #nim |
12:10:11 | * | arkurious joined #nim |
12:17:07 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
12:31:59 | * | flynn quit (Read error: Connection reset by peer) |
12:33:07 | * | flynn joined #nim |
12:56:56 | * | jjido joined #nim |
13:14:30 | FromDiscord | <gerwy> umm i know its maybe a stupid thing to ask |
13:15:06 | FromDiscord | <gerwy> but how would i remove certain characters from string? i don't see any remove function that would remove one character from string in manual |
13:15:37 | FromDiscord | <enthus1ast> replace? |
13:15:49 | FromDiscord | <enthus1ast> https://nim-lang.org/docs/strutils.html#replace%2Cstring%2Cstring%2Cstring |
13:16:06 | PMunch | Yeah, just replace with an empty string works |
13:16:10 | FromDiscord | <Recruit_main707> replace("someting", "") |
13:16:25 | FromDiscord | <gerwy> aah so that way |
13:16:39 | FromDiscord | <gerwy> Thanks! |
13:17:19 | FromDiscord | <gerwy> and i see there is multiReplace which is good because i need to get rid of quiet a few characters |
13:19:51 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3x12 |
13:22:15 | FromDiscord | <gerwy> too much work i think, replace should do the work |
13:27:39 | * | jfinkhaeuser joined #nim |
13:30:03 | * | rockcavera joined #nim |
13:30:03 | * | rockcavera quit (Changing host) |
13:30:03 | * | rockcavera joined #nim |
13:33:04 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
13:59:27 | PMunch | Hmm, trying to use libclang to parse C header files and generate the corresponding Nim bindings. Seems promising so far |
14:00:44 | * | PMunch quit (Quit: Leaving) |
14:01:42 | FromDiscord | <macaroni> hey there, I was wondering, how can I pass command line arguments to a nim executable? For example running from the terminal ./main arg1 arg2 |
14:02:14 | FromDiscord | <gerwy> paramStr([index of the argument])↵i think |
14:02:22 | FromDiscord | <gerwy> in os module |
14:03:01 | FromDiscord | <Rika> https://nim-lang.org/docs/os.html#paramStr%2Cint |
14:03:13 | FromDiscord | <Rika> or commandLineParams |
14:03:50 | FromDiscord | <macaroni> @gerwy @Rika thank you both! |
14:22:27 | * | vsantana joined #nim |
14:22:57 | * | pch_ joined #nim |
14:23:00 | * | pch quit (Read error: Connection reset by peer) |
14:32:07 | * | def- quit (Quit: -) |
14:32:18 | * | def- joined #nim |
14:35:45 | * | vsantana quit (Quit: Client closed) |
14:36:14 | * | auxym_ joined #nim |
14:49:38 | FromDiscord | <enthus1ast> @macaroni\: for more sophisticated command line handling also have a look at\: https://github.com/c-blake/cligen |
14:49:40 | nrds | <R2D299> itHub: 7"Nim library to infer/generate command-line-interfaces / option / argument parsing; Docs At" |
15:25:04 | FromDiscord | <Yardanico> or docopt |
15:43:23 | arkanoid | PMunch, is it better than tree-sitter? |
15:43:27 | arkanoid | oh, he left |
15:57:06 | FromDiscord | <haxscramper> liblcang vs tree sitter?↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
16:00:33 | FromDiscord | <Recruit_main707> sent a code paste, see https://play.nim-lang.org/#ix=3x1Y |
16:02:23 | FromDiscord | <Rika> whats the issue? |
16:02:42 | FromDiscord | <Rika> oh |
16:02:48 | FromDiscord | <Rika> eh? no other changes? |
16:02:49 | FromDiscord | <Rika> are you sure |
16:02:55 | FromDiscord | <Recruit_main707> yes |
16:03:05 | FromDiscord | <Rika> so offset just suddenly changes? |
16:03:10 | FromDiscord | <Recruit_main707> apparently |
16:03:24 | FromDiscord | <Rika> can you reproduce with another example |
16:03:29 | FromDiscord | <Recruit_main707> ill try |
16:04:40 | * | auxym_ quit (Ping timeout: 240 seconds) |
16:10:06 | FromDiscord | <Recruit_main707> after that i call `GetVal[T](addr seq)` which casts a seq of bytes to something (float32 in this case),↵removing it makes the error disappear |
16:10:18 | FromDiscord | <Recruit_main707> 🥴 |
16:11:12 | FromDiscord | <Yardanico> you can't do a cast like that |
16:11:21 | FromDiscord | <Yardanico> you need `addr seq[0]` not `addr seq` |
16:11:29 | FromDiscord | <Yardanico> because seq has a header with capacity and other internal stuff at the start |
16:11:33 | FromDiscord | <Recruit_main707> i handle it inside the function |
16:11:38 | FromDiscord | <Yardanico> how |
16:11:44 | FromDiscord | <Yardanico> `addr seq` doesn't look very safe :P |
16:13:01 | FromDiscord | <Recruit_main707> basically dereference it and then get the address of the 0th element, but thats besides the point isnt it |
16:13:34 | FromDiscord | <Yardanico> well a lot of funny things can happen, like this seq being destroyed by the GC |
16:14:18 | FromDiscord | <Recruit_main707> still that cannot cause my issue |
16:46:32 | * | flynn quit (Read error: Connection reset by peer) |
16:47:39 | * | flynn joined #nim |
16:59:34 | * | xet7 quit (Remote host closed the connection) |
17:03:20 | * | auxym_ joined #nim |
17:07:18 | * | xet7 joined #nim |
17:08:49 | * | auxym_ quit (Ping timeout: 248 seconds) |
17:22:17 | * | auxym_ joined #nim |
17:33:50 | * | perro quit (Read error: Connection reset by peer) |
17:38:00 | * | perro joined #nim |
17:43:28 | * | tiorock joined #nim |
17:43:28 | * | tiorock quit (Changing host) |
17:43:28 | * | tiorock joined #nim |
17:43:28 | * | rockcavera quit (Killed (tungsten.libera.chat (Nickname regained by services))) |
17:43:28 | * | tiorock is now known as rockcavera |
17:45:02 | * | rockcavera is now known as Guest9186 |
17:45:02 | * | tiorock joined #nim |
17:45:02 | * | Guest9186 quit (Killed (cadmium.libera.chat (Nickname regained by services))) |
17:45:02 | * | tiorock is now known as rockcavera |
17:50:13 | * | andinus joined #nim |
17:54:21 | * | jjido joined #nim |
17:59:47 | auxym_ | Anyone have an idea what is going here? https://play.nim-lang.org/#ix=3x2D It won't run on playground, possibly because of unsafeAddr, so run it locally if possible... |
18:00:51 | FromDiscord | <Recruit_main707> unsafeAddr does work on playground so that cant be the reason afaik |
18:01:08 | * | nrds quit (Remote host closed the connection) |
18:01:20 | FromDiscord | <Recruit_main707> what are you trying to do? |
18:01:29 | auxym_ | I'm trying to use the raw pointer of a `ref object` as a hash value for tables, but getting weird behavior. Seems to work OK when adding using []=, but doing the same in a proc call results in the same key apparently getting added to the table twice |
18:01:37 | * | nrds joined #nim |
18:01:48 | FromDiscord | <haxscramper> https://wandbox.org/permlink/oCPMOzRpmJuwMiqe |
18:02:05 | FromDiscord | <haxscramper> same code, but at least not "killed" |
18:02:44 | auxym_ | thanks. Same behavior I get locally. As you can see from the last 3 lines, my table has 2 keys with the same hash ?? |
18:05:04 | auxym_ | Is using `unsafeAddr.hash` as a hash value a bad idea for object refs? Any other suggestions? I want a table/hashset that can hold instances of ref objects that are identical in fields but are actually different instances |
18:05:21 | FromDiscord | <Recruit_main707> > I'm trying to use the raw pointer of a ref object as a hash value↵you are not doing it correctly though, thats getting the address of the argument isnt it? |
18:05:48 | FromDiscord | <Recruit_main707> it should be something like cast[pointer](x).hash i guess |
18:06:07 | auxym_ | My understanding is that unsafeAddr returns a `pointer` and then `hash[pointer |
18:06:32 | auxym_ | and then `hash[pointer]` for the hashes module uses the address to create a `Hash` |
18:06:43 | FromDiscord | <dom96> auxym_: what is your goal? |
18:06:49 | FromDiscord | <Recruit_main707> returns the pointer of what you pass, but you are already passing the pointer (reference), so thats the pointer to a pointer |
18:06:50 | FromDiscord | <dom96> hashing refs like this seems like a really bad idea |
18:07:35 | auxym_ | dom96: I want a table/hashset that can hold instances of ref objects that are identical in fields but are actually different instances. Similar to default behavior to python object instances IIRC |
18:08:07 | auxym_ | Recruit_main707: ah... makes sense. Using the cast sounds like a bad idea though. |
18:08:38 | FromDiscord | <dom96> what's the even higher-level goal here? 🙂 |
18:10:21 | auxym_ | creating a simple graph structure that's basically a `type Graph[T] = Table[T, HashSet[T]]`. And can hold identical but separate instances of ref objects |
18:12:46 | * | byanka quit (Ping timeout: 268 seconds) |
18:13:51 | FromDiscord | <dom96> why do you need it to hold identical but separate instances of ref objects? |
18:14:01 | FromDiscord | <s_tmux> var chicken = good↵echo chicken↵↵what am i doing wrong here? |
18:16:22 | auxym_ | dom96: Good point. I could live without it. At worst add a uuid field to my objects to differentiate them. I guess my python background is showing. |
18:17:26 | * | supakeen quit (Remote host closed the connection) |
18:17:50 | * | supakeen joined #nim |
18:18:55 | auxym_ | s_tmux: `var chicken = "good"` ? (the quotes?) |
18:19:13 | FromDiscord | <dom96> yes, that would be much better than having to rely on `unsafeAddr` and other unsafe mechanisms |
18:19:40 | auxym_ | yeah. Thanks. I'll get something like that going. |
18:20:16 | FromDiscord | <s_tmux> oh right thanks |
18:22:06 | FromDiscord | <haxscramper> if you really want you can do `cas[int](Rf)` |
18:24:57 | * | Gustavo6046 quit (Ping timeout: 250 seconds) |
18:25:06 | auxym_ | Yeah. I guess. I don't like the idea, sounds sort of unsafe and dependant on Nim's implementation of refs |
18:25:37 | auxym_ | Which is probably not guaranteed to be stable across GCs, etc. |
18:28:45 | FromDiscord | <Zachary Carter> `unpackVarargs` is nice |
18:29:07 | FromDiscord | <Zachary Carter> sent a code paste, see https://paste.rs/LE0 |
18:31:48 | * | Gustavo6046 joined #nim |
18:32:08 | FromDiscord | <s_tmux> sent a code paste, see https://play.nim-lang.org/#ix=3x2V |
18:32:16 | FromDiscord | <Zachary Carter> `echo repr response` |
18:32:20 | FromDiscord | <Zachary Carter> if `response` is a `ref object` |
18:32:32 | FromDiscord | <Zachary Carter> otherwise if it's a plain `object` or `tuple` you can just `echo response` |
18:32:54 | FromDiscord | <talaing> Hello, how can I send `application/x-www-form-urlencoded` data using `httpclient` module? |
18:33:01 | FromDiscord | <Zachary Carter> google |
18:33:04 | FromDiscord | <Zachary Carter> is how |
18:33:14 | FromDiscord | <Zachary Carter> and stdlib docs |
18:33:22 | FromDiscord | <dom96> In reply to @Zachary Carter "if `response` is a": you can also just `echo response[]` if it's a ref |
18:33:32 | FromDiscord | <Zachary Carter> or yeah - dereference the ref |
18:33:34 | FromDiscord | <Zachary Carter> that works too |
18:36:59 | FromDiscord | <Zachary Carter> In reply to @talaing "Hello, how can I": honestly the best thing to do is just learn to use github search |
18:37:04 | FromDiscord | <Zachary Carter> it's basically how I learned Nim |
18:37:21 | FromDiscord | <Zachary Carter> reading other people's source code, regardless of what language you're trying to learn, is an invaluable resource |
18:37:27 | * | max22- joined #nim |
18:37:48 | FromDiscord | <Zachary Carter> I bet if you do a search on github for `application/x-www-form-urlencoded` and `httpclient` and set the language filter to `Nim` you'll find what you're looking for 😉 |
18:38:05 | FromDiscord | <dom96> Elite Tip right there |
18:38:34 | FromDiscord | <talaing> I don't use GitHub search very often, usually I just google the issue |
18:38:40 | FromDiscord | <talaing> thank you for your tip 🙂 |
18:38:44 | FromDiscord | <Zachary Carter> Yeah, no problem! |
18:39:55 | FromDiscord | <talaing> Found it in less than 1 minute |
18:40:06 | FromDiscord | <talaing> I'm gonna use GH search more often |
18:40:10 | FromDiscord | <talaing> Thank you 😄 |
18:40:15 | FromDiscord | <Zachary Carter> 😄 |
18:40:21 | FromDiscord | <Zachary Carter> You're very welcome 🙂 |
18:40:24 | FromDiscord | <Zachary Carter> (edit) "welcome 🙂" => "welcome!" |
18:41:30 | FromDiscord | <dom96> This makes me wonder, are there any services for companies that crawl their code bases and index them into a nice search engine? I feel like that'd be a pretty nice SaaS opportunity |
18:44:52 | * | SebastianM joined #nim |
18:44:56 | FromDiscord | <s_tmux> what is a proc? https://nim-lang.org/docs/httpclient.html#12 |
18:46:13 | FromDiscord | <dom96> a different name for a function |
18:46:14 | FromDiscord | <dom96> https://en.wikipedia.org/wiki/Subroutine |
18:47:19 | FromDiscord | <s_tmux> thanks dom |
18:47:56 | FromDiscord | <s_tmux> sent a code paste, see https://play.nim-lang.org/#ix=3x2X |
18:50:12 | FromDiscord | <dom96> In reply to @dom96 "This makes me wonder,": of course, all good ideas have already been implemented by somebody else: https://about.sourcegraph.com/ 🙂 |
18:50:40 | * | byanka joined #nim |
18:51:57 | FromDiscord | <s_tmux> i was gonna start inventorying wirless networks in my local area, had a plan for it and everything.. then yesterday i found wigle.net |
18:58:41 | FromDiscord | <Cark> I'm trying to do multithreading, but it's quite the rabbit hole ... This heap per thread business is frightening. For instance i'm trying to access a global (for now) seq from a withLock call... what happens if the seq allocates memory when adding to it from the thread ? will this memory possibly be allocated on the wrong heap ? |
19:00:25 | FromDiscord | <Cark> Maybe I'm supposed to only use Channels forgoing any sharing ? but doesn't orc fix some of this ? |
19:01:20 | FromDiscord | <Cark> i've been scouring the web and reading for hours, but i feel like some of the things i find are outdated, i'm not quite sure what is safe and what isn't |
19:02:52 | FromDiscord | <Cark> I think i could go full C in nim, but i like those seqs and strings |
19:03:17 | FromDiscord | <Cark> and the standard library at large |
19:05:17 | FromDiscord | <dom96> Step back a bit, why are you going after multithreading? |
19:05:22 | FromDiscord | <Recruit_main707> yeah, i dont like how you work with threads in nim |
19:05:35 | FromDiscord | <Recruit_main707> i hope it improves i the future |
19:05:44 | FromDiscord | <Cark> @dom96 I have to, i'm doing a windows service |
19:06:03 | FromDiscord | <Cark> also any software needs those these days |
19:06:16 | FromDiscord | <s_tmux> is there a argv client or something i can use to write command line app? |
19:06:59 | FromDiscord | <dom96> In reply to @Cark "<@!132595483838251008> I have to,": why does a windows service require it? |
19:07:42 | FromDiscord | <Cark> you need to do a blocking call and do the work in a thread |
19:09:04 | FromDiscord | <dom96> interesting |
19:09:38 | FromDiscord | <Cark> well i shouldn't have mentioned it, because virtually all the program is in this thread and there is no real communication |
19:10:11 | FromDiscord | <Cark> but i'm afraid diving very deep in nim if i can't get multithreading right |
19:10:32 | FromDiscord | <Cark> when i can do it in C in a straightforward manner |
19:10:55 | FromDiscord | <dom96> Maybe the simplest approach would be to write a quick wrapper in C/C++ that spawns a new thread and calls the Nim program in it |
19:11:17 | FromDiscord | <dom96> That way you can pretend that there is just a single thread in Nim |
19:11:53 | FromDiscord | <Cark> that makes sense |
19:12:27 | FromDiscord | <dom96> alternatively you can also do your best to avoid global vars |
19:12:41 | FromDiscord | <Cark> right, but how do you do sharing ? |
19:12:43 | FromDiscord | <dom96> which is a good practice anyway |
19:12:56 | FromDiscord | <dom96> just pass data around via function args |
19:13:09 | FromDiscord | <Cark> i'm using global just for testing, because it seems enclosing the shared stuff is even more hairy |
19:13:29 | FromDiscord | <dom96> what stuff do you need to share? |
19:13:49 | FromDiscord | <dom96> what I typically have is a `State` object that contains the common things everything in the app needs |
19:14:10 | FromDiscord | <Cark> ok right now as an exercise i'm doing some logging |
19:14:27 | FromDiscord | <Cark> so you have the consol logger and maybe a rotating file logger |
19:14:34 | FromDiscord | <Cark> which you could add to that seq |
19:14:43 | FromDiscord | <Cark> i'll never touch those really |
19:14:53 | FromDiscord | <Cark> but i want to be able to as an exercise |
19:15:01 | FromDiscord | <Cark> add them from the main thread |
19:15:14 | FromDiscord | <Cark> and have the logging thread use them |
19:15:45 | FromDiscord | <dom96> do the logging from the main thread, why have a separate thread for it? |
19:16:03 | FromDiscord | <Cark> in order to exercise multithreading with nim =) |
19:16:59 | FromDiscord | <Cark> also |
19:17:12 | FromDiscord | <Cark> in my service i'll want logging from the main thread and from the work thread |
19:17:30 | FromDiscord | <Cark> it makes sense to have a logging thread |
19:17:37 | FromDiscord | <dom96> meh, you're just making the code more complex than it needs to be 🙂 |
19:18:30 | FromDiscord | <Cark> well that the point ! i really don't even need to make a service =) |
19:18:42 | FromDiscord | <dom96> lol |
19:18:50 | FromDiscord | <Cark> i could wrap a command line program in that automatic service thingie i forgot the name of |
19:19:02 | FromDiscord | <Cark> but then i would learn nothing =) |
19:19:47 | FromDiscord | <dom96> if you want to learn multithreading then consider picking a use case that requires it, for example utilising all your CPU's cores |
19:20:00 | FromDiscord | <dom96> one example is parsing which I used in my book's chapter on parallelism 😉 |
19:20:27 | FromDiscord | <Cark> i think it's a common use case, delegating IO to a dedicated thread |
19:21:19 | FromDiscord | <Cark> there are timing constraints on windows srvices (which i probably could meet in a single thread but hum yeah) |
19:26:55 | * | auxym_ quit (Ping timeout: 250 seconds) |
19:28:03 | * | auxym_ joined #nim |
19:31:09 | FromDiscord | <enthus1ast> I've done some work on an windows service in nim, maybe you can build on this code\: https://github.com/enthus1ast/nimWindowsService |
19:31:12 | nrds | <R2D299> itHub: 7"[WIP] a simple windows service in nim-lang" |
19:31:40 | FromDiscord | <Cark> oh i think i indeed di have a look at it ! |
19:31:44 | FromDiscord | <Cark> (edit) "di" => "did" |
19:31:53 | FromDiscord | <enthus1ast> and if you make it better please PR ;) |
19:35:09 | FromDiscord | <enthus1ast> oh windows service should use threads |
19:35:40 | FromDiscord | <Cark> well i'm no authority on the subject, that was my understanding |
19:36:04 | * | neurocyte830 joined #nim |
19:36:20 | * | neurocyte830 is now known as neurocyte |
19:40:34 | FromDiscord | <s_tmux> sent a code paste, see https://play.nim-lang.org/#ix=3x3h |
19:43:13 | * | SebastianM quit (Quit: Bye) |
20:02:01 | FromDiscord | <ajusa> Anyone know why↵` output = socket.recv(3, timeout = 5000)` returns data inside of output but↵` output = socket.recv(1000, timeout = 5000)` doesn't? I was expecting that the second would read up to 1000 bytes, and if there aren't that many, after the timeout it would return all it read |
20:02:04 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
20:11:08 | * | flynn quit (Read error: Connection reset by peer) |
20:11:34 | * | jjido joined #nim |
20:12:14 | * | flynn joined #nim |
20:16:28 | FromDiscord | <RattleyCooper> sent a code paste, see https://play.nim-lang.org/#ix=3x3x |
20:19:17 | * | Vladar quit (Quit: Leaving) |
20:26:36 | * | auxym_ quit (Ping timeout: 250 seconds) |
20:43:11 | FromDiscord | <dom96> In reply to @ajusa "Anyone know why `": I believe those are the semantics but check the docs |
20:50:52 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3x3F |
20:52:06 | FromDiscord | <Cark> you could wrap it in an object variant |
20:52:28 | FromDiscord | <Cark> https://nim-lang.org/docs/manual.html#types-object-variants |
20:55:26 | FromDiscord | <Ayy Lmao> In reply to @Cark "you could wrap it": I will have to experiment with that. |
20:56:55 | * | Gustavo6046 quit (Ping timeout: 252 seconds) |
20:57:07 | FromDiscord | <Zachary Carter> @Cark you need to understand quite a bit about Nim's memory model before diving into multithreaded code IMHO |
20:57:18 | FromDiscord | <Zachary Carter> hint: ARC/ORC will get you a long way |
20:57:31 | FromDiscord | <Cark> @Zachary Carter that's the thing exactly |
20:57:52 | FromDiscord | <Cark> and my first question is all about that... but i'd like to find an authoritative resource |
20:57:54 | FromDiscord | <Zachary Carter> thread local heaps aren't too much of an issue, unless you're loading symbols from shared library or doing stuff where you have multiple Nim GC's |
20:58:03 | FromDiscord | <Zachary Carter> I mean I write quite a bit of multithreaded Nim code |
20:58:08 | * | Gustavo6046 joined #nim |
20:58:20 | FromDiscord | <Zachary Carter> I don't know if I qualify as an authoritative source |
20:58:28 | FromDiscord | <Zachary Carter> but what specific question(s) do you have? |
20:59:07 | * | mal``` joined #nim |
20:59:17 | FromDiscord | <Cark> so i don't need to worry when using a seq (inside a lock), it won't allocate memory from a thread specific heap ? |
20:59:30 | FromDiscord | <treeform> also if you use arc no more thread local heaps |
20:59:32 | FromDiscord | <Zachary Carter> it depends on what garbage collector you're using |
20:59:43 | FromDiscord | <Cark> i'm ready to use arc or orc |
21:00:01 | FromDiscord | <treeform> then you should be able to use locks and stuff like in C/C++ |
21:00:12 | FromDiscord | <Zachary Carter> with ARC/ORC there are still thread local heaps |
21:00:20 | FromDiscord | <Cark> allright that's some pretty good news |
21:00:24 | FromDiscord | <Zachary Carter> it's just by default Nim will allocate ref objects on the shared heap |
21:00:38 | FromDiscord | <Zachary Carter> if you're manually allocating memory, you still need to call `createShared/allocShared` |
21:00:52 | FromDiscord | <Cark> ah so i need to have everything that's croos thread a ref ? |
21:01:03 | FromDiscord | <Zachary Carter> no |
21:01:05 | FromDiscord | <Cark> (edit) "croos" => "cross" |
21:01:27 | FromDiscord | <Zachary Carter> you need to allocate memory you want to share between threads on the shared heap |
21:01:29 | * | happycorsair[m]1 joined #nim |
21:01:32 | FromDiscord | <Zachary Carter> and pass pointers to it |
21:01:36 | FromDiscord | <Zachary Carter> or you can use refs |
21:01:43 | * | mal`` quit (Read error: Connection reset by peer) |
21:01:43 | * | happycorsair[m] quit (Ping timeout: 276 seconds) |
21:01:52 | FromDiscord | <Cark> allright, so ptr and ref does it |
21:01:57 | FromDiscord | <Zachary Carter> it's pretty much the same as with the normal GC |
21:02:18 | FromDiscord | <Zachary Carter> it's just the GC isn't going to be operating only on the thread local heap |
21:02:30 | FromDiscord | <Zachary Carter> there is no GC really, it's reference counting with move semantics, which you can consider a form of GC |
21:02:54 | FromDiscord | <Zachary Carter> the shared heap is only available when you compile with `threads:on` |
21:03:04 | FromDiscord | <Zachary Carter> which is kind of a duh thing |
21:03:15 | FromDiscord | <Cark> yes that part at least i got right =) |
21:03:31 | FromDiscord | <Zachary Carter> but yes you still need to use locks |
21:03:36 | FromDiscord | <Zachary Carter> if you want to access shared memory |
21:03:42 | FromDiscord | <Zachary Carter> or atomics or whatever concurrency primitive you want to employ |
21:03:56 | FromDiscord | <Zachary Carter> or you can try to write your program in a way where you don't have any shared memory |
21:04:13 | FromDiscord | <Zachary Carter> but this often times requires some careful planning and thinking ahead of time and isn't always possible |
21:04:53 | FromDiscord | <Cark> ok then, now let's say i have an object that is a ref, and it has a field that is a non ref object. will i have some copying going on behind the scene when passing it through a channel ? |
21:05:01 | FromDiscord | <ajusa> In reply to @dom96 "I believe those are": I did check the docs, but is there any way to get as much as a socket can read before it times out using net? |
21:05:04 | FromDiscord | <Zachary Carter> well objects aren't refs you have refs to objects |
21:05:09 | FromDiscord | <Cark> right |
21:05:24 | FromDiscord | <treeform> threading is hard its best to avoid, low performance threading (locks/polling) is easier then high performance threading... |
21:05:26 | FromDiscord | <Zachary Carter> I don't use channels with ARC/ORC |
21:05:36 | FromDiscord | <Zachary Carter> so I can't really comment |
21:05:46 | FromDiscord | <Cark> ok i can live without those |
21:06:05 | FromDiscord | <Zachary Carter> if you have a non-ref object that was allocated on the stack, my guess is that yes it would be copied |
21:06:07 | FromDiscord | <Cark> performance (to me) isn't an issue if the calls a coarse |
21:06:28 | FromDiscord | <Cark> ok that makes sense |
21:06:35 | FromDiscord | <Zachary Carter> it should be easy enough to test |
21:07:00 | FromDiscord | <Cark> ah but i worry about leaving heisenbugs due to my poor understanding |
21:07:11 | FromDiscord | <Zachary Carter> start simple |
21:07:42 | FromDiscord | <Zachary Carter> just write a program that starts a thread and write a thread proc that echos something you pass into it |
21:07:49 | FromDiscord | <Zachary Carter> go from there and experiment / play around |
21:08:00 | FromDiscord | <Zachary Carter> make sure you're setting the GC to ARC/ORC, and compiling with `threads:on` |
21:08:05 | FromDiscord | <Zachary Carter> what OS are you using? |
21:08:12 | FromDiscord | <Cark> i'm stricktly on windows =) |
21:08:16 | FromDiscord | <Cark> (edit) "stricktly" => "stricctly" |
21:08:19 | FromDiscord | <Cark> (edit) "stricctly" => "strictly" |
21:08:34 | FromDiscord | <Zachary Carter> Okay nevermind then, there is some thread local storage emulation that is enabled by default for macOS which can mess things up |
21:08:43 | FromDiscord | <Zachary Carter> for Windows everything should be fine |
21:08:58 | FromDiscord | <Zachary Carter> I have a bunch of multithreaded code you can stare at if you want to |
21:09:01 | FromDiscord | <Zachary Carter> I'm not sure if it will help at all |
21:09:07 | FromDiscord | <Cark> allright you aleviated my fear about using refs cross thread, and that was my main issue |
21:09:12 | FromDiscord | <Zachary Carter> it's for a fiber based job system |
21:09:15 | FromDiscord | <Zachary Carter> also I don't really use refs |
21:09:19 | FromDiscord | <Zachary Carter> I use `ptr` |
21:09:31 | FromDiscord | <Zachary Carter> I don't really like mixing threads with Nim's GC tbh |
21:09:41 | FromDiscord | <Cark> but aren't there issues having refs inside ptrs ? |
21:09:44 | FromDiscord | <Zachary Carter> and with custom destructors, it's easy enough not to have to |
21:09:52 | FromDiscord | <Zachary Carter> I just don't use refs... |
21:10:04 | FromDiscord | <Zachary Carter> if I'm passing things around between threads anyway |
21:10:06 | FromDiscord | <Cark> allright, but then what about strings and seqs ? |
21:10:10 | FromDiscord | <Zachary Carter> cstring |
21:10:17 | FromDiscord | <Zachary Carter> unchecked array |
21:10:17 | FromDiscord | <Cark> eeek |
21:10:26 | FromDiscord | <Zachary Carter> I also interop with a lot of C code too |
21:10:39 | FromDiscord | <Zachary Carter> I write games / game tech with Nim so... |
21:10:51 | FromDiscord | <Zachary Carter> memory safety isn't really a big concern of mine |
21:10:59 | FromDiscord | <Cark> can i search your name and find your stuff on github ? |
21:11:07 | FromDiscord | <Zachary Carter> yes my name is the same as my github profile |
21:11:18 | FromDiscord | <Cark> i can live without memory safety, but i like the nim facilities =) |
21:11:45 | FromDiscord | <RattleyCooper> In reply to @ajusa "I did check the": What are you trying to do? Are you able to send a header with the length of the message first, then recv that amount of data? |
21:11:48 | FromDiscord | <Zachary Carter> I feel you - but I don't really miss Nim's GC all that much. I still use it for stuff that stays in Nim land |
21:12:31 | FromDiscord | <Zachary Carter> but so much of the time I'm crossing the Nim/C|C++ boundary that I don't end up using the GC as much as I'm sure most Nim users do |
21:12:49 | FromDiscord | <Cark> allright, so your advice is use ptr cross thread, and i guess there is nothing bad about using strings and seqs in a contained manner |
21:12:56 | FromDiscord | <Zachary Carter> you can try refs |
21:13:01 | FromDiscord | <Zachary Carter> I just don't have much experience using them across threads |
21:13:11 | FromDiscord | <Zachary Carter> the problem with using refs across threads is this |
21:13:31 | FromDiscord | <ajusa> In reply to @RattleyCooper "What are you trying": This is exactly what I'm trying to do, and no I am not able to send a header. This is for generic internet scanning, I just want to open a random tcp connection and recv as much data in 10 seconds as I can |
21:14:49 | FromDiscord | <Zachary Carter> if you pass a managed ref to an object across a thread boundary, I'm not sure how the GC is going to behave |
21:14:58 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
21:15:26 | FromDiscord | <Zachary Carter> I'm not sure if the ref counting is going to work correctly and if the object pointed to will be collected at the right time |
21:15:46 | * | flynn quit (Read error: Connection reset by peer) |
21:16:04 | FromDiscord | <Cark> from what i read, ref counting isn't atomic, but that's no issue with locks so i guess it all good |
21:16:11 | FromDiscord | <Zachary Carter> When I did this across DLL boundaries in Nim it was hugely problematic for me because each Nim DLL had its own GC |
21:16:29 | FromDiscord | <Zachary Carter> and they aren't aware of one another - so passing GC'd memory across DLL boundaries caused big issues |
21:16:35 | FromDiscord | <Zachary Carter> with threads - maybe with ARC/ORC it's been figured out |
21:16:49 | FromDiscord | <Cark> but isn't arc a program transformation rather than an actual garbage collector ? |
21:16:52 | * | flynn joined #nim |
21:17:12 | FromDiscord | <Zachary Carter> it is - when I say collected I really mean destroyed |
21:17:38 | FromDiscord | <Cark> allright, you gave me confidence to keep experimenting |
21:17:47 | FromDiscord | <Cark> thanks a bunch ! |
21:17:51 | FromDiscord | <Zachary Carter> yeah, no problem! |
21:18:07 | FromDiscord | <Cark> i'll be sure to plunder your code too =D |
21:18:10 | FromDiscord | <Zachary Carter> sorry I can't be more helpful on the ref situation, I just don't have much experience using them |
21:18:28 | FromDiscord | <Zachary Carter> yeah - feel free! if you have any specific questions about anything related to threading just lmk |
21:18:42 | FromDiscord | <Cark> i will |
21:19:35 | * | Guest38 joined #nim |
21:20:41 | FromDiscord | <RattleyCooper> In reply to @ajusa "This is exactly what": If it's TCP can't you loop and do multiple `recv`s? (since packets should be ordered, etc) |
21:21:04 | FromDiscord | <RattleyCooper> (edit) "`recv`s?" => "`recv`s with smaller packet size?" |
21:21:16 | FromDiscord | <RattleyCooper> (edit) "etc)" => "etc you should be able to put things back together)" |
21:21:24 | FromDiscord | <enthus1ast> you read from a stream, not packages |
21:22:47 | FromDiscord | <enthus1ast> so yes, you can do multiple recv in smaller chunks |
21:25:22 | * | Guest38 quit (Ping timeout: 246 seconds) |
21:25:54 | FromDiscord | <dom96> In reply to @ajusa "I did check the": that's usually an anti-pattern, what are you trying to do? |
21:26:16 | FromDiscord | <dom96> oh, I see above |
21:26:57 | FromDiscord | <enthus1ast> sure if you know the size of your entity before the read, you can read everything |
21:26:57 | FromDiscord | <dom96> I think you just want to recv 1 char at a time, the socket is buffered so you can do this efficiently |
21:27:17 | FromDiscord | <RattleyCooper> What does `<//>` do in nim? |
21:27:40 | FromDiscord | <RattleyCooper> sent a code paste, see https://play.nim-lang.org/#ix=3x3O |
21:29:45 | FromDiscord | <enthus1ast> https://github.com/nim-lang/Nim/blob/version-1-4/lib/system.nim#L873 |
21:29:58 | FromDiscord | <enthus1ast> " # This is only required to make 0.20 compile with the 0.19 line." |
21:30:22 | FromDiscord | <dom96> sounds like we should get rid of it |
21:30:45 | FromDiscord | <dom96> (honestly this should have been called `legacyV019` or something instead of the cryptic `<//>` |
21:30:48 | FromDiscord | <dom96> (edit) "`<//>`" => "`<//>`)" |
21:31:23 | FromDiscord | <RattleyCooper> Ahhh, thanks! |
21:33:24 | FromDiscord | <ajusa> In reply to @dom96 "I think you just": ah, I think I get what you mean. Keep reading a single byte with the 10 second timeout - the only (minor) issue is that this could technically last longer than 10 seconds, as if a server gives me a byte every 9 seconds the timeout will reset |
21:34:14 | FromDiscord | <RattleyCooper> In reply to @ajusa "ah, I think I": If you want a minimum amount of bytes you could timeout if the minimum bytes you require have been received, else keep receiving |
21:34:38 | FromDiscord | <dom96> @ajusa I don't think you need the timeout, are you using async? |
21:34:51 | FromDiscord | <ajusa> nope, just normal sync `net` |
21:35:09 | FromDiscord | <dom96> it would be much easier with async 🙂 |
21:35:43 | FromDiscord | <enthus1ast> then you could eg, peek on the socket |
21:35:49 | FromDiscord | <ajusa> async doesn't run everywhere IIRC - for example I heard it doesn't work on AWS lambda so I'd like to avoid it a bit. A `net` only solution should be a lot less work |
21:35:57 | FromDiscord | <enthus1ast> and to other stuff when not enough data is there |
21:36:41 | FromDiscord | <dom96> well, here is a secret: the timeouts are implemented using select() IIRC |
21:36:51 | FromDiscord | <dom96> so you're using a poor man's async already 🙂 |
21:37:09 | FromDiscord | <dom96> I don't see why async specifically wouldn't work on lambda |
21:37:59 | FromDiscord | <ajusa> No clue, I'm basing it off of this reddit post (couple of years old though, maybe something has changed): https://www.reddit.com/r/nim/comments/9kgqwl/use_nim_on_aws_lambda/ |
21:39:05 | FromDiscord | <ajusa> I think what I'll do is the following - ↵1. Read a byte in a loop with a 10 second timeout↵2. Keep track of the time elapsed outside of the loop and ensure that if it is longer than 10 seconds, I exit and return. ↵That should solve all of my problems. Thanks everyone for the help! |
21:39:14 | FromDiscord | <dom96> can't you write up a quick test and see if it works? |
21:39:25 | FromDiscord | <dom96> async doesn't use a threadpool so that person's theory is at least invalid |
21:39:50 | FromDiscord | <ajusa> In reply to @dom96 "can't you write up": Yeah, I will do that eventually ™️ |
22:00:25 | FromDiscord | <RattleyCooper> Anybody know `osproc` well enough to give me some guidance on how I might convert my taskkillable ffmpeg launcher to be pure nim? Right now I'm relying on a python dll to handle launching the process and sending the "q" to the ffmpeg process to shut it down cleanly... |
22:01:20 | FromDiscord | <RattleyCooper> Last time I attempted it I failed miserably, but maybe this time it'll be different... Figure I'd check to see if anybody had any advice before I try again. |
22:05:05 | * | byanka quit (Read error: Connection reset by peer) |
22:05:48 | * | byanka joined #nim |
22:10:31 | FromDiscord | <dom96> where did you fail? |
22:11:22 | madprops | is it possible to modify the index in an interator loop? |
22:11:26 | madprops | like var i |
22:12:42 | FromDiscord | <treeform> In reply to @RattleyCooper "Anybody know `osproc` well": I find that I can do nearly everything with osproc. You probably need to start a process and poll it. |
22:12:48 | FromDiscord | <RattleyCooper> In reply to @dom96 "where did you fail?": Communicating with the process |
22:12:50 | FromDiscord | <treeform> And send it keyboard inputs at right times. |
22:12:59 | FromDiscord | <RattleyCooper> I need to send "q" to the processes's stdin |
22:13:52 | FromDiscord | <treeform> startProcess(..) then send q to its stdin? |
22:14:24 | FromDiscord | <treeform> p.inputHandle().write("q") |
22:15:37 | FromDiscord | <treeform> if you need to "talk" it to more you can outputHandle().read in while p.running: |
22:17:37 | FromDiscord | <RattleyCooper> Oh wow, yeah. I had first tried this I was writing basically nothing but python but now that's flipped lol. I was reading through the docs and it seems a lot more obvious now. Feel kinda silly asking. I'm gonna give the `inputHandle().write("q"` a shot, looks like it's exactly what I need. Thanks for the help everyone! |
22:18:01 | FromDiscord | <RattleyCooper> (edit) "`inputHandle().write("q"`" => "`inputHandle().write("q")`" |
22:31:05 | madprops | how can I "return" to an if result here? https://play.nim-lang.org/#ix=3x42 |
22:37:04 | madprops | guess i need an intermediary variable instead of returning from an if/else |
22:38:50 | FromDiscord | <RattleyCooper> In reply to @madprops "guess i need an": Yeah, the code I've seen usually has some kind of `var res` that gets assigned to and returned at the end |
22:38:57 | FromDiscord | <RattleyCooper> (edit) "returned" => ""returned"" |
22:42:34 | madprops | is ther an `else` after loops? |
22:42:51 | madprops | I found an old discussion |
22:42:57 | madprops | but don't know if it was implemented |
22:45:32 | * | byanka quit (Read error: Connection reset by peer) |
22:45:55 | * | byanka joined #nim |
22:47:55 | FromDiscord | <RattleyCooper> In reply to @treeform "p.inputHandle().write("q")": How do I get the `File` from the `FileHandle` returned by `inputHandle`? Come to think of it, I think this is actually where I got stuck last time |
22:49:11 | * | max22- quit (Remote host closed the connection) |
22:49:36 | FromDiscord | <RattleyCooper> Should I use `inputStream`? |
22:54:13 | FromDiscord | <RattleyCooper> Very confusing |
22:54:57 | FromDiscord | <RattleyCooper> `inputHandle` docs say "Returns p's input file handle for writing to.". In `io` there doesn't appear to be any `write` method for `FileHandle`s |
22:56:13 | FromDiscord | <RattleyCooper> in `io` there is an `open` proc that takes a `var File` but can't figure out how to create that `File` |
22:56:25 | FromDiscord | <Recruit_main707> is there any symbol for `and` (like `|` for `or`) |
22:57:04 | FromDiscord | <ynfle (ynfle)> In what context? `&`? |
22:57:15 | FromDiscord | <ynfle (ynfle)> @RattlyCooper, var f\: File |
22:57:19 | FromDiscord | <RattleyCooper> (edit) "File`" => "File`(says "Creates a File from a filehandle with given mode")" | "File`(says "Creates a File from a filehandle with given mode")but ... can'tto" added "I" | "butIcan't figure out how to create that `File` ... " added "to give to the `open` proc" |
22:57:29 | FromDiscord | <Recruit_main707> `[T: int and float]` for example |
22:57:44 | FromDiscord | <ynfle (ynfle)> Does that make sense? |
22:57:50 | FromDiscord | <ynfle (ynfle)> How could it be both types? |
22:58:00 | FromDiscord | <Recruit_main707> its a generic |
22:59:02 | FromDiscord | <ynfle (ynfle)> How could `T` be both? |
22:59:03 | FromDiscord | <Ayy Lmao> a generic in that case still uses either a float or an int, not both at the same time |
22:59:47 | FromDiscord | <Ayy Lmao> `or` does what you think `and` should do I think |
22:59:54 | FromDiscord | <Recruit_main707> uhhh, forget me, my brain is shutting down |
23:00:12 | FromDiscord | <Recruit_main707> thanks xd |
23:01:21 | FromDiscord | <Ayy Lmao> don't worry, generics can be hard on the brain sometimes |
23:01:48 | FromDiscord | <Recruit_main707> actually, im not that dumb, i do want that, because im doing:↵`not SomeFloat and not string` |
23:03:16 | FromDiscord | <Ayy Lmao> I'm not sure if generics can be done with exclusive logic like that. Maybe someone who knows more about it can say. |
23:03:30 | FromDiscord | <ynfle (ynfle)> Have you tried it? |
23:04:02 | FromDiscord | <Recruit_main707> that does compile yeah |
23:04:46 | FromDiscord | <ynfle (ynfle)> Great |
23:04:58 | FromDiscord | <Recruit_main707> but i am wondering if there is a symbol to do express and, i could swear there was |
23:05:40 | FromDiscord | <ynfle (ynfle)> ? |
23:05:53 | FromDiscord | <ynfle (ynfle)> This https://play.nim-lang.org/#ix=3x4d shouldn't compile though |
23:06:07 | FromDiscord | <Rika> In reply to @madprops "how can I "return"": You can “force return” if you use result with return result |
23:06:14 | FromDiscord | <Rika> It’s kinda funky though |
23:06:22 | FromDiscord | <Ayy Lmao> In reply to @Recruit_main707 "but i am wondering": I would think that it would be `&` but I haven't tried |
23:06:31 | FromDiscord | <Rika> In reply to @madprops "is ther an `else`": No |
23:07:28 | FromDiscord | <treeform> In reply to @RattleyCooper "How do I get": this works for me: https://gist.github.com/treeform/6697b0bba77fb111a3b32fb127ecadf2 |
23:07:34 | FromDiscord | <Recruit_main707> In reply to @ynfle (ynfle) "This https://play.nim-lang.org/#ix=3x4d shouldn't c": i handle the arguments diferently depending on T |
23:07:49 | FromDiscord | <Ayy Lmao> In reply to @ynfle (ynfle) "This https://play.nim-lang.org/#ix=3x4d shouldn't c": It doesn't compile if you try to use it with anything |
23:07:53 | FromDiscord | <Recruit_main707> when T is X:↵...↵else:↵... |
23:07:56 | FromDiscord | <Rika> In reply to @RattleyCooper "How do I get": Why can’t you use the stream version |
23:08:19 | FromDiscord | <Recruit_main707> In reply to @Ayy Lmao "I would think that": thats what i thought but it isnt apparently |
23:08:49 | FromDiscord | <Rika> In reply to @Recruit_main707 "thats what i thought": Not implemented for type descriptions |
23:08:53 | FromDiscord | <Rika> Use “and” |
23:09:15 | FromDiscord | <Rika> I’m not even sure if “and” is implemented |
23:09:34 | FromDiscord | <Recruit_main707> yes it is apparently |
23:10:33 | FromDiscord | <Ayy Lmao> In reply to @Recruit_main707 "yes it is apparently": Have you looked into concepts? Maybe they suit your use case. |
23:10:34 | FromDiscord | <RattleyCooper> In reply to @Rika "Why can’t you use": I probably can (it compiles). I'm just curious if there is a way to write to `inputHandle` (docs in osproc make is sound like you can). |
23:11:36 | FromDiscord | <Ayy Lmao> (edit) "In reply to @Recruit_main707 "yes it is apparently": Have you looked into concepts? Maybe they suit your use case. ... " added "https://nim-lang.org/docs/manual_experimental.html#concepts" |
23:11:53 | FromDiscord | <ynfle (ynfle)> you open |
23:12:16 | FromDiscord | <ynfle (ynfle)> https://nim-lang.org/docs/io.html#open%2Cstring%2CFileMode%2Cint |
23:12:18 | FromDiscord | <ynfle (ynfle)> \use open |
23:13:02 | FromDiscord | <RattleyCooper> In reply to @ynfle (ynfle) "you open": Yeah, I saw that but am not sure which `File` to give as the first parameter, or how to create that `File` |
23:13:17 | FromDiscord | <ynfle (ynfle)> var f\: File |
23:13:30 | FromDiscord | <RattleyCooper> Oml, wow |
23:13:48 | FromDiscord | <RattleyCooper> I didn't even think of that. So obvious XD. Thanks |
23:14:12 | FromDiscord | <ynfle (ynfle)> \:thumbsup\: |
23:14:17 | FromDiscord | <ynfle (ynfle)> Can be confusing sometimes |
23:14:35 | FromDiscord | <RattleyCooper> Yeah, I feel like I should know that by now but it's ok. |
23:18:50 | madprops | Rika when you say `result` wouldnt' tha mean the global proc result and not the if/else ? |
23:19:24 | FromDiscord | <Rika> oh you only want to create a result for either? |
23:19:30 | FromDiscord | <Rika> then sure use a variable |
23:19:51 | FromDiscord | <Rika> wait let me read the code again |
23:20:14 | FromDiscord | <Rika> eh thats not possible |
23:20:23 | FromDiscord | <Rika> missing the values on else |
23:20:51 | FromDiscord | <Rika> provide a value on else because its needed |
23:24:19 | madprops | the problem is if there are many else values to default to |
23:24:31 | madprops | including repetitions |
23:24:37 | madprops | so yeah a variable is better |
23:25:39 | * | flynn quit (Read error: Connection reset by peer) |
23:26:45 | * | flynn joined #nim |
23:46:16 | * | auxym_ joined #nim |
23:57:27 | * | auxym_ quit (Ping timeout: 240 seconds) |
23:57:39 | FromDiscord | <rb3.nim> sent a code paste, see https://play.nim-lang.org/#ix=3x4i |
23:58:58 | FromDiscord | <rb3.nim> (edit) "https://play.nim-lang.org/#ix=3x4i" => "https://play.nim-lang.org/#ix=3x4j" |