00:01:06 | FromDiscord | <Elegantbeef> Could use strscans |
00:01:07 | FromDiscord | <Elegantbeef> `line.scanf("### a-b-c", year, month, day)` |
00:01:11 | * | krux02 quit (Remote host closed the connection) |
00:01:30 | FromDiscord | <Elegantbeef> If you want to make the code less indented you could also use a try except https://play.nim-lang.org/#ix=3YFC |
00:02:20 | FromDiscord | <commander_c> Wow nice. OK let me see if I can get what I have here to compile, that's awesome news though. |
00:02:51 | FromDiscord | <Elegantbeef> Sorry it'd be `line.scanf("### $i-$i-$i", year, month, day)` i had a brain fart |
00:03:00 | FromDiscord | <Elegantbeef> You'd also have to declare `var year, month, day = 0` |
00:03:23 | FromDiscord | <Elegantbeef> Probably better to do `line.scanF("### $+", myDateString)` then try to parse that |
00:04:17 | FromDiscord | <commander_c> Ah, it's great to have the hazy indentation issues behind me, it's compiling now. |
00:04:52 | FromDiscord | <commander_c> OK with my copious free time I will study line.scanf and the try/except. |
00:05:08 | FromDiscord | <Elegantbeef> Copious free time gang unite! 😜 |
00:05:58 | FromDiscord | <commander_c> I had started this project using procutils and parseUntil, but that was looking so wrong. I was glad to see `contains` 😅 |
00:06:32 | FromDiscord | <Elegantbeef> Hey i'm just happy you didnt use regex |
00:07:26 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "Hey i'm just happy": s-sorr.y.. |
00:07:28 | FromDiscord | <commander_c> Uh, well I did try to start this project using grep. But lucky for me I suck at grep and couldn't even get grepping for `+timesheet` to output with escapes in place |
00:07:30 | FromDiscord | <!Patitotective> (edit) "s-sorr.y.." => "s-sorry..." |
00:07:42 | FromDiscord | <commander_c> (using -E) |
00:08:13 | FromDiscord | <commander_c> Then I thought, "ok, to Pascal we go" and then I had a structure-headache and remembered Nim, so here I am 😊 |
00:10:47 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3YFF |
00:10:54 | FromDiscord | <!Patitotective> (edit) "https://play.nim-lang.org/#ix=3YFF" => "https://play.nim-lang.org/#ix=3YFG" |
00:10:56 | FromDiscord | <Elegantbeef> No it will not work on windows |
00:11:04 | FromDiscord | <Elegantbeef> Windows doesnt have a `/usr/lib` path |
00:11:07 | FromDiscord | <!Patitotective> (edit) "https://play.nim-lang.org/#ix=3YFG" => "https://play.nim-lang.org/#ix=3YFH" |
00:11:32 | FromDiscord | <!Patitotective> (edit) "https://play.nim-lang.org/#ix=3YFH" => "https://play.nim-lang.org/#ix=3YFI" |
00:11:57 | FromDiscord | <Elegantbeef> If you want to make it work for windows use a `-d:tinyFDSysPath -d:tinyFDPath` .... |
00:12:23 | FromDiscord | <Elegantbeef> https://github.com/beef331/wasmedge_playground/blob/master/src/wasmedge.nim#L33-L40 similar to how i use `wasmEdgePath` here |
00:16:04 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "https://github.com/beef331/wasmedge_playground/blob": but here you dont change the sysPath, is it because its not supposed to work on windows?↵and how would i "make" the user compile it with his sysPath? |
00:16:21 | FromDiscord | <Elegantbeef> I just told you how |
00:16:23 | FromDiscord | <Elegantbeef> Do you not listen |
00:16:45 | FromDiscord | <Elegantbeef> `-d:tinyFdSysPath:"/some/path"` |
00:16:53 | FromDiscord | <!Patitotective> :[ |
00:17:28 | FromDiscord | <!Patitotective> but do i distribute the futhark generated module? |
00:17:40 | FromDiscord | <Elegantbeef> If you want to |
00:18:16 | FromDiscord | <!Patitotective> and if i want futhark to generate it on installation how would i know what `tinyFdSysPath` is? |
00:18:19 | FromDiscord | <!Patitotective> (edit) "and if i want futhark to generate it on installation how would i know what `tinyFdSysPath` is? ... " added ":[" |
00:18:30 | FromDiscord | <Elegantbeef> Did you look at my code? |
00:19:01 | FromDiscord | <!Patitotective> yes and sysPath is not changed at all↵https://github.com/beef331/wasmedge_playground/blob/master/src/wasmedge.nim#L34 |
00:19:10 | FromDiscord | <Elegantbeef> Look at wasmpath |
00:19:15 | FromDiscord | <Elegantbeef> Look at wasmedge path |
00:19:19 | FromDiscord | <Elegantbeef> It's the same thing |
00:19:30 | FromDiscord | <michaelb.eth> is there a way to use the `is` operator in the signature of a generic proc as opposed to e.g. using it in the proc body with `when`?↵↵I thought I had seen something like that previously, but having trouble hunting for it |
00:19:48 | FromDiscord | <Elegantbeef> What do you mean? |
00:21:08 | FromDiscord | <Elegantbeef> Are you trying to constrain the generic parameters to specific types? |
00:22:15 | FromDiscord | <michaelb.eth> In reply to @Elegantbeef "Are you trying to": yes, basically |
00:22:31 | FromDiscord | <Elegantbeef> Do you have an example of what you're after? |
00:23:09 | FromDiscord | <Elegantbeef> `proc doThing[T: int](a: T)` doesnt work for you? |
00:23:26 | FromDiscord | <Andreas> How come when i read thru a channel - don't mutate anything i read - my main-thread gets in trouble ? Using SmartPtr from threading/smartptrs ? |
00:23:33 | FromDiscord | <michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=3YFL |
00:23:49 | FromDiscord | <Elegantbeef> `proc myLen[T: FooBase](obj: T)` |
00:24:26 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "Look at wasmedge path": but you use that because you do not ship wasmedge with your library↵i do, so i already have the `path`↵what i want is the installation to be automatic and find the `sysPath`, i dont want the user to define it (he could override it but by default there should be one) |
00:24:29 | FromDiscord | <Elegantbeef> You might be thinking of concepts |
00:24:30 | FromDiscord | <michaelb.eth> In reply to @Elegantbeef "`proc myLen[T: FooBase](obj: T)`": ah nice |
00:24:43 | FromDiscord | <Elegantbeef> There isnt an automatic way to find it patito |
00:24:49 | FromDiscord | <Elegantbeef> Atleast reliably |
00:25:02 | FromDiscord | <Elegantbeef> You need to have libclang installed and where it is up to the user/OS |
00:25:09 | FromDiscord | <Elegantbeef> It's not even consistent across linux |
00:25:29 | FromDiscord | <Elegantbeef> Atleast it might not be i dont recall |
00:29:37 | FromDiscord | <Elegantbeef> The way to do it is have a flag for the path and if that's set you use futhark otherwise you use the pregen'd file |
00:39:59 | FromDiscord | <!Patitotective> pregen file is nice then :] |
00:40:14 | FromDiscord | <!Patitotective> (edit) "nice" => "okay" |
00:47:53 | * | vicfred quit (Quit: Leaving) |
00:49:26 | * | wallabra_ joined #nim |
00:50:35 | * | wallabra quit (Ping timeout: 255 seconds) |
00:50:43 | * | wallabra_ is now known as wallabra |
00:51:10 | NimEventer | New thread by Ggibson: Changing mingw cross compiler path?, see https://forum.nim-lang.org/t/9175 |
01:00:03 | FromDiscord | <!Patitotective> how could i get the path of the futhark generated file? hehe↵`walkFiles` doesnt work for nimscript :[ |
01:00:23 | FromDiscord | <Elegantbeef> You manually grab it |
01:00:50 | FromDiscord | <!Patitotective> this looks sus https://github.com/PMunch/futhark/blob/master/src/futhark.nim#L498 |
01:00:54 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "You manually grab it": :[ |
01:01:06 | FromDiscord | <!Patitotective> thats not what a ~~beginner~~ programmer would say |
01:01:08 | FromDiscord | <!Patitotective> (edit) "thats not what a ~~beginner~~ programmer would say" => "do" |
01:01:14 | FromDiscord | <!Patitotective> (edit) |
01:01:28 | FromDiscord | <Elegantbeef> I mean you can grab it automatically |
01:01:39 | FromDiscord | <Elegantbeef> But just pester pmunch to add a `writeTo` 😄 |
01:02:05 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "But just pester pmunch": foss be like |
01:02:19 | FromDiscord | <Elegantbeef> I mean you can add it yourself |
01:02:28 | FromDiscord | <Elegantbeef> He said he already plans to add it |
01:04:45 | FromDiscord | <!Patitotective> @PMunch do you plan to add a `writeTo` proc to futhark? hehe :] |
01:04:50 | FromDiscord | <Andreas> @ElegantBeef when i use `-d:useMalloc` i see errors when use `threading/smartptrs` in a 100-percent safe way ? Without `useMalloc` i'm fine ? |
01:05:02 | FromDiscord | <Andreas> (edit) "@ElegantBeef when i use `-d:useMalloc` i see errors when ... use" added "i" |
01:05:11 | FromDiscord | <Elegantbeef> I do not know |
01:05:26 | FromDiscord | <Andreas> In reply to @Elegantbeef "I do not know": thats why i tell you |
01:06:20 | FromDiscord | <!Patitotective> beef dont knows panic |
01:06:57 | FromDiscord | <Elegantbeef> I've never touched smart ptrs so i dont even know what they are so yes i dont know 😄 |
01:08:21 | FromDiscord | <Elegantbeef> Where are you getting these socalled smart pointers |
01:11:40 | FromDiscord | <ripluke> How can I run shell command and store the output as a variable, and not have it show the execution of the command, or the code (1/0) it returns |
01:12:05 | FromDiscord | <Andreas> In reply to @Elegantbeef "Where are you getting": grab yourself some from threading/smartptrs - they come in three flavours Unique/Shared/Weak and Const.. from the nim-lang-repo. |
01:12:26 | FromDiscord | <Elegantbeef> ripluke https://nim-lang.org/docs/osproc.html#execProcess,string,string,openArray[string],StringTableRef,set[ProcessOption] and similar |
01:12:39 | FromDiscord | <!Patitotective> sooo beef if i want to include the module that generates the bindings in the repo should i add futhark as a dependency? 🤔 |
01:13:10 | FromDiscord | <Elegantbeef> No answer |
01:14:09 | FromDiscord | <Elegantbeef> Are you using `orc` andreas? |
01:14:23 | FromDiscord | <Andreas> In reply to @Elegantbeef "Are you using `orc`": close, ARC |
01:14:31 | FromDiscord | <Elegantbeef> Well that works too 😄 |
01:16:13 | * | arkurious quit (Quit: Leaving) |
01:16:25 | FromDiscord | <Elegantbeef> Anyway do you have a min repro i can test? |
01:16:51 | FromDiscord | <Andreas> @ElegantBeef in case i have thread that recieves some Ptr via a channel and reads the pointed value - that cannot disturb the main-thread in any way ? if the main-thread writes/mutates/invalidates smth. then the problem is on the receiving side - garbled stuff or nil.. |
01:26:21 | FromDiscord | <ripluke> Also how can I read a specific line from a file? The readline function only reads the First line |
01:27:39 | FromDiscord | <Elegantbeef> you read lines until the line number you want |
01:30:46 | FromDiscord | <ripluke> In reply to @Elegantbeef "you read lines until": So I just repeat the readline function? |
01:31:36 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YFU |
01:32:01 | FromDiscord | <Elegantbeef> for got the `inc line` |
01:32:09 | FromDiscord | <ripluke> sent a code paste, see https://play.nim-lang.org/#ix=3YFV |
01:32:12 | FromDiscord | <Elegantbeef> can also just do `for _ in 0..<lineIWant` |
01:32:17 | FromDiscord | <ripluke> In reply to @Elegantbeef "for got the `inc": Ok I’ll add it |
01:39:23 | FromDiscord | <ripluke> sent a code paste, see https://play.nim-lang.org/#ix=3YFX |
02:30:59 | FromDiscord | <!Patitotective> to use the futhark generated module should i grab the whole folder? |
02:31:14 | FromDiscord | <!Patitotective> like the includes and so |
02:31:19 | FromDiscord | <!Patitotective> beef |
02:31:39 | FromDiscord | <Elegantbeef> To use the generated module you just need the `.so` and to link it |
02:34:06 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "To use the generated": you mean the compiled binary or should there be a `.so` in the cache? |
02:34:37 | FromDiscord | <Elegantbeef> Is this a source library or dynamic library i dont recall |
02:36:13 | FromDiscord | <!Patitotective> source, i think |
02:36:22 | FromDiscord | <Elegantbeef> Then you need the C files |
02:36:49 | FromDiscord | <!Patitotective> the c files and the futhark generated `.nim` in cache or? |
02:37:02 | FromDiscord | <Elegantbeef> The tinyfd source files |
02:37:58 | FromDiscord | <!Patitotective> only the source files? |
02:38:11 | FromDiscord | <!Patitotective> (edit) "only the ... source" added "tinyfd" |
02:38:15 | FromDiscord | <Elegantbeef> You only need the generated futhark file and source files for tinyfd |
02:38:25 | FromDiscord | <Elegantbeef> Why would you need anything else |
02:45:18 | FromDiscord | <!Patitotective> where should i put the `{.compile.}` pragma? at the end of the futhark generated file ooor |
02:51:16 | FromDiscord | <Elegantbeef> Ah deleted messages i can see patito is using their brian |
02:52:10 | FromDiscord | <!Patitotective> i dont have brian |
03:00:23 | FromDiscord | <!Patitotective> b-beef... is this okay? https://github.com/Patitotective/nim_tinyfiledialogs↵;-; |
03:00:39 | FromDiscord | <!Patitotective> i mean the _project structure_ |
03:05:21 | FromDiscord | <Elegantbeef> Seems fine though you're missing a `when defined useFuthark` or similar to regen it |
03:06:50 | FromDiscord | <!Patitotective> why would you want to regen it? 🤨 |
03:06:58 | FromDiscord | <Elegantbeef> The API changes? |
03:07:23 | FromDiscord | <Elegantbeef> I guess since you have source included it doesnt matter |
03:08:45 | FromDiscord | <!Patitotective> yea well, ill try to update the source frequently :] |
03:09:26 | FromDiscord | <!Patitotective> i should put somewhere which version onf tinyfd im using |
03:09:29 | FromDiscord | <!Patitotective> (edit) "onf" => "of" |
03:09:49 | FromDiscord | <Elegantbeef> Do not make it the package version |
03:10:03 | FromDiscord | <!Patitotective> hehe |
03:10:55 | FromDiscord | <!Patitotective> woop last update 2021-12-03↵its either dead or the code is so good it doesnt need updates |
03:36:30 | * | ehmry joined #nim |
03:57:22 | FromDiscord | <!Patitotective> cmon where is position 354 https://github.com/nim-lang/packages/pull/2243/checks#step:5:9 |
03:57:50 | FromDiscord | <!Patitotective> json does not allow trailing commas? |
05:10:17 | FromDiscord | <j-james> how can i get the children of a nnkStmtList (or any list, really) for macros? |
05:13:20 | FromDiscord | <j-james> i keep getting `Error: Invalid node kind nnkProcDef for macros.` when trying to call functions defined for NimNodes |
05:14:33 | * | gsalazar quit (Remote host closed the connection) |
05:14:51 | * | gsalazar joined #nim |
05:17:11 | FromDiscord | <Elegantbeef> Can you do `.sons` on a NimNode dont recall |
05:17:24 | FromDiscord | <Elegantbeef> What are you trying to do? |
05:18:58 | FromDiscord | <j-james> implement a `pub` operator |
05:19:59 | FromDiscord | <j-james> my thought was that it would take something like a `ProcDef` and simply add `Postfix Ident ""` where needed |
05:20:07 | FromDiscord | <Elegantbeef> You can |
05:20:35 | FromDiscord | <Elegantbeef> I mean partially |
05:20:41 | FromDiscord | <Elegantbeef> Nim macros dont let you change the syntax |
05:21:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/49I |
05:23:04 | FromDiscord | <j-james> sent a code paste, see https://play.nim-lang.org/#ix=3YGM |
05:23:10 | FromDiscord | <Elegantbeef> No that doesnt compile |
05:23:17 | FromDiscord | <Elegantbeef> Parser says "No" |
05:23:50 | FromDiscord | <j-james> parser says "no" in what way? |
05:24:07 | FromDiscord | <Elegantbeef> It doesnt parse it cause it's invalid code |
05:26:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/GCo |
05:26:59 | FromDiscord | <j-james> yeah, i was hoping to get around needing to declare it in a block |
05:27:15 | FromDiscord | <Elegantbeef> You cannot since it's just not parsable |
05:27:58 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YGQ |
05:29:03 | FromDiscord | <j-james> oh, so would `pub_proc` work? |
05:29:22 | FromDiscord | <Elegantbeef> It'd |
05:29:31 | FromDiscord | <Elegantbeef> If you're wanting to turn Nim more rusty, just stop |
05:29:36 | FromDiscord | <Elegantbeef> If you're wanting to learn macros carry on |
05:30:17 | FromDiscord | <j-james> coming from the developer of traitor 😃 |
05:30:29 | FromDiscord | <j-james> this is mostly a project to learn macros |
05:30:44 | FromDiscord | <Elegantbeef> Traitor isnt to make it rusty |
05:30:58 | FromDiscord | <Elegantbeef> Traitor was to make concepts more affirmative and to use them for runtime dispatch |
05:32:33 | FromDiscord | <gordoncatlover> Dipping my toes in templates/macros, but I'm struggling to understand something fundamental about typedesc. Line 5 does not work inside the template, but fine outside. Any guidance very appreciated. 🙏 https://play.nim-lang.org/#ix=3YGP |
05:33:43 | FromDiscord | <Elegantbeef> `genericParams` returns a type either do `default(genericParams(T))` or do `var params: genericParams(T)` |
05:34:17 | FromDiscord | <Elegantbeef> Types cannot be assigned to variables |
05:36:32 | * | haliucinas joined #nim |
05:37:01 | FromDiscord | <Elegantbeef> Gordon what are you attempting to do? |
05:37:22 | FromDiscord | <Elegantbeef> Recurse down the collection and find the base type? |
05:38:01 | * | ltriant_ joined #nim |
05:39:01 | FromDiscord | <gordoncatlover> Thank you. Indeed, recurring down to the base type and output as a string `uint8[16][32]` |
05:40:23 | * | ltriant quit (Ping timeout: 255 seconds) |
05:40:25 | FromDiscord | <gordoncatlover> Not sure if my approach is even a good idea. |
05:40:43 | FromDiscord | <Elegantbeef> No macros would be smarter than recursive template calls |
05:43:35 | FromDiscord | <Elegantbeef> There you go that's better |
05:43:35 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YGU |
05:44:49 | FromDiscord | <gordoncatlover> Genius. Thank you. |
05:45:14 | FromDiscord | <Elegantbeef> No problem, always use the simplest tool |
06:45:40 | FromDiscord | <my mom said 👇> sent a code paste, see https://play.nim-lang.org/#ix=3YHi |
06:45:46 | FromDiscord | <my mom said 👇> pls don't attack me.... |
06:46:07 | FromDiscord | <Elegantbeef> Perhaps i dont know |
06:46:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/4Kp |
06:46:58 | FromDiscord | <Elegantbeef> Shit |
06:47:08 | FromDiscord | <my mom said 👇> In reply to @Elegantbeef "Shit": lel |
06:47:14 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YHk |
06:48:25 | FromDiscord | <my mom said 👇> sent a code paste, see https://paste.rs/ADh |
06:48:56 | FromDiscord | <Elegantbeef> read strscans |
06:49:22 | FromDiscord | <Elegantbeef> int, optional space, `+`, optional space, int |
06:49:52 | FromDiscord | <my mom said 👇> In reply to @uncle jim "ik this might sound": but what about this? is this an interpreter? |
06:54:14 | * | xaltsc joined #nim |
07:02:48 | * | jjido joined #nim |
07:09:29 | * | ltriant_ quit (Ping timeout: 255 seconds) |
07:33:05 | * | vicecea quit (Remote host closed the connection) |
07:33:35 | * | vicecea joined #nim |
07:47:42 | FromDiscord | <Rika> Technically? |
07:53:27 | FromDiscord | <uncle jim> In reply to @Rika "Technically?": wdym |
07:53:27 | FromDiscord | <uncle jim> ? |
07:54:00 | NimEventer | New thread by Georgeethan: Is it possible to have a nim forum rss feed publicly?, see https://forum.nim-lang.org/t/9176 |
07:59:01 | FromDiscord | <Rika> In reply to @uncle jim "wdym": It interprets some kind of language so it’s technically an interpreter but most people wouldn’t consider it one perhaps because the language it interprets is not Turing complete? |
07:59:44 | FromDiscord | <uncle jim> In reply to @Rika "It interprets some kind": bruh |
08:00:03 | FromDiscord | <uncle jim> soooo it's technically an interpreter right? |
08:00:23 | FromDiscord | <Rika> I told you already |
08:01:24 | FromDiscord | <uncle jim> In reply to @Rika "It interprets some kind": https://tenor.com/view/imitationgame-alanturing-hug-benedict-cumberbatch-gif-14553592 |
08:26:11 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
08:30:14 | FromDiscord | <jmgomez> can you define a global static of any type? i.e. Im trying to define a stringtable but cant find the right syntax (const doesnt work) |
08:36:07 | FromDiscord | <ynfle> sent a code paste, see https://play.nim-lang.org/#ix=3YI1 |
08:36:10 | FromDiscord | <ynfle> What are you trying to do? |
08:36:21 | FromDiscord | <Yardanico> In reply to @ynfle "You can't because it's": huh? you can define it as a global |
08:36:22 | FromDiscord | <PMunch> In reply to @Patitotective "<@392962235737047041> do you plan": `writeTo`? |
08:36:28 | FromDiscord | <Yardanico> there are no restrictions on global values being refs |
08:36:47 | FromDiscord | <ynfle> In reply to @Yardanico "there are no restrictions": Global compile time const? |
08:36:48 | FromDiscord | <Elegantbeef> Pmunch that's the write the futhark file to a given directory |
08:36:56 | FromDiscord | <ynfle> In reply to @ynfle "Global compile time const?": ref |
08:37:01 | FromDiscord | <Yardanico> yes |
08:37:24 | FromDiscord | <ynfle> In reply to @Yardanico "yes": How do you do it? |
08:38:25 | FromDiscord | <Yardanico> hm, guess I'm wrong and it doesn't work with const then, weird |
08:42:11 | FromDiscord | <jmgomez> In reply to @ynfle "You can't because it's": ohh ok, thanks! |
08:42:25 | FromDiscord | <jmgomez> Im just defining a type mapper |
08:42:46 | FromDiscord | <jmgomez> one other thing, can you pass two argumentes to a macro/pragma or do you have to wrap in a tuple or something? |
08:43:16 | FromDiscord | <Yardanico> In reply to @jmgomez "one other thing, can": yes, of course you can |
08:43:42 | FromDiscord | <Yardanico> just don't forget to differentiate between arguments that get passed as NimNodes (if you just specify their type), or as actual values (if you use `static`) |
08:44:56 | FromDiscord | <jmgomez> but how you specify them on the call? it seems to get confused with a comma and spec it to be another pragma, ie |
08:45:07 | FromDiscord | <Yardanico> In reply to @jmgomez "but how you specify": can you show the code? |
08:46:07 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3YIa |
08:46:13 | NimEventer | New thread by Cmc: Small improvement discussion: Use `let` to lock variable previously declared as `var`, see https://forum.nim-lang.org/t/9177 |
08:48:37 | FromDiscord | <Yardanico> @jmgomez that's not how you pass arguments to a macro |
08:48:43 | FromDiscord | <Yardanico> try using parens for multiple args |
08:48:49 | FromDiscord | <Yardanico> .typeFrom(Test, myStrTable) |
08:51:00 | FromDiscord | <jmgomez> oh I see, but now I get a missing values and types is not allowed error (due to Test and the const I guess) |
08:51:56 | FromDiscord | <jmgomez> (edit) "missing" => "mixing" |
09:40:38 | * | ltriant joined #nim |
09:59:12 | * | haliucinas left #nim (#nim) |
10:20:45 | FromDiscord | <mbrc> Did owned refs ever make it to the current implementation of nim? |
10:21:16 | FromDiscord | <mbrc> I see Araqs post and a closed RFC |
10:21:16 | FromDiscord | <Andreas> In reply to @mbrc "Did owned refs ever": yes, its there. |
10:21:59 | FromDiscord | <mbrc> Is it documented in the manual? |
10:22:56 | FromDiscord | <Andreas> In reply to @mbrc "Is it documented in": yes, https://nim-lang.org/docs/system.html#owned |
10:27:32 | FromDiscord | <Yardanico> In reply to @Andreas "yes, its there.": although it's only really has an effect with `--newruntime` which is kinda abandoned |
10:27:45 | FromDiscord | <Yardanico> or actually it works with arc too, not sure |
10:28:56 | FromDiscord | <Andreas> In reply to @Yardanico "or actually it works": i use it - can't say if it has effect - i see no errors.. |
10:29:01 | FromDiscord | <Yardanico> what do you use it for? |
10:30:29 | FromDiscord | <Andreas> In reply to @Yardanico "what do you use": a data-structure called 'Hamt' - part of closure-folk from some years ago 😉 "It only 20-percent slower compared to a naive Map" |
10:30:43 | FromDiscord | <Yardanico> well, does really anything change if you just remove all `owned` annotations? |
10:30:43 | FromDiscord | <Andreas> (edit) ""It" => ""Its" |
10:30:45 | FromDiscord | <Yardanico> and compile again |
10:31:24 | FromDiscord | <Andreas> In reply to @Yardanico "well, does really anything": no, makes no change... but i did not know about --newruntime |
10:31:34 | FromDiscord | <Yardanico> that's also abandoned in favour of arc/orc |
10:31:38 | FromDiscord | <Andreas> (edit) "naive" => "native" |
10:31:43 | FromDiscord | <Yardanico> newruntime/owned refs/etc were there before the final idea of ARC/ORC emerged |
10:31:58 | FromDiscord | <Andreas> In reply to @Yardanico "newruntime/owned refs/etc were there": ok, i use ARC |
10:33:23 | FromDiscord | <Andreas> (edit) "In reply to @Yardanico "newruntime/owned refs/etc were there": ok, i use ARC ... " added "- so theres no difference in `onwed smth` or `ref smth` ?" |
10:38:13 | FromDiscord | <Yardanico> In reply to @Andreas "ok, i use ARC": i don't think there's a difference between `owned T` and `T` |
10:38:44 | FromDiscord | <Yardanico> `owned` is made for `ref` only anyway |
10:38:53 | FromDiscord | <Yardanico> using it on non-ref types is pointless |
10:39:18 | FromDiscord | <Andreas> In reply to @Yardanico "i don't think there's": roger that - later i'll try something and replace the `owned` with a `threading/smartptr` se what that does.. |
10:39:35 | FromDiscord | <Andreas> (edit) "se" => "see" |
10:41:38 | FromDiscord | <mbrc> I dont see any docs for it in the manual |
10:41:40 | FromDiscord | <mbrc> I searched owned and nothing turned up |
10:42:01 | FromDiscord | <Yardanico> because it's more or less abandoned, at least what's what I know |
10:42:41 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/issues/12953#issuecomment-808748503 for example |
10:42:58 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/issues/12443#issuecomment-791083825 |
10:43:06 | FromDiscord | <Yardanico> newruntime/owned were really experiments |
10:45:41 | FromDiscord | <mbrc> I see |
10:45:45 | FromDiscord | <mbrc> Thanks for the information! |
11:16:25 | FromDiscord | <golova> @ElegantBeef why can't I export generic procs to nimscript? |
11:17:10 | FromDiscord | <blashyrk> In reply to @blashyrk "Hi, is there a": Bump on this as I'm really trying to wrap my head around importing stuff in nim :) |
11:18:53 | FromDiscord | <Rika> It sounded like a bug really |
11:19:56 | * | PMunch joined #nim |
11:19:59 | FromDiscord | <golova> In reply to @golova "<@145405730571288577> why can't I": nvm, im dumb |
11:34:30 | * | arkurious joined #nim |
11:43:50 | * | matt_1337 joined #nim |
11:47:35 | * | ltriant quit (Ping timeout: 255 seconds) |
13:00:06 | FromDiscord | <whisper> Is there any decent tui library capable of things like htop does? |
13:01:56 | FromDiscord | <enthus1ast> @whisper\: give illwill a try |
13:03:09 | FromDiscord | <enthus1ast> Have also build some simple Mousse enabled Widgets on top of it\: https://github.com/enthus1ast/illwillWidgets |
13:15:36 | * | vicfred joined #nim |
13:23:23 | FromDiscord | <!Patitotective> In reply to @PMunch "`writeTo`?": yes to specify the path of the module futhark generates |
13:25:06 | PMunch | Ooh, yeah I have plans for a similar thing |
13:34:14 | FromDiscord | <!Patitotective> :eyh |
13:34:19 | FromDiscord | <!Patitotective> (edit) ":eyh" => "👀" |
13:47:30 | FromDiscord | <!Patitotective> sent a code paste, see https://paste.rs/TLH |
13:47:53 | FromDiscord | <!Patitotective> (edit) "https://play.nim-lang.org/#ix=3YKa" => "https://play.nim-lang.org/#ix=3YKb" |
14:02:32 | FromDiscord | <Yardanico> openArray is not just pointers to things |
14:02:36 | FromDiscord | <Yardanico> it also has length |
14:02:48 | FromDiscord | <Yardanico> you should instead try doing `filterPatterns[0].unsafeAddr` |
14:06:11 | FromDiscord | <!Patitotective> i just found this https://github.com/juancarlospaco/nim-tinyfiledialogs↵damn, how did i not notice? |
14:07:41 | FromDiscord | <Rika> because you never checked? |
14:07:43 | FromDiscord | <Yardanico> XD |
14:09:07 | FromDiscord | <!Patitotective> buuuut my bindings have color picker, he doesnt |
14:09:51 | FromDiscord | <!Patitotective> the problem is that they have the same name, ill have to rename mine :[ |
14:10:25 | FromDiscord | <!Patitotective> (edit) "he" => "his bindings" |
14:10:30 | FromDiscord | <!Patitotective> (edit) "doesnt" => "do not" |
14:11:53 | FromDiscord | <!Patitotective> In reply to @Yardanico "you should instead try": yey it worked, thanks |
14:11:55 | FromDiscord | <!Patitotective> (edit) "In reply to @Yardanico "you should instead try": yey it worked, thanks ... " added ":]" |
14:12:10 | NimEventer | New question by ZeDragon: Using mutable varargs doesnt work as expected in Nim, see https://stackoverflow.com/questions/72406736/using-mutable-varargs-doesnt-work-as-expected-in-nim |
14:19:38 | FromDiscord | <!Patitotective> In reply to @Patitotective "the problem is that": what about _tinydialogs_? lol |
14:21:05 | FromDiscord | <Rika> tiefiedie |
14:27:36 | FromDiscord | <!Patitotective> to fix the name conflict should i open another PR? the initial PR already got merged so I can't modify it |
14:28:38 | FromDiscord | <dom96> In reply to @Patitotective "i just found this": bah, that's what I get for assuming that no other package with that name can possibly exist and merging the PR lol |
14:28:54 | FromDiscord | <dom96> yeah, please open another PR |
14:28:56 | FromDiscord | <!Patitotective> yea sorry, i ddint check |
14:29:01 | FromDiscord | <!Patitotective> (edit) "ddint" => "didnt" |
14:29:10 | FromDiscord | <dom96> the CI would have told us :) |
14:29:19 | FromDiscord | <dom96> if I waited for it patiently, oops |
14:36:29 | FromDiscord | <Yardanico> @dom96 but it's not in nimble |
14:36:31 | FromDiscord | <Yardanico> juan's package |
14:36:37 | FromDiscord | <Yardanico> oh it is actually, nvm |
14:36:50 | FromDiscord | <Yardanico> but yeah, @!Patitotective IMO you can just take over juan's package really |
14:37:01 | FromDiscord | <Yardanico> as he didn't update it and it only has barebones wrapper without nim APIs on top |
14:37:16 | FromDiscord | <!Patitotective> :] |
14:39:42 | FromDiscord | <!Patitotective> lol https://media.discordapp.net/attachments/371759389889003532/979755782281252964/unknown.png https://media.discordapp.net/attachments/371759389889003532/979755782537093120/unknown.png |
14:45:14 | FromDiscord | <Yardanico> In reply to @Patitotective "lol": huh, i don't think so |
14:45:20 | FromDiscord | <Yardanico> there are multiple packages with spaces in tags |
14:48:31 | FromDiscord | <dom96> yeah, because nobody cared to correct them :) |
14:48:48 | FromDiscord | <Yardanico> but why is it wrong? |
14:49:01 | FromDiscord | <Yardanico> nimble directory seems happy about them, and it makes the search better i think |
14:49:54 | FromDiscord | <dom96> meh, I guess it doesn't matter too much |
14:49:57 | FromDiscord | <dom96> the tags are a mess anyway |
14:50:06 | FromDiscord | <dom96> they've become keywords |
14:51:38 | FromDiscord | <Rika> what are they supposed to be |
14:51:40 | FromDiscord | <Rika> if not keywords |
14:52:02 | FromDiscord | <dom96> The idea I had behind them was that you'd be able to browse packages with a specific tag. Like get a list of all libraries with the "library" tag |
14:52:12 | FromDiscord | <dom96> or a list of all binary packages with the "binary" tag |
14:52:53 | FromDiscord | <dom96> that's typically what tags represent |
14:54:02 | FromDiscord | <!Patitotective> in that case users shouldnt be able to create tags |
14:54:17 | FromDiscord | <dom96> also if we do treat them as "keywords" then adding "file dialogs" for a package called "tinyfiledialogs" is redundant :) |
14:54:41 | FromDiscord | <!Patitotective> In reply to @dom96 "also if we do": now called tinydialogs lol |
14:55:04 | FromDiscord | <!Patitotective> In reply to @Patitotective "in that case users": just to select them or you can add them manually when PRs |
15:13:52 | NimEventer | New Nimble package! tinydialogs - Tiny file dialogs Nim bindings., see https://github.com/Patitotective/tinydialogs |
15:14:43 | FromDiscord | <huantian> Wow new patito package |
15:17:30 | FromDiscord | <!Patitotective> In reply to @huantian "Wow new patito package": :] |
15:30:51 | FromDiscord | <untoreh> If I mark a proc with `{.async.}` but the call blocks what can be the cause? |
15:32:32 | FromDiscord | <Yardanico> CPU intensive functions, `sleep`, etc |
15:32:36 | FromDiscord | <Yardanico> Can you show the code of the proc? |
15:33:09 | FromDiscord | <Yardanico> And if you're doing `await call()`, it's expected to block the current async procedure until call completes |
15:39:02 | FromDiscord | <Phil> Is there a way for troubleshooting purposes for me to print out all symbols available in a given module (including from the imports)? |
15:43:51 | * | ltriant joined #nim |
15:47:06 | FromDiscord | <!Patitotective> yard do you plan to add "windows support"? maybe you can distribute the libvlc and the futhark generated module all together https://github.com/Yardanico/nim-libvlc |
15:48:28 | * | ltriant quit (Ping timeout: 258 seconds) |
17:01:54 | FromDiscord | <!Patitotective> why are there no working audio libraries? :[ |
17:03:53 | FromDiscord | <exelotl> you can use SDL or Raylib for audio right? |
17:10:46 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=3YL7 |
17:11:02 | FromDiscord | <exelotl> and it actually worked (first time I've ever done something with views that worked lol) |
17:11:12 | FromDiscord | <exelotl> but then I checked the manual: https://nim-lang.org/docs/manual_experimental.html#view-types |
17:11:38 | FromDiscord | <exelotl> and apparently `var T` as a view isn't a thing anymore? You're supposed to use `lent T` |
17:12:36 | FromDiscord | <exelotl> but if I change it to `var buf: lent M4Mem = ...` it fails on `buf.clear()` because the compiler claims that `buf` is immutable |
17:12:49 | FromDiscord | <Generic> https://github.com/nim-lang/Nim/issues/18683 |
17:12:54 | FromDiscord | <Generic> see the conversation |
17:14:57 | FromDiscord | <Rika> "let xx: var T" looks so cursed ngl |
17:15:05 | FromDiscord | <Rika> "SO IS IT IMMUTABLE OR MUTABLE" |
17:15:15 | FromDiscord | <exelotl> haha |
17:15:40 | FromDiscord | <exelotl> right, so I guess there's just a gap between the current implementation and the planned implementation |
17:17:07 | FromDiscord | <Generic> yeah and the spec you refered to is incomplete, because as said in the linked issue, `var T` is a view type |
17:17:18 | FromDiscord | <Phil> Wait, that is actually legal syntax? |
17:17:36 | FromDiscord | <Generic> with view types it should be |
17:18:01 | FromDiscord | <Generic> In reply to @Rika ""let xx: var T"": I mean it's basically just `T& const` |
17:21:09 | FromDiscord | <exelotl> In reply to @Generic "yeah and the spec": iirc `var T` used to be in the spec, but then araq figured it's not the job of view types to describe mutability (so instead `var x: lent T` is a mutable view, `let x: lent T` is an immutable view) |
17:21:51 | FromDiscord | <exelotl> but I haven't been keeping up with this stuff so I'm not sure what the current status is 😅 |
17:25:09 | * | jjido joined #nim |
17:30:08 | FromDiscord | <!Patitotective> In reply to @exelotl "you can use SDL": ill try to _implement_ pythons playsound↵https://github.com/TaylorSMarks/playsound/blob/master/playsound.py |
17:31:36 | FromDiscord | <Generic> In reply to @exelotl "iirc `var T` used": hm ok that makes sense too, though wouldn't it kindof break with the existing syntax for parameters? |
17:37:35 | FromDiscord | <exelotl> Ah here's where I read it: https://discord.com/channels/371759389889003530/768367394547957761/892413727486410772↵It's mainly referring to variables and object fields, I guess an exception would have to be made for var params and var return values to keep their current syntax as opposed to something ugly like `x: var lent T` |
17:42:49 | FromDiscord | <Rika> ~~vent~~ |
17:52:56 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
18:05:40 | FromDiscord | <axilirate> getting this error on macos running nimble `ould not load: libcrypto(.1.1|.38|.39|.41|.43|.44|.45|.46|.47|.48|.10|.1.0.2|.1.0.1|.1.0.0|.0.9.9|.0.9.8|).dylib↵` |
18:05:52 | FromDiscord | <axilirate> (edit) "`ould" => "`could" |
18:06:05 | FromDiscord | <axilirate> dependencies are installed |
18:31:14 | FromDiscord | <axilirate> nvm works now |
18:40:35 | * | def- quit (Quit: -) |
18:55:34 | * | xet7 quit (Remote host closed the connection) |
18:57:19 | * | def- joined #nim |
19:04:17 | FromDiscord | <eyecon> Hello, it's EyeCon and we have a new episode of "How to Crash the Nim Compiler with the Least Effort" tonight |
19:04:44 | FromDiscord | <eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3YLB |
19:05:01 | FromDiscord | <eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3YLC |
19:05:22 | FromDiscord | <eyecon> I mean, I would get if that crashed |
19:05:28 | FromDiscord | <Yardanico> it should be `var` or `let` I think (`testBytes`) |
19:05:29 | FromDiscord | <eyecon> Because of the length not matching etc. |
19:05:37 | FromDiscord | <eyecon> But not compiling? |
19:05:43 | FromDiscord | <Yardanico> also, if you use arc you need to call `prepareMutation` on `tempStr` before using `copyMem` |
19:06:49 | FromDiscord | <eyecon> In reply to @Yardanico "also, if you use": Yes, but I thought the only downside would be the string not updating in some cases, I thought |
19:07:00 | FromDiscord | <eyecon> In any case, the problem is the `const`, it appears |
19:07:04 | FromDiscord | <Yardanico> In reply to @Yardanico "it should be `var`": yes ^ |
19:07:20 | FromDiscord | <eyecon> Yes, `let`ting it works, ty |
19:07:30 | FromDiscord | <eyecon> But is this compiler error expected? Idk |
19:07:43 | FromDiscord | <Yardanico> it's not supposed to be a C compiler error, you can create an issue of course |
19:08:00 | FromDiscord | <Yardanico> also, as I said if you use arc/orc you must really call `prepareMutation` on `tempStr` before doing stuff like `copyMem` |
19:08:22 | FromDiscord | <eyecon> In reply to @Yardanico "also, as I said": Understood |
19:08:35 | FromDiscord | <Yardanico> otherwise you'll have fun getting random crashes with SIGBUS/SIGSEGV/etc |
19:09:03 | FromDiscord | <Yardanico> because with ARC/ORC strings are CoW so Nim doesn't know that you want to write to a string if you use things like `copyMem` (it inserts `prepareMutation` calls automatically in normal cases where you e.g. just add something to a string) |
19:09:25 | FromDiscord | <Yardanico> also yeah, it also won't work because you have to preallocate the string of the specified length before copyMem :) |
19:09:32 | FromDiscord | <Yardanico> `var tempStr = newString(testBytes.len)` |
19:11:37 | FromDiscord | <eyecon> In reply to @Yardanico "also yeah, it also": That I'm doing in the real case, I'm just overwriting a part |
19:11:45 | FromDiscord | <eyecon> That went south when simplifying |
19:11:59 | FromDiscord | <eyecon> Didn't really expect it not to compile |
19:12:26 | FromDiscord | <Yardanico> well, nim `const`s are inlined in a lot of cases |
19:12:39 | FromDiscord | <Yardanico> in this case it inlined `testBytes[0]` |
19:13:00 | FromDiscord | <Yardanico> but as I said, you can open an issue on github (if there isn't one already), it should properly throw a compiler error |
19:13:39 | FromDiscord | <martinium> Does anyone know a simple way to avoid the too many open files OSError when keeping a file open and writing to it asynchronously? |
19:14:25 | FromDiscord | <Yardanico> In reply to @martinium "Does anyone know a": I don't think it should error with that at all if you only have 1 file open, do you happen to use stuff like httpclient in your program? |
19:15:16 | FromDiscord | <Yardanico> just asking because you need to call `close` on an httpclient instance (both sync and async) after using them, and nim doesn't warn you if you don't so your program silently leaks FDs and stuff |
19:16:13 | * | def- quit (Quit: -) |
19:16:53 | FromDiscord | <eyecon> In reply to @Yardanico "but as I said,": https://github.com/nim-lang/Nim/issues/19840 |
19:18:02 | FromDiscord | <martinium> In reply to @Yardanico "I don't think it": Yeah, I am using the asynchttpclient but in the function that calls the client I do not call close thinking it would just reuse the existing connection. |
19:18:04 | FromDiscord | <martinium> let me test |
19:18:20 | FromDiscord | <Yardanico> every time you do `let stuff = newAsyncHttpClient()` it creates a new client |
19:18:47 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3YLE |
19:19:50 | FromDiscord | <Elegantbeef> Generic procs need to have been instantiated in native code, so generic procedures themselves cannot but instantiations should be able to be↵(@golova) |
19:20:23 | * | def- joined #nim |
19:22:02 | FromDiscord | <martinium> In reply to @Yardanico "if you have a": just added client.close to request proc and hit maximum fd error reached |
19:22:23 | FromDiscord | <Yardanico> do you maybe do too many requests in a second? like thousands of them |
19:22:30 | FromDiscord | <martinium> I do have request function running in a for loop so does that not close them out even with client.close |
19:22:56 | FromDiscord | <martinium> I am playing around with the pokemon api 🙂 |
19:23:15 | FromDiscord | <Yardanico> can you share the code or at least part of it? that would be easier to check |
19:23:20 | FromDiscord | <martinium> sent a code paste, see https://play.nim-lang.org/#ix=3YLF |
19:23:38 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3YLG |
19:23:39 | FromDiscord | <Yardanico> when compiling you even get a warning about unreachable code |
19:23:41 | FromDiscord | <Yardanico> (edit) "https://play.nim-lang.org/#ix=3YLG" => "https://paste.rs/6PI" |
19:24:02 | FromDiscord | <martinium> relevant part of for loop: |
19:24:10 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3YLH |
19:24:11 | FromDiscord | <martinium> sent a code paste, see https://paste.rs/rAi |
19:24:16 | FromDiscord | <Yardanico> so yeah, as I said, you're not closing the client in your original code since you return before closing |
19:24:39 | FromDiscord | <martinium> ah |
19:24:56 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3YLI |
19:24:58 | FromDiscord | <martinium> man, its so obvious too not htat you mention it lmao |
19:24:59 | FromDiscord | <Yardanico> since url is always string, and getContent always returns a string, it can just be this |
19:25:08 | FromDiscord | <martinium> (edit) "not htat" => "now that" |
19:25:47 | FromDiscord | <martinium> I just made it generic in case I decide to reuse the function for other endpoints which may have different data types |
19:25:57 | * | def- quit (Quit: -) |
19:26:24 | FromDiscord | <commander_c> Anyone know if it's possible to open, write to, and save LibreOffice Writer ODT files in Nim? |
19:26:50 | * | def- joined #nim |
19:27:02 | FromDiscord | <Yardanico> In reply to @commander_c "Anyone know if it's": there is a pure nim xls(x) writer/reader, but no clue about ODT, let me try to find something |
19:27:10 | FromDiscord | <Yardanico> in worst case you can find an existing C/C++ lib that does this and use it |
19:28:05 | FromDiscord | <commander_c> Ah cool. I'd try that for sure. |
19:28:18 | FromDiscord | <Yardanico> yeah, doesn't look like there's an ODT reader from my brief search |
19:28:20 | FromDiscord | <commander_c> Trying to decide between writing HTML and then converting to PDF, or writing LO Writer format somehow. |
19:28:35 | FromDiscord | <Yardanico> there must be C/C++ libs that do this for sure |
19:28:39 | FromDiscord | <Forest> Anyone able to help me use futhark so i can use `physac` in Nim? |
19:28:52 | FromDiscord | <enthus1ast> Depending on the usecase xlsx etc is a zipped folder containing xml files↵(@Yardanico) |
19:28:58 | FromDiscord | <Yardanico> i know |
19:29:42 | FromDiscord | <Forest> I'm generally just quite confused on how to go about this, since i already have Raylib installed via Naylib so don't wanna have two copies of the library lol |
19:30:01 | FromDiscord | <Yardanico> In reply to @Forest "I'm generally just quite": huh? |
19:30:10 | FromDiscord | <Yardanico> did you mean to write in #gamedev maybe? |
19:30:55 | FromDiscord | <enthus1ast> Sure you wanna use physac?↵(@Forest) |
19:31:10 | FromDiscord | <Forest> In reply to @enthus1ast "Sure you wanna use": Yeah |
19:31:18 | FromDiscord | <commander_c> @Yardanico I'll try wkhtmltopdf. |
19:31:19 | FromDiscord | <martinium> Yardanico, thanks for your help dude. Always helpful 🙂 |
19:31:26 | FromDiscord | <Forest> In reply to @Yardanico "huh?": I figured this would be better to be asked here since I'm asking for help with Futhark |
19:31:30 | FromDiscord | <enthus1ast> It's super limited, you cannot even get collision callbacks |
19:31:42 | FromDiscord | <enthus1ast> Better use chipmunks |
19:31:45 | FromDiscord | <Forest> No idea what that means lol |
19:32:01 | FromDiscord | <Forest> Chipmunk is complicated rip- Idk how to intergrate it with Naylib at all |
19:32:02 | FromDiscord | <enthus1ast> You cannot react on a collision |
19:32:11 | FromDiscord | <Forest> Aah |
19:33:23 | FromDiscord | <enthus1ast> Actually I found chipmunk quite straightforward from nim |
19:33:58 | FromDiscord | <Forest> Huh |
19:34:17 | FromDiscord | <Forest> Could you give me a bit of advice of just how to generally... Understand it? :P |
19:34:57 | FromDiscord | <enthus1ast> Create a world, create bodies in it, set the position of your Sprite to the one of the body |
19:35:09 | FromDiscord | <enthus1ast> In your draw |
19:35:18 | FromDiscord | <Forest> Aah okay |
19:35:23 | FromDiscord | <Forest> Now gotta figure that out lmao |
19:35:26 | FromDiscord | <Forest> Doc reading time |
19:35:52 | FromDiscord | <enthus1ast> I have some older example code (but useing raylib forever) |
19:35:56 | * | jmdaemon joined #nim |
19:37:00 | FromDiscord | <enthus1ast> Can check later if you like, but it mainly boils down to what I written above |
19:43:10 | FromDiscord | <Forest> In reply to @enthus1ast "I have some older": Oh? That'd be useful aha |
19:43:17 | FromDiscord | <Forest> In reply to @enthus1ast "Can check later if": Fair, thanks for the advice! |
19:48:50 | FromDiscord | <enthus1ast> Mh yeah I'm looking through the old project, not sure if this is a good example because the physic code is quite splattered all over |
19:49:21 | FromDiscord | <enthus1ast> But this is it\: https://github.com/enthus1ast/EoC |
19:49:49 | FromDiscord | <retkid> how can I do math operations with the full 64 bit float |
19:50:01 | FromDiscord | <retkid> i.e 2.0+ 2.0 == 2.0000000000[nonsense] |
19:50:37 | FromDiscord | <enthus1ast> This is a client server multiplayer demo, so the client and the server does some physic |
20:03:36 | FromDiscord | <Forest> In reply to @enthus1ast "Mh yeah I'm looking": Lol understandable, but thanks! |
20:05:21 | FromDiscord | <Forest> sent a code paste, see https://play.nim-lang.org/#ix=3YLU |
20:05:41 | FromDiscord | <Forest> Also would this just let me do `Vect$` to convert the type? Or can i do `$Vect` too? |
20:08:21 | FromDiscord | <justanotherinternetguy> is there any reason why nim is case and underscore insensitive? |
20:09:00 | FromDiscord | <Elegantbeef> It's style insensitive not case insensitive |
20:09:05 | FromDiscord | <golova> In reply to @justanotherinternetguy "is there any reason": Design choice |
20:09:22 | FromDiscord | <Elegantbeef> It's to allow ergonomic usage between libraries without forcing a specific convention on you |
20:09:29 | FromDiscord | <justanotherinternetguy> oh i see |
20:09:30 | FromDiscord | <justanotherinternetguy> ty |
20:09:44 | FromDiscord | <justanotherinternetguy> i was just very confused, coming from languages that are very picky about cases |
20:09:47 | FromDiscord | <Elegantbeef> snake vs camel case is not a debate since you can call both without issue in the other |
20:09:52 | FromDiscord | <justanotherinternetguy> i see i see |
20:09:58 | FromDiscord | <justanotherinternetguy> that makes life much easier |
20:10:19 | FromDiscord | <Elegantbeef> I personally like it very much as it applies everywhere including machine wrapped C libraries so you dont need to shout their constnats |
20:10:38 | FromDiscord | <Elegantbeef> `glEnable(GL_DEPTH_TEST)` is god awful i prefer my `glEnable(GlDepthTest)` 😛 |
20:11:34 | FromDiscord | <Andreas> `glEnable GlDepthTest` i'd prefer |
20:12:18 | FromDiscord | <Elegantbeef> Heh never thought about the command syntax for it since reading mostly C/C++ code 😄 |
20:12:38 | FromDiscord | <Andreas> (edit) "prefer" => "prefer, or maybe `gl_Enable Gl_Depth_Test` not sure" |
20:17:17 | FromDiscord | <dom96> https://github.com/nim-lang/RFCs/issues/456 👀 |
20:20:58 | FromDiscord | <!Patitotective> https://github.com/nim-lang/RFCs/issues/456#issuecomment-1114034014 ⬆️ |
20:25:10 | NimEventer | New post on r/nim by hc0re: Moving compilation parameters like -d:ssl into the *.nimble project file?, see https://reddit.com/r/nim/comments/uz6z2c/moving_compilation_parameters_like_dssl_into_the/ |
20:25:17 | FromDiscord | <dom96> ⬆️ indeed. But treat it as an error not a warning :D |
20:29:49 | FromDiscord | <enthus1ast> You could also create a `converter`↵(@Forest) |
20:30:27 | FromDiscord | <Elegantbeef> Converter + concept |
20:30:36 | FromDiscord | <enthus1ast> Yes |
20:31:20 | FromDiscord | <Forest> In reply to @enthus1ast "You could also create": What's that? I think i heard of it before but forgot lol |
20:31:56 | FromDiscord | <Rika> implicit conversion for types |
20:32:14 | FromDiscord | <enthus1ast> And/or I would create a vector etc that you use internally and only store these in your own objects |
20:32:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YM2 |
20:32:25 | FromDiscord | <Elegantbeef> WED |
20:32:27 | FromDiscord | <Elegantbeef> QED even |
20:32:40 | FromDiscord | <enthus1ast> Then convert to the various other vectors |
20:32:52 | FromDiscord | <Rika> WED |
20:33:04 | FromDiscord | <Elegantbeef> Dont say that too much rika someone might get married |
20:33:26 | FromDiscord | <Forest> In reply to @enthus1ast "And/or I would create": I was thinking of that too aha |
20:34:23 | FromDiscord | <enthus1ast> There also is some gls like vector manipulation library for nim but forgot the name |
20:34:25 | FromDiscord | <Forest> sent a code paste, see https://play.nim-lang.org/#ix=3YM4 |
20:34:55 | FromDiscord | <Forest> eh tbf i don't think i'll be converting between the types much, so should be fine? |
20:35:10 | FromDiscord | <Forest> Oh wait i might actually |
20:35:15 | FromDiscord | <Forest> rip |
20:35:26 | FromDiscord | <Elegantbeef> The concept checks if the type has a `x` and `y` field |
20:35:46 | FromDiscord | <Elegantbeef> That converter will implicitly kick in if the type needs to be converted to `Vector2` for a call |
20:38:39 | FromDiscord | <Forest> Is `Vec2` a built-in Nim type? |
20:38:45 | FromDiscord | <Elegantbeef> No |
20:38:51 | FromDiscord | <Forest> ah okay then |
20:39:10 | FromDiscord | <Elegantbeef> It's a user defined concept which allows for behaviour like this |
20:39:36 | FromDiscord | <enthus1ast> This one\: https://github.com/stavenko/nim-glm |
20:39:37 | FromDiscord | <Forest> Ah okay |
20:39:46 | FromDiscord | <Forest> In reply to @enthus1ast "This one\: https://github.com/stavenko/nim-glm": ah neat |
20:40:01 | FromDiscord | <Forest> eh i shouldn't need it but if i do it shouldn't be too hard to add later |
20:41:53 | FromDiscord | <Forest> `converter chipToRay(v:Vect):Vector2 = Vector2(x:v.x, y:v.y)` this line should just work then? |
20:43:41 | FromDiscord | <Elegantbeef> Assuming you have the concept i have sure |
20:44:08 | FromDiscord | <Forest> I don't understand the concept thing :p |
20:44:19 | FromDiscord | <Forest> Since i'm converting between the existing types |
20:44:36 | FromDiscord | <Elegantbeef> It goes "hey does this type have a `.x` that is a float32 and does it have a `.y` that is a float32?" if so you can use the converter |
20:44:50 | FromDiscord | <Forest> Ah okay |
20:45:01 | FromDiscord | <Elegantbeef> Dont say ah okay then in 2 minutes go "i dont understand" |
20:45:04 | FromDiscord | <Forest> Might just be better off making my own type for this tbh |
20:45:04 | FromDiscord | <Elegantbeef> You did it once already 😄 |
20:45:22 | FromDiscord | <Forest> Yeah ik, i'm just kinda lost and tinkering with it a bit |
20:49:01 | FromDiscord | <Forest> sent a code paste, see https://play.nim-lang.org/#ix=3YMb |
20:49:25 | FromDiscord | <Forest> Is there no difference between object and concept? |
20:49:31 | FromDiscord | <Elegantbeef> Yes there is |
20:49:38 | FromDiscord | <Forest> Since this worked perfectly |
20:49:47 | FromDiscord | <Forest> In reply to @Elegantbeef "Yes there is": What's the diff? |
20:49:57 | FromDiscord | <Elegantbeef> Concepts are not concrete types |
20:49:57 | FromDiscord | <Elegantbeef> They're constraints |
20:50:26 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YMc |
20:50:37 | FromDiscord | <Elegantbeef> Which if you looked at the following types it worked on even types with `a, b, c: int, x, y: float` |
20:51:28 | FromDiscord | <Forest> Ooh okay that makes more sense now |
20:51:42 | FromDiscord | <Forest> In reply to @Elegantbeef "Which if you looked": So it'd ignore a b and c> |
20:51:44 | FromDiscord | <Forest> ? |
20:52:01 | FromDiscord | <Forest> yeah that's not what i want then, it should ideally just fail on those conversions |
20:52:09 | FromDiscord | <Elegantbeef> It doesnt ignore it, it creates a generic procedure that accepts `MyType` and you only access the `.x` `.y` |
20:52:10 | FromDiscord | <Forest> since Vector 3 and 4 |
20:52:19 | FromDiscord | <Forest> In reply to @Elegantbeef "It doesnt ignore it,": ah okay |
20:52:22 | FromDiscord | <Elegantbeef> I'd argue your converters should work on any vector |
20:52:32 | FromDiscord | <Forest> Yeah fair |
20:52:41 | FromDiscord | <Forest> Will do that now, thanks for the help! |
20:53:02 | FromDiscord | <Elegantbeef> The benefit is that it'd work with any vector even ones that arent written yet |
20:53:09 | FromDiscord | <Elegantbeef> It's the ultimate code reuse imo |
20:54:22 | FromDiscord | <Forest> This works :D |
20:54:25 | FromDiscord | <Forest> sent a code paste, see https://play.nim-lang.org/#ix=3YMf |
20:54:31 | FromDiscord | <Elegantbeef> Of course it does |
20:54:33 | FromDiscord | <Rika> wow |
20:54:47 | FromDiscord | <Elegantbeef> `wow((x: 100, y: 300))` also works |
20:55:18 | FromDiscord | <Forest> In reply to @Rika "wow": Coming from Python and Java it looks like magic, no explicit conversion needed- |
20:55:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YMg |
20:55:45 | FromDiscord | <Forest> huh neat |
20:56:03 | FromDiscord | <Elegantbeef> This is the benefit of the concept it gives you a structural match instead of a named match |
20:56:05 | FromDiscord | <Forest> How does Nim do so much cool stuff |
20:56:19 | FromDiscord | <Forest> And why isn't it more talked about |
20:59:02 | FromDiscord | <Phil> ~~Because I'm too busy using said cool stuff~~ |
20:59:43 | FromDiscord | <Forest> lmao |
20:59:58 | FromDiscord | <Phil> And also too busy in screwing myself over by not understanding how nim decides which proc to apply multiple with the same signature are floating around in the same context |
21:00:22 | FromDiscord | <Phil> Fixed it now but man that was a bug hunt |
21:02:16 | FromDiscord | <Forest> fair, bugs are annoying and the bane of my existence |
21:14:46 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3YMn |
21:15:00 | FromDiscord | <!Patitotective> (edit) "https://play.nim-lang.org/#ix=3YMn" => "https://play.nim-lang.org/#ix=3YMo" |
21:16:08 | FromDiscord | <Elegantbeef> only the pointer of a `ref` is immutable the data is not |
21:16:23 | FromDiscord | <Elegantbeef> `result = node` does not copy it points to the same datas |
21:16:26 | FromDiscord | <Elegantbeef> data\ |
21:16:49 | FromDiscord | <Elegantbeef> you need to copy the `node` in the `added` proc |
21:17:56 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "you need to copy": how |
21:18:55 | FromDiscord | <Elegantbeef> `deepcopy` is one way |
21:19:20 | FromDiscord | <Elegantbeef> Alternatively dont use a reference |
21:20:17 | FromDiscord | <!Patitotective> i used a reference because JsonNode did lol |
21:20:52 | FromDiscord | <Elegantbeef> You dont need a reference for the root node it just makes it a bit faster if you're dynamically joining these |
21:26:32 | FromDiscord | <Phil> The entire ref-type/value-type thing gave me such a better understanding between the two. I still don't have a good feeling when the obvious usecase starts for using ref-types, but at least I understand the difference in their behaviour much better now. |
21:27:03 | FromDiscord | <Elegantbeef> You only really use ref when you need OOP or pointer lik objects |
21:27:30 | FromDiscord | <Phil> Yeah but when do you need OOP? |
21:27:52 | FromDiscord | <Elegantbeef> When you need user extensible types that seamlessly work with your own |
21:28:07 | FromDiscord | <Elegantbeef> Personally the only time i've used OOP in my own projects is this GUI |
21:29:08 | FromDiscord | <Elegantbeef> Speaking of i fixed my layout for most things and.... broke it for something |
21:29:12 | FromDiscord | <Elegantbeef> Fuck yea layout logic is fun! |
21:30:38 | FromDiscord | <!Patitotective> this looks like an #appdev topic |
21:30:53 | FromDiscord | <Elegantbeef> Why appdev |
21:30:56 | FromDiscord | <Elegantbeef> It's gamedev |
21:31:21 | FromDiscord | <Phil> I'd argue general dev with an example of its application in gamedev |
21:31:33 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "Why appdev": its GUI |
21:31:39 | FromDiscord | <Elegantbeef> It's game gui |
21:31:47 | FromDiscord | <Elegantbeef> It's not anything like any GUI frameworks |
21:32:10 | FromDiscord | <Phil> I'd regard appdev is basically "What I would do in angular, but for native" |
21:32:13 | FromDiscord | <Rika> Why are you arguing about a transient topic |
21:32:15 | FromDiscord | <Phil> I would not build a game in angular |
21:32:19 | FromDiscord | <Elegantbeef> If some numpty wants to use my GUI for app development they're fucking dumb |
21:32:36 | FromDiscord | <Elegantbeef> Rika dont ask me we have gamedev not appdev, and who's going to tell me what to do! |
21:32:53 | FromDiscord | <Phil> In reply to @Elegantbeef "Rika dont ask me": You yourself |
21:33:10 | FromDiscord | <Rika> You tell yourself to do things? I just do things |
21:34:06 | FromDiscord | <Phil> There are days where it's rainy out and I'm really not feeling the desire to go for sports but do it anyway because I know after the initial 5 minutes of not wanting to I'll be alright with it |
21:34:33 | FromDiscord | <Phil> So yeah, sometimes tell yourself to do things 😛 |
21:34:47 | FromDiscord | <Rika> You don’t tell yourself to do that, you’re deciding to do it nonetheless |
21:35:03 | FromDiscord | <!Patitotective> we should rename this channel to _philosophy_ |
21:54:59 | FromDiscord | <michaelb.eth> is there a cross-platofrm, inexpensive way to check whether a filesystem directory is empty? |
21:56:49 | * | PMunch quit (Quit: leaving) |
21:56:56 | FromDiscord | <Generic> no idea how expensive this is, but you can try using walkDir from os |
21:57:04 | FromDiscord | <Yardanico> maybe https://nim-lang.github.io/Nim/os.html#getFileInfo%2Cstring ? |
21:57:49 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3YMz |
22:11:16 | FromDiscord | <Rika> doesnt look cursed to me, what would be cursed here? |
22:11:24 | FromDiscord | <Rika> oh maybe the else discard is cursed |
22:11:51 | FromDiscord | <Rika> ah, also mix of result and implicit return |
22:12:02 | FromDiscord | <Rika> though it doesnt matter because its within a when else |
22:12:07 | FromDiscord | <Rika> but still, not good |
22:13:16 | FromDiscord | <Rika> hmm, okay its kinda starting to make sense why youd ask if this is cursed |
22:13:40 | FromDiscord | <Rika> why is the body of the case when pseq and val isnot string duplicated |
22:15:14 | FromDiscord | <huantian> I'd probably get rid of the `result =` and just use `default(result)` |
22:15:22 | FromDiscord | <huantian> if that works lol |
22:16:22 | FromDiscord | <Yardanico> huh? what would that do |
22:16:30 | FromDiscord | <Rika> result is default... by default |
22:17:03 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3YMB |
22:17:04 | FromDiscord | <Rika> contains cant return anything else but a bool anyway |
22:17:46 | FromDiscord | <Rika> actually perhaps you could fudge it with a return T and a T -> bool converter but thats fucked |
22:19:46 | FromDiscord | <Elegantbeef> I'd probably just use two different procedures |
22:19:47 | FromDiscord | <Elegantbeef> `proc contains(node: PrefNodes, val: string)` and the present one |
22:20:01 | FromDiscord | <Yardanico> yeah i had a thought about that too |
22:20:48 | FromDiscord | <michaelb.eth> In reply to @Generic "no idea how expensive": nice, thanks, turned out to be quite feasible that way |
22:21:04 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YMC |
22:21:04 | FromDiscord | <Elegantbeef> The way it's meant to be 😛 |
22:21:27 | * | ltriant joined #nim |
22:23:21 | * | rockcavera quit (Remote host closed the connection) |
22:24:09 | FromDiscord | <Rika> except the single line proc thats cursed |
22:24:31 | FromDiscord | <Elegantbeef> Best not be insulting single line procs |
22:25:25 | FromDiscord | <Elegantbeef> The real cursed thing is converting a string to a Pnode to check if it contains it |
22:34:41 | * | ltriant quit (Ping timeout: 255 seconds) |
22:36:55 | * | jjido joined #nim |
22:47:17 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
22:54:43 | FromDiscord | <demotomohiro> I tried to explain the difference bitween object types and ref object types: https://internet-of-tomohiro.netlify.app/nim/faq.en.html#type-when-to-use-ref-object-vs-plain-object-qmark |
22:56:19 | FromDiscord | <Yardanico> @demotomohiro "Parent reference type can refer inherit type" not sure what this means |
22:56:25 | FromDiscord | <Yardanico> object inheritance works with both object/ref object |
22:59:04 | FromDiscord | <demotomohiro> If type B inherits type A, var a:A can refer B if they are ref type. |
23:00:57 | FromDiscord | <Yardanico> oh, yeah, but it's better to change the wording of this I feel |
23:01:24 | FromDiscord | <demotomohiro> If you do `var b = B(); a: A = b` and A and B were `object` type, only a part of B is copied to a. |
23:07:38 | FromDiscord | <demotomohiro> "Type `A` variable can refer any objects that inherits type `A` if `A` is ref type."↵Is this better? |
23:08:31 | FromDiscord | <Yardanico> In reply to @demotomohiro ""Type `A` variable can": "A variable of a type `A` can contain any other objects as long as they inherit from `A` if `A` is a ref type" |
23:08:35 | FromDiscord | <Yardanico> maybe something like this? |
23:09:03 | FromDiscord | <Yardanico> (edit) "any other objects" => "an object of another type" | "they inherit" => "it inherits" | "as long asit inheritsfrom ... `A`" added "" |
23:10:06 | FromDiscord | <demotomohiro> It looks better. Thank you! |
23:10:07 | FromDiscord | <Elegantbeef> "When A is a inheritable reference object, a variable or field of the base type can point to a child type due to the fact they're heap allocated and can be dynamically sized" |
23:11:06 | FromDiscord | <Yardanico> 👺 |
23:11:33 | FromDiscord | <Rika> In reply to @Elegantbeef ""When A is a": Is this a serious suggestion or a joke I can’t tell |
23:11:47 | FromDiscord | <Elegantbeef> Why not both |
23:11:48 | FromDiscord | <Yardanico> In reply to @Rika "Is this a serious": i mean he explained it even better than I did, just a bit more wordy |
23:12:16 | FromDiscord | <Yardanico> the "due to the fact they're heap allocated and can be dynamically sized" isn't really needed unless you want the readers to know the internal details |
23:12:43 | FromDiscord | <Rika> Not sure if beginners would understand that honestly |
23:12:52 | FromDiscord | <Elegantbeef> Probably not |
23:13:11 | FromDiscord | <Elegantbeef> I started rotting my brain and writing shitty explanations of generics last night |
23:13:20 | FromDiscord | <Elegantbeef> Worlds shittiest start of a generic writeup |
23:13:39 | FromDiscord | <demotomohiro> I will use what @Yardanico told. |
23:17:11 | FromDiscord | <Andreas> In reply to @Elegantbeef "Worlds shittiest start of": let me proof read it - if i my tiny brain can make sense of it - it might be good enough for newbies. |
23:17:51 | FromDiscord | <Elegantbeef> Eh it's nowhere near done |
23:20:30 | FromDiscord | <Andreas> In reply to @Elegantbeef "Eh it's nowhere near": most things are WIP - funny Yardanico explained this mornin to me that `owned` - which i use - is already kind of deprecated 😉 but `threading/smartptr` are already around - so many things in-flight or WIP |
23:32:42 | FromDiscord | <Elegantbeef> Yea i know that but I intend on rewriting it all pretty much |
23:44:02 | FromDiscord | <Andreas> In reply to @Elegantbeef "Yea i know that": 'rewriting it all' beeing what ? |
23:44:17 | FromDiscord | <Andreas> (edit) "beeing" => "meaning" |
23:46:13 | * | ltriant joined #nim |
23:47:46 | FromDiscord | <Elegantbeef> I intend on pretty much scraping it and starting from the start, wrote it when i was tired so it doesnt have my typical charm |
23:50:28 | FromDiscord | <Elegantbeef> It's as dry as a cracker sitting out in the Sahara |
23:51:11 | FromDiscord | <!Patitotective> In reply to @Rika "why is the body": if you pass a string and its of kind `PObject` its a key↵otherwise its an element of a `PSeq` |
23:53:06 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3YMK |
23:55:40 | FromDiscord | <Rika> He got it backwards |
23:55:43 | FromDiscord | <Elegantbeef> You'd forward declare it |
23:55:48 | FromDiscord | <Elegantbeef> Or yea |