00:13:36 | FromDiscord | <Sabena Sema> I think it just relies on your local python installation since that's what it loads the python library from |
00:13:49 | FromDiscord | <Sabena Sema> if you compile it with the proper flags you should be able to link your own |
00:13:54 | FromDiscord | <Sabena Sema> or if you just applocal deploy the DSO |
00:14:09 | FromDiscord | <Elegantbeef> Is there any reason you want python above anything else?↵(@d4rckh) |
00:17:27 | FromDiscord | <Sabena Sema> it's probably a pretty good option |
00:17:44 | FromDiscord | <Sabena Sema> using nimscript with additional functions compiled in is a bit tricky I think |
00:18:03 | FromDiscord | <Elegantbeef> It's pretty simple |
00:18:29 | FromDiscord | <Elegantbeef> I'm very biased as i have nimscripter 😄 |
00:18:56 | FromDiscord | <Elegantbeef> But yea depending on what you're after insert my WASM advertisement here |
00:19:10 | FromDiscord | <Sabena Sema> how does nimscripter work? |
00:19:40 | FromDiscord | <Elegantbeef> Adds text to the file and has a module to convert to/from the PNodes |
00:19:59 | FromDiscord | <Sabena Sema> oh, so the functions you export are evaluated by the VM |
00:20:05 | FromDiscord | <Sabena Sema> not linked into the interpreter and called directly |
00:20:06 | FromDiscord | <Elegantbeef> No |
00:20:12 | FromDiscord | <Sabena Sema> yeah, the second is what I would want |
00:20:23 | FromDiscord | <Elegantbeef> The functions you linked are called in native code |
00:20:43 | FromDiscord | <Elegantbeef> The VM has the ability to overload routines |
00:20:57 | FromDiscord | <Elegantbeef> I overload those routines and pass the data to the native Nim |
00:21:34 | FromDiscord | <Sabena Sema> through what mechanism? |
00:21:50 | FromDiscord | <Elegantbeef> The Nim VM's implementRoutine |
00:22:26 | FromDiscord | <Elegantbeef> An example program that uses the package is here https://github.com/beef331/nimscripter/blob/master/examples/macrorepl/macrorepl.nim#L162-L189 |
00:22:47 | FromDiscord | <Sabena Sema> OK yeah, that's kinda what I would expect then |
00:23:36 | FromDiscord | <Elegantbeef> It makes a module named "macrosport" and gives it types to paste into the nimscript. Also procedures to paste and override. |
00:24:09 | FromDiscord | <Elegantbeef> The VM requires a module signature in the file but the body can be anything so you paste in a procedure that does nothing then the VM can override it and voila you have user defined code called from the VM |
00:24:15 | FromDiscord | <Elegantbeef> procedure signature\ |
00:24:24 | FromDiscord | <Sabena Sema> sent a code paste, see https://play.nim-lang.org/#ix=48mF |
00:24:39 | FromDiscord | <Sabena Sema> Neither the full path or the filename, or ffi, or libffi-7, or libffi-7.dll, or libffi work |
00:25:13 | FromDiscord | <Elegantbeef> i'd wager `ffi-7`? |
00:25:24 | FromDiscord | <Sabena Sema> I _think_ I tried that, I'll try again |
00:25:55 | FromDiscord | <Elegantbeef> Perhaps it requires the entire path |
00:26:00 | FromDiscord | <Sabena Sema> tried that too |
00:26:08 | FromDiscord | <Elegantbeef> I do not really know, have never really used dynlib override |
00:26:34 | FromDiscord | <Sabena Sema> maybe I need some other path separator or escaping |
00:26:56 | FromDiscord | <Sabena Sema> I usually use dynlibOverrideAll, but for building the compiler that doesn't work |
00:27:21 | FromDiscord | <Sabena Sema> because for some reason `#import <Window.h>` ends up everywhere, and winlean has definitions that disagree |
00:27:30 | FromDiscord | <Sabena Sema> and fixing _that_ is somewhat complicated |
00:28:05 | FromDiscord | <Sabena Sema> is there a way to have nim emit `void` but treat the type as an `int` in nim code |
00:30:05 | FromDiscord | <Elegantbeef> Not that i know of |
00:31:52 | FromDiscord | <Sabena Sema> sigh , fixing that signature is a huge pain, there's a lot of explicitly comparing to -1 and such |
00:32:10 | FromDiscord | <Sabena Sema> and even if I do that idk if it would be mergeable upstream because it would break so much code |
00:32:27 | FromDiscord | <Sabena Sema> but honestly winlean shouldn't really be using dynlib _anyway_ |
00:32:43 | FromDiscord | <Sabena Sema> it does `{.importc, dynlib: "kernel32.dll".}` for everything |
00:32:49 | FromDiscord | <Sabena Sema> which is just .... not really the best |
00:40:07 | FromDiscord | <Sabena Sema> in general I would love to figure out how to get the compiler to stop emitting windows.h includes in it's own code, since it takes a long time to parse windows.h |
00:46:52 | * | greyalien502 joined #nim |
01:02:28 | greyalien502 | how can i define a generic n-dimensional seq type and then write procedures that accept it? |
01:03:46 | FromDiscord | <treeform> In reply to @greyalien502 "how can i define": `seq[seq[T]]` ? |
01:04:14 | greyalien502 | i mean where the depth is generic |
01:05:19 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=48mN |
01:10:14 | greyalien502 | @Elegantbeef, thanks, but then the dimension is not type checked at all. |
01:10:26 | greyalien502 | i wanted something like: |
01:10:27 | greyalien502 | proc get[n,T]( sequence: ndseq[n,T], indices: array[n,int]):T = |
01:10:44 | * | vsantana joined #nim |
01:15:14 | * | vsantana quit (Ping timeout: 248 seconds) |
01:19:24 | FromDiscord | <Elegantbeef> I cannot think of a way to do this |
01:21:16 | FromDiscord | <Elegantbeef> Actually might be able to use a concept |
01:23:03 | * | derpydoo quit (Ping timeout: 256 seconds) |
01:42:23 | FromDiscord | <Elegantbeef> greyalien502 this does kinda work https://play.nim-lang.org/#ix=48mQ |
02:29:34 | greyalien502 | Elegantbeef, i'm not really understanding how this would be used. |
02:31:00 | greyalien502 | i suppose i would need two functions, for NSeq[0, T] and one for NSeq[n, T] for n>0? |
02:31:20 | greyalien502 | or maybe i can use a macro or something to check the value inside. |
02:31:37 | FromDiscord | <Elegantbeef> Yea a macro would be best here |
02:34:43 | FromDiscord | <Girvo> Something I'd love if it exists, is a way to search Nimble packages for proc type signatures lol |
02:37:28 | FromDiscord | <!Patitotective> In reply to @Girvo "Something I'd love if": what do you mean? search a proc for its parameter types and return type? kinda weird↵when would you use it? |
02:44:57 | FromDiscord | <Girvo> Constantly haha. It's a really common thing in ML-derived languages (OCaml, Haskell, Purescript and so on). As an example, I was trying to compare the various utility libraries out there that take in array[2, byte] and return uint16, and being able to search libraries for implementations of that signature can be really useful |
02:45:20 | FromDiscord | <Girvo> https://pursuit.purescript.org/ is an example 🙂 |
02:46:16 | FromDiscord | <Girvo> Sadly it's less useful in languages like Nim, but still does have some benefit. I don't really expect it to exist or be built, mind you, just musing out loud |
02:46:55 | FromDiscord | <Rika> How would it work for macros that generate procs when fed a type |
02:47:01 | FromDiscord | <Rika> Or macros in general |
02:48:32 | FromDiscord | <Girvo> No idea 🙂 but it wouldn't need to be perfect to still have usefulness: theres a fair bit that Pursuit doesn't make clear, for example, but its still an indispensable part of Purescript development. Haskell has various extensions and so on that massively change how the language operates, but https://hoogle.haskell.org/ is still useful |
02:50:21 | FromDiscord | <Elegantbeef> I could see it working for any concrete procedure, but anything that requires instantiation would be quite difficult |
02:51:48 | FromDiscord | <Girvo> Yeah there are a few language features that are heavily used that would make it more complex or impossible in some cases. On the other hand, procs in modules are so core to the language compared to other OOP-based ones that it almost feels like it'd be fun. I might see what dodgy thing I can hack up on the weekend haha, might be a fun project |
02:52:27 | FromDiscord | <Elegantbeef> It'd mostly just be working on the genrated doc search function |
02:52:57 | FromDiscord | <Elegantbeef> Change the functionality so `a -> b` searches for parameters of `a` that returns `b` |
02:53:10 | FromDiscord | <Girvo> Yeah. Even just a nimble-wide index of all that might have use. |
02:53:34 | FromDiscord | <Girvo> Niche as hell though, but man it's something I miss in all the languages that are actually useful, compared to those that _do_ have this feature 😉 |
03:01:13 | FromDiscord | <Rika> I can imagine indexing being awful |
03:30:28 | FromDiscord | <!&luke> How can I read more than a line from stdin |
03:30:50 | FromDiscord | <Elegantbeef> stdin is a file so the same as any file |
03:31:10 | FromDiscord | <!&luke> How tho |
03:31:16 | FromDiscord | <!&luke> readFile doesn’t work |
03:31:23 | FromDiscord | <!&luke> As it expects a file path |
03:31:49 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/io.html |
03:33:39 | FromDiscord | <Rika> Read characters until you’re satisfied with all you’ve read |
03:33:52 | FromDiscord | <Rika> Use a while loop |
03:59:43 | * | xet7 quit (Quit: Leaving) |
05:19:52 | FromDiscord | <Bung> SIGSEGV when call dll function, how to get usefull information, it's like black hole to me |
05:22:09 | * | greyalien502 quit (Remote host closed the connection) |
05:37:26 | madprops | https://github.com/madprops/rumsfeld |
05:39:54 | madprops | counterpart to this https://github.com/madprops/goldie |
05:56:54 | FromDiscord | <Phil> .... I just tried out intellij with its nim plugin, the auto complete is so much better it's not even funny |
05:57:51 | FromDiscord | <Phil> Never thought I'd install it again after pycharm became too bulky to me but I can't seem to get vscode to work with proper autocomplete and if Intellij just works in that regard then that's just dope |
05:58:45 | FromDiscord | <huantian> Is IntelliJ autocomplete really that good |
05:58:55 | FromDiscord | <huantian> Maybe I should try it idk if I still have clion installed |
05:59:35 | FromDiscord | <Bung> it maybe because of nimlsp |
05:59:59 | FromDiscord | <Elegantbeef> jetbrains made their own Nim tooling |
06:00:01 | FromDiscord | <Phil> I just went into one of my files that imports another module with constants in it.↵Started typing, within milliseconds I got suggestions for the const I had defined in the other module |
06:00:05 | FromDiscord | <Elegantbeef> It doesnt rely on nimsuggest |
06:00:30 | FromDiscord | <Bung> how do you know that |
06:01:06 | FromDiscord | <Phil> My vscode experience is either I get no suggestion at all or it takes 10 seconds.↵And following to where that thing is defined in vscode didn't work for me half the time even when I had both nim plugins in vscode installed and not at all after I removed the old one |
06:02:08 | FromDiscord | <Phil> The nim plugin appears to not be in the free tier though =/↵Though I'll need to check that one again, maybe they just offer no convenient download or sth |
06:02:29 | FromDiscord | <Girvo> Is there a way to mark a "string" (it's really a sequence of bytes) that needs to be read but never modified across multiple threads as "const" or something? I can put a lock around it without too much of an issue, but is there a better option? It's only ever being read/copied from by all threads |
06:02:52 | FromDiscord | <Girvo> In reply to @Elegantbeef "It doesnt rely on": Oh fascinating. Good on them at least, they do build nice tooling |
06:03:18 | FromDiscord | <Elegantbeef> I'd make a `type ImmString = distinct string` |
06:04:04 | FromDiscord | <Girvo> Oh yeah, not a bad idea |
06:05:00 | FromDiscord | <Phil> Oh, few, you can download the plugin |
06:05:57 | FromDiscord | <Phil> OHHHH the reason it didn't show up for me because my... intellij version is too new, wth |
06:06:00 | * | PMunch joined #nim |
06:06:33 | FromDiscord | <Phil> The pains of arch |
06:09:09 | FromDiscord | <Phil> Time to download tar.gz files from the intellij page and pray I guess |
06:12:16 | PMunch | Pains of Arch? |
06:12:51 | FromDiscord | <Phil> intellij is not in the repository, so you have to go to flathub, which only gives you intellij in versions above 221, while the nim plugin only supports intellij builds up to 221 |
06:22:20 | FromDiscord | <Phil> Hmm the syntax highlighting is not quite what I'd want |
06:23:44 | PMunch | Aah, |
06:23:57 | PMunch | Yeah for proprietary stuff I guess it can be a bit tricky |
06:25:56 | FromDiscord | <Prestige> In reply to @Isofruit "intellij is not in": It's not? |
06:26:27 | FromDiscord | <Prestige> I see the community edition in `community` and `intellij-idea-ultimate-edition` in the AUR |
06:26:31 | FromDiscord | <Prestige> and some others |
06:26:40 | FromDiscord | <Phil> main repository, not AUR |
06:26:49 | FromDiscord | <Phil> Everything is in the AUR |
06:27:04 | FromDiscord | <Phil> I'm pretty sure if you search hard enough, Jesus is in the AUR |
06:27:23 | FromDiscord | <Prestige> `aur/foobar2000-component-jesus-bin` interesting, lol |
06:27:31 | FromDiscord | <Phil> Called it! |
06:28:29 | FromDiscord | <Phil> AUR for me has just often meant tinkering when it comes to more code related applications, that's why I prefer to avoid it in that context |
06:29:03 | FromDiscord | <Phil> Now to figure out how I get intellij to compile my project on save |
06:42:54 | FromDiscord | <enthus1ast> https://github.com/Patitotective/ImTemplate looks amazing |
06:43:12 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=48nK |
06:43:13 | * | PMunch quit (Quit: Leaving) |
06:43:23 | FromDiscord | <enthus1ast> Will try it for my next gui |
06:43:31 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=48nK" => "https://play.nim-lang.org/#ix=48nL" |
06:43:33 | * | PMunch joined #nim |
06:43:35 | * | PMunch quit (Remote host closed the connection) |
06:44:32 | * | PMunch joined #nim |
06:44:38 | * | PMunch quit (Remote host closed the connection) |
06:45:28 | FromDiscord | <flywind> Hcr doesn't work with ORC probably |
06:45:34 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=48nN |
06:45:55 | FromDiscord | <enthus1ast> Waiting for the day koi will be ready.... |
06:46:12 | FromDiscord | <Phil> In reply to @flywind "Hcr doesn't work with": Ohhhhhhhhh |
06:46:44 | FromDiscord | <Phil> I completely overlooked that flag |
06:46:44 | FromDiscord | <Elegantbeef> HCR doesnt work FTFY 😄 |
06:47:07 | * | PMunch joined #nim |
06:47:26 | FromDiscord | <Phil> Yeah I've been compiling purely with musl-gcc for so long now (which uses a different nimble-task of mine where I don't have that flag) that I completely overlooked it still being in there |
06:47:36 | * | PMunch quit (Client Quit) |
06:48:03 | FromDiscord | <flywind> In reply to @Elegantbeef "HCR doesnt work FTFY": Yeah, but it doesn't even compile with ORC 😜 |
06:52:31 | * | PMunch joined #nim |
06:53:06 | * | PMunch quit (Client Quit) |
06:53:54 | FromDiscord | <Phil> Welp, I've got my general setup in intellij down. ↵It works surprisingly well, hopefully finding stuff when contributing will be that much less painful now. |
06:54:07 | FromDiscord | <Bung> my procA return ptr T, in another proc I assign procA returns to variable , echo repr it , it fails with `reprRecord`, any idea? |
06:54:20 | FromDiscord | <Phil> If anyone has good plugin suggestions I'm all open for it, currently only using filewatcher and the nim plugin |
06:54:31 | FromDiscord | <flywind> In reply to @Bung "my procA return ptr": probably a compiler bug |
06:55:43 | FromDiscord | <Bung> I have no idea, at the end of procA , I echo repr result just fine |
06:56:19 | FromDiscord | <flywind> In reply to @Isofruit "Welp, I've got my": That plugin is closed source. |
06:57:49 | * | PMunch joined #nim |
06:58:06 | * | PMunch quit (Client Quit) |
06:58:51 | FromDiscord | <Bung> have not seen much proc returns ptr T , but much as l value or as proc param |
06:59:40 | * | PMunch joined #nim |
07:00:21 | FromDiscord | <Phil> In reply to @flywind "That plugin is closed": I previously had only syntax highlighting and build on save. |
07:00:26 | FromDiscord | <Elegantbeef> Are you by any chance returning a stack value? |
07:01:15 | FromDiscord | <Phil> (edit) "save." => "save (my response is assuming you wanted to express that you're not a fan of the plugin being closed source)." |
07:01:16 | FromDiscord | <Bung> no idea, am coming from web dev |
07:01:37 | FromDiscord | <Elegantbeef> Are you returning the address of a locally scoped variable? |
07:01:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48nU |
07:02:08 | FromDiscord | <Elegantbeef> That's going to get you a dangling pointer and will likely result in faulty repr logic |
07:02:09 | FromDiscord | <Bung> `result = cast[ptr ICoreWebView2CreateCoreWebView2ControllerCompletedHandler](↵ alloc0(sizeof(ICoreWebView2CreateCoreWebView2ControllerCompletedHandler)))` |
07:02:21 | FromDiscord | <Elegantbeef> Wait until you learn of `create` |
07:02:34 | FromDiscord | <Bung> I can't return this ? |
07:02:35 | FromDiscord | <Elegantbeef> Also mother of java batman |
07:02:41 | FromDiscord | <Elegantbeef> you can return that |
07:02:52 | FromDiscord | <Elegantbeef> It's heap allocated |
07:03:32 | * | PMunch quit (Client Quit) |
07:03:49 | * | PMunch joined #nim |
07:04:22 | * | rockcavera quit (Remote host closed the connection) |
07:04:24 | FromDiscord | <Bung> then what's going on the problem I described |
07:04:43 | * | PMunch quit (Client Quit) |
07:05:25 | FromDiscord | <Elegantbeef> A possible bug, or possible user error |
07:05:26 | FromDiscord | <Elegantbeef> Hard to say |
07:06:12 | FromDiscord | <ShalokShalom (ShalokShalom)> > The nim plugin appears to not be in the free tier though =/↵> Though I'll need to check that one again, maybe they just offer no convenient download or sth↵You get all the Jetbrain products for free, if you apply for it as the maintainer of an open source project, that is at least 3 months old. |
07:06:19 | * | PMunch joined #nim |
07:06:32 | * | PMunch quit (Remote host closed the connection) |
07:06:58 | FromDiscord | <Phil> Read my later posts 😛↵Was just an issue with the version, turns out intellij filters the marketplace for you for plugins compatible with your installed version |
07:07:48 | FromDiscord | <Bung> https://media.discordapp.net/attachments/371759389889003532/1011532189395066921/2022-08-23_150724.png |
07:08:22 | FromDiscord | <Bung> line 59 works fine, 69 error |
07:09:25 | FromDiscord | <Elegantbeef> what's the code for that procedure? |
07:11:16 | FromDiscord | <Bung> https://github.com/bung87/webview2/blob/main/src/webview2/browser.nim see here |
07:13:40 | FromDiscord | <Elegantbeef> If i was good at guessing i'd say it's replated to the `stdcall` procs |
07:14:24 | FromDiscord | <Elegantbeef> That or the vtable stuff |
07:15:08 | FromDiscord | <flywind> BTW pragmas after the object is deprecated |
07:15:11 | FromDiscord | <flywind> `= object {.pure, inheritable.}` |
07:15:27 | * | PMunch joined #nim |
07:16:33 | FromDiscord | <Elegantbeef> Why'd you delete that fly arent you right? |
07:17:09 | PMunch | Sorry to those select few who use IRC with join/leave messages enabled |
07:17:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48nZ |
07:17:41 | FromDiscord | <Elegantbeef> Bung that's probably related to the issue |
07:18:01 | FromDiscord | <Elegantbeef> The pragma goes on the Type symbol not the object |
07:18:15 | FromDiscord | <Elegantbeef> Unacceptable pmunch |
07:18:22 | FromDiscord | <Elegantbeef> You'll be hearing from my lawyers |
07:20:57 | FromDiscord | <Bung> wait , still valid to compiler ? |
07:21:06 | FromDiscord | <Elegantbeef> Yea |
07:21:06 | FromDiscord | <flywind> In reply to @Elegantbeef "Bung that's probably related": You are right. It probably causes the bug https://github.com/nim-lang/Nim/pull/20199 |
07:21:34 | FromDiscord | <Elegantbeef> I dont even think it's a bug that it compiles |
07:21:39 | FromDiscord | <Elegantbeef> It might be, but i dont know |
07:21:58 | FromDiscord | <Elegantbeef> Being able to put pragmas on that seems like something you may want to look at, but idk |
07:23:09 | FromDiscord | <Bung> okay, thanks ! I changed the syntax repr problem gone |
07:27:21 | FromDiscord | <d4rckh> In reply to @Elegantbeef "Is there any reason": Can I use anything else? |
07:27:34 | FromDiscord | <Elegantbeef> Depending what you're after |
07:27:45 | FromDiscord | <Elegantbeef> You can use the Nim Vm, Wasm, Lua, Wren,, Dascript, ... |
07:29:03 | FromDiscord | <Bung> is there a way to see more information when I call dll function encounter nil access ? |
07:29:51 | FromDiscord | <Elegantbeef> No |
07:30:01 | FromDiscord | <Elegantbeef> I mean you could use something like valgrind and that might help |
07:31:24 | FromDiscord | <d4rckh> I think i can use nim vm |
07:35:24 | FromDiscord | <Elegantbeef> You likely can, not going to suggest anything since i dont know what you're doing |
07:36:02 | FromDiscord | <d4rckh> I can use anything really |
07:36:15 | FromDiscord | <d4rckh> As long as I can run it at run time and call nim functions |
07:36:51 | FromDiscord | <d4rckh> Is there any library I can use for Nim VM? |
07:38:02 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimscripter makes it relatively easy |
07:38:14 | FromDiscord | <Elegantbeef> Depending on the program i'm a big proponent of wasm |
07:38:53 | FromDiscord | <d4rckh> Looks good |
07:38:55 | FromDiscord | <Elegantbeef> It's just the best if you ever want users to write the code since they can use any language |
07:41:52 | FromDiscord | <Ras> how would one transform this into an if statement https://media.discordapp.net/attachments/371759389889003532/1011540764716707881/unknown.png |
07:41:57 | FromDiscord | <Ras> elegantly |
07:43:07 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48oc |
07:43:21 | FromDiscord | <Elegantbeef> Dont get why you'd want to make it an if statement |
07:43:22 | FromDiscord | <Elegantbeef> But yea |
07:44:02 | * | arkurious joined #nim |
07:45:21 | FromDiscord | <Ras> it's a case statement with a single `of` and an `else` |
07:45:32 | FromDiscord | <Elegantbeef> So? |
07:45:44 | FromDiscord | <Ras> so... nothing, i guess |
07:45:45 | FromDiscord | <Elegantbeef> Case statements are more extensible if you ever want to specialise other branches |
07:45:46 | FromDiscord | <Ras> suppose you're right |
07:46:50 | FromDiscord | <Elegantbeef> I personally always prefer case statements when not dealing with booleans |
07:55:48 | FromDiscord | <Phil> In reply to @Ras "it's a case statement": The case statement is the somewhat more "correct" way to express you're checking what value is inside of a variable.↵With the case statement the reader of your code knows you're not somehow throwing in random boolean checks from elsewhere, you're limited to only checking "does my variable contain value X, if so do Y" |
07:56:24 | FromDiscord | <Phil> That's a strength and adds clarity of what your intention is there |
07:56:29 | FromDiscord | <Ras> fair enough |
08:20:13 | FromDiscord | <enthus1ast> And if you not have an else case, it forces you to handle all cases |
08:21:01 | FromDiscord | <Phil> I wonder if you can even handle a variable denoted as string or int without an else since they have infinite possible values |
08:21:27 | FromDiscord | <Elegantbeef> Think yes to string but no to int |
08:21:31 | FromDiscord | <Phil> Does motivate you to use enums when possible though |
08:21:58 | FromDiscord | <Elegantbeef> Or use subrange types |
08:22:05 | FromDiscord | <Phil> Which would make it more accurate again! |
08:22:07 | FromDiscord | <Phil> Win on all sides |
08:23:31 | FromDiscord | <Ras> i just personally think that `if char in ['a'..'z', '0'..'9']` makes more sense when reading than a case statement (less mental overhead trying to understand what the block is attempting to do) but i might be alone in this |
08:23:55 | FromDiscord | <Elegantbeef> You're very much alone and that doesnt represent the same thing |
08:23:56 | FromDiscord | <Ras> i mean, it's no big deal, and a matter of personal preference really |
08:24:40 | FromDiscord | <ShalokShalom (ShalokShalom)> How would I check, how many arguments has been passed in a shell execution |
08:24:43 | FromDiscord | <Phil> By and large yeah. In this specific scenario for sure |
08:25:15 | FromDiscord | <Phil> doesn't os have a proc? |
08:25:21 | FromDiscord | <ShalokShalom (ShalokShalom)> Like, I want to succeed, if the previous command had been used with one argument or more |
08:25:35 | FromDiscord | <ShalokShalom (ShalokShalom)> And quit the operation, if done with no arguments |
08:26:10 | FromDiscord | <Phil> If the previous command.... hm |
08:27:13 | FromDiscord | <Ras> In reply to @Elegantbeef "You're very much alone": how do you mean? in this scenario, i'm checking whether if character is in a set of ascii characters, then do something, and if not, then do something else |
08:27:19 | FromDiscord | <Ras> semantically it reads as it's written |
08:27:32 | FromDiscord | <Elegantbeef> Causue you've got an array of ranges |
08:27:33 | FromDiscord | <Elegantbeef> Well slices |
08:27:36 | FromDiscord | <Ras> in my head, i have to transform a `case` ... `of` statement into what is going on |
08:28:05 | FromDiscord | <Elegantbeef> So now you can only specialise that branch for a range of characters |
08:28:42 | FromDiscord | <Elegantbeef> Due to the extensibility of case statements i cannot agree that an if statement is generally better |
08:29:11 | FromDiscord | <Ras> i'm not saying it's better at all from a language standpoint |
08:29:25 | FromDiscord | <Ras> if this is how it's done in nim then so be it, no biggie |
08:29:31 | FromDiscord | <Prestige> Would that alloc a new array? |
08:29:51 | FromDiscord | <Ras> i'm just saying that it's just a tad bit harder to read is all |
08:30:05 | FromDiscord | <Elegantbeef> It's a constant so it's not really an worrisome allocation |
08:30:13 | FromDiscord | <Prestige> cool, good to know |
08:30:14 | FromDiscord | <Elegantbeef> But yes it does create an array |
08:33:42 | FromDiscord | <Ras> also, a case statement with 2 possible outcomes creates a nested block when it's really not necessary (if `if` were used, for example) |
08:34:07 | FromDiscord | <Elegantbeef> What? |
08:34:12 | FromDiscord | <aruZeta> huh? |
08:34:22 | FromDiscord | <Ras> kind of hard to explain but like, `case [[if 1] [if 2]]` instead of just `[if 1] [if 2]` |
08:34:25 | FromDiscord | <Elegantbeef> If you indent the of branches you're doing it wrong |
08:34:30 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48om |
08:34:37 | FromDiscord | <Ras> this isn't my code |
08:34:40 | FromDiscord | <Ras> it's treeform's |
08:35:08 | FromDiscord | <Elegantbeef> I didnt stutter |
08:35:30 | FromDiscord | <Elegantbeef> Yes that's a joke, it's my opinion that case should not have indented of branches |
08:35:32 | FromDiscord | <Ras> "i'm" not doing anything wrong, why does the language even support the "wrong" form in the first place then like what |
08:37:25 | FromDiscord | <Ras> also that's really proving my point if there are multiple ways to write a `case` statement for something as simple as this, more mental overhead when reading it |
08:37:44 | FromDiscord | <Elegantbeef> Not really cause the same semantics are represented |
08:37:55 | FromDiscord | <Elegantbeef> You can write code however you want of course |
08:38:07 | FromDiscord | <aruZeta> In reply to @Elegantbeef "You can write code": ^^ |
08:38:32 | FromDiscord | <Ras> again, this isn't my code, i'm talking about when reading someone else's code |
08:39:16 | FromDiscord | <Elegantbeef> Well i disagree with the premise that `if` is "more readable" |
08:39:16 | FromDiscord | <Elegantbeef> So i guess i'll go in the corner and shush |
08:39:24 | FromDiscord | <Ras> In reply to @Elegantbeef "You can write code": also apparently not because i can't use an `if` statement... :p |
08:39:29 | FromDiscord | <aruZeta> In reply to @Ras "again, this isn't my": sometimes reading someone else's code is like trying to decipher ancient texts written in god knows which language |
08:40:01 | FromDiscord | <Elegantbeef> Why cant you?↵(@Ras) |
08:41:30 | FromDiscord | <Ras> oh, apparently i can, i somehow missed the example you provided entirely |
08:41:31 | FromDiscord | <Ras> my bad |
08:41:59 | FromDiscord | <aruZeta> everything you can do with a `case` statement, you can do with an `if` too |
08:42:07 | FromDiscord | <aruZeta> but not the other way |
08:42:22 | FromDiscord | <Elegantbeef> If statement is very much less ergonomic |
08:42:44 | FromDiscord | <aruZeta> if you can use case, use it |
08:42:49 | FromDiscord | <aruZeta> (edit) "case," => "`case`," |
08:43:48 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48on |
08:44:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48oo |
08:44:35 | FromDiscord | <Ras> i mean, if i know for a fact that i will ever only have two possible outcomes - one for if the character _is_ in the set of ascii characters, and one for if it isn't, then i think the fact that the `if` statement is much easier to comprehend by a single glance outweighs the flexibility of the case statement that i'll never use |
08:44:43 | FromDiscord | <Elegantbeef> `11..10` ah yes brain mush |
08:45:00 | FromDiscord | <Elegantbeef> Hey you do you |
08:45:11 | FromDiscord | <Elegantbeef> I never believe in never |
08:45:17 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48op |
08:45:24 | FromDiscord | <Elegantbeef> Nop doesnt work |
08:45:33 | FromDiscord | <Elegantbeef> You cannot have `set[int]` so you'd have to manually range the types |
08:45:38 | FromDiscord | <aruZeta> ah right |
08:45:44 | FromDiscord | <aruZeta> forgot |
08:45:53 | FromDiscord | <aruZeta> (edit) "forgot" => "forgot, too much int8-16" |
08:46:42 | FromDiscord | <Ras> In reply to @Elegantbeef "I never believe in": a boolean can never have three possible values :p |
08:46:51 | FromDiscord | <Ras> which is the case i'm trying to describe here |
08:47:30 | FromDiscord | <Elegantbeef> Hey i'll bikeshed it into a trioolean |
08:48:00 | FromDiscord | <aruZeta> what about a boolean stored in a qubit |
08:48:11 | FromDiscord | <Elegantbeef> It's still just a boolean |
08:48:19 | FromDiscord | <Elegantbeef> It's just entangled with another bit |
08:48:30 | FromDiscord | <Ras> In reply to @Elegantbeef "Hey i'll bikeshed it": does Nim run on the Seturn |
08:48:38 | FromDiscord | <Ras> (edit) "Seturn" => "Setun" |
08:48:42 | FromDiscord | <Elegantbeef> The Gesa saturn? |
08:49:01 | FromDiscord | <Ras> Setun, dunno if the bridge shows edits |
08:49:05 | FromDiscord | <Ras> https://en.wikipedia.org/wiki/Setun |
08:49:07 | FromDiscord | <Elegantbeef> It does |
08:49:12 | FromDiscord | <Elegantbeef> I know the trinary computer |
08:51:08 | FromDiscord | <Elegantbeef> To change the phrasing of this conversation, i'd probably make a procedure named `isWhateverImChecking` then do `if a.isWhateverImChecking` |
08:51:22 | FromDiscord | <Elegantbeef> But i generally write procedures a lot to compartmentalise logic |
09:24:20 | FromDiscord | <Schelz> sent a code paste, see https://play.nim-lang.org/#ix=48oD |
09:32:35 | PMunch | Just use `pointer` as the type |
09:32:51 | PMunch | `proc thisFunc(myvoid: pointer)` |
09:47:27 | FromDiscord | <Schelz> uh I thought thats only for void pointers |
09:47:37 | FromDiscord | <Schelz> but thx |
09:48:54 | FromDiscord | <4zv4l> does Nim provide tail recursion optimization ? |
09:54:15 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=48oN |
09:59:26 | FromDiscord | <Ras> wouldn't tail call recursion never happen here anyways? concat happens after the recursive call |
09:59:36 | FromDiscord | <Ras> so it has to keep track of the stack |
09:59:56 | FromDiscord | <Ras> (edit) "so it has to keep track of the ... stack" added "values on the" |
10:00:56 | FromDiscord | <Ras> oh also @4zv4l: https://github.com/treeform/urlly/pull/6 |
10:37:58 | PMunch | @Schelz, LPVOID is just an alias for a void pointer :) |
10:39:08 | PMunch | But technically you can use it for any kind of pointer. I've done that in the past if I just get a pointer to some data structure from one procedure call and just have to pass that pointer along to a different procedure I would denote them both as just `pointer` or as a `distinct pointer` |
10:39:16 | PMunch | Of course nowadays I just use Futhark :) |
10:40:03 | PMunch | @Ras, yup that wouldn't be tail-call recursion |
10:40:47 | PMunch | And @4zv4l Nim doesn't provide tail recursion optimizations AFAIK, but it passes it on to GCC which does |
10:42:06 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48p2 |
10:43:06 | FromDiscord | <aruZeta> i'm not using an array[3] instead of a proc just because it's easier to `for val in someVals` and not to check if that array is supposed to have 1 element or n |
10:43:15 | FromDiscord | <aruZeta> (edit) "proc" => "seq" |
10:43:43 | PMunch | Hmm, it's certainly possible |
10:43:43 | FromDiscord | <aruZeta> (edit) "someVals`" => "someVals[n]`" | "n" => "m" |
10:43:57 | PMunch | But maybe not in a pretty way.. |
10:44:15 | FromDiscord | <Rika> Capacity or length |
10:44:20 | PMunch | Any particular reason why you'd want them to have capacity 3? |
10:44:20 | FromDiscord | <aruZeta> cap |
10:44:31 | FromDiscord | <aruZeta> just because i think that will make the seqs lighter |
10:44:40 | FromDiscord | <Rika> In what context |
10:44:44 | PMunch | Uhm, it would make them heavier.. |
10:44:44 | FromDiscord | <Rika> Desktop or embedded |
10:44:54 | FromDiscord | <aruZeta> In reply to @PMunch "Any particular reason why": because in the example the hightest len is 3 |
10:45:14 | PMunch | A seq like that would be initialised to have the cap and length equal to each other |
10:45:25 | FromDiscord | <aruZeta> im just guessing a seq's default cap is quite big |
10:45:32 | PMunch | So unless you plan on adding to them then there's no problem |
10:45:32 | FromDiscord | <aruZeta> In reply to @PMunch "A seq like that": oh |
10:45:39 | FromDiscord | <aruZeta> then that's good |
10:45:40 | FromDiscord | <Rika> In reply to @PMunch "A seq like that": Is that really true? |
10:45:45 | PMunch | Ah, yes the default is pretty big, but that doesn't apply to literals IIRC |
10:45:53 | FromDiscord | <aruZeta> nice |
10:45:55 | FromDiscord | <aruZeta> (edit) "nice ... " added "then" |
10:48:04 | PMunch | https://play.nim-lang.org/#ix=48p3 < @Rika, yup |
10:48:27 | PMunch | (There really should be a nice read-only way to get the capacity of a seq..) |
10:48:44 | FromDiscord | <aruZeta> In reply to @PMunch "(There really should be": +1 to this |
10:49:44 | FromDiscord | <aruZeta> ty PMunch :3 |
10:53:24 | PMunch | No problem :) |
10:53:33 | FromDiscord | <4zv4l> In reply to @Ras "wouldn't tail call recursion": yeah I'm not super good at recursion xD but since the data is on the heap I don't need the stack of the previous function call |
10:53:49 | FromDiscord | <4zv4l> In reply to @Ras "oh also <@329196212282458112>: https://github.com/t": looks good ! hope they'll take a look at this soon |
10:56:00 | FromDiscord | <4zv4l> In reply to @4zv4l "yeah I'm not super": so I could add a parameter the accumulator which will be a seq[string] that contains the previous string |
10:57:25 | FromDiscord | <noiryuh> how do i extract a zip with password in Nim |
10:57:31 | FromDiscord | <noiryuh> libzip seems like unmaintained |
10:58:15 | FromDiscord | <noiryuh> zippy looks cool, but doesn't support zip with password↵so i guess i can use nimcrypto to somehow decrypt password first, then use zippy to extract it |
10:58:32 | FromDiscord | <noiryuh> but i don't know what kind of encryption does zip file use |
11:00:20 | PMunch | Apparently the most basic one is called ZipCrypto and is seriously flawed :P |
11:02:10 | PMunch | You can probably use libzip with Futhark though |
11:15:52 | FromDiscord | <noiryuh> i'll take a look later |
11:17:15 | FromDiscord | <Forest> Hey PMunch since you're here, is there a way to turned off the numbered identifiers? :P |
11:18:35 | PMunch | Nope |
11:18:42 | PMunch | They're a feature |
11:18:53 | PMunch | I'm going to investigate if they have to be exported |
11:19:08 | PMunch | Otherwise they can be made private and therefore not show up in auto-complete |
11:20:49 | FromDiscord | <Phil> I think intellij achieves its somewhat better featureset by straight up importing the entire std lib into ram or something.↵The suggestions I get in there are sometimes from modules I haven't even imported, so with symbols that most definitely are not in the namespace |
11:21:09 | FromDiscord | <Phil> (edit) "I think intellij achieves its somewhat better featureset by straight up importing the entire std lib into ram or something.↵The suggestions I get in there are sometimes from modules I haven't even imported, so with symbols that most definitely are not in the namespace ... " added "of the current module" |
11:21:25 | PMunch | Yeah I guess if you autocomplete to one of those it would add that as an import |
11:21:43 | FromDiscord | <noiryuh> In reply to @PMunch "Apparently the most basic": thank you for this |
11:22:00 | FromDiscord | <Phil> In reply to @PMunch "Yeah I guess if": It doesn't fascinatingly |
11:22:15 | PMunch | Huh, well that's a bummer |
11:22:18 | FromDiscord | <Phil> You have to import yourself |
11:22:28 | FromDiscord | <noiryuh> searching for "Zip decrypting method" yells ~~"how to brute force Zip password with this simple app, bla bla bla"~~ |
11:22:49 | FromDiscord | <Phil> You can CTRL+Click on the symbol though and it will accurately jump you to the std lib module, which is something that only worked like 1/5 times in vscode for me |
11:22:59 | PMunch | Haha, yeah it was kinda hard to find the specification for how ZipCrypt works because all the articles are about how easy it is to break |
11:23:48 | FromDiscord | <noiryuh> btw, does stdlib/json parse json with trailing comma? |
11:25:19 | FromDiscord | <noiryuh> because the json content has trailing comma (and string number) |
11:28:34 | PMunch | !eval import json; echo parseJson("[123,]") |
11:28:39 | NimBot | Compile failed: [123] |
11:28:52 | FromDiscord | <Rika> Looks like it does |
11:28:57 | FromDiscord | <Rika> Even if it’s not standard lol |
11:29:11 | FromDiscord | <domosokrat> @noiryuh\: If it has trailing commas then it's not valid json |
11:29:39 | FromDiscord | <Rika> In reply to @domosokrat "<@998188037026627696>\: If it has": Well that’s not what he asked |
11:29:47 | FromDiscord | <noiryuh> welp, the problem is it not mine |
11:29:55 | FromDiscord | <noiryuh> and it's from game data |
11:30:04 | FromDiscord | <noiryuh> it's illegal btw |
11:30:24 | FromDiscord | <noiryuh> i can't ask them to produce a valid json file :) |
11:31:26 | FromDiscord | <Rika> What do you mean by illegal, what you’re doing? |
11:31:36 | FromDiscord | <domosokrat> rika\: I know. I was just to slow. I wanted to dampen the expectations. But it seems that was not neccessary |
11:31:37 | FromDiscord | <noiryuh> game data mining |
11:32:04 | FromDiscord | <Rika> I’d personally say that’s grey area |
11:32:13 | FromDiscord | <noiryuh> the character information was encrypted in a file in an encrypted zip file |
11:32:27 | FromDiscord | <noiryuh> and they also stated that data mining is prohibited |
11:33:17 | FromDiscord | <noiryuh> my current script is hardcoded and work for me on linux |
11:33:36 | FromDiscord | <noiryuh> but i want to give some others the script when i'm busy |
11:42:22 | FromDiscord | <noiryuh> 🤔 |
11:44:31 | FromDiscord | <noiryuh> sent a long message, see http://ix.io/48pa |
11:44:49 | FromDiscord | <Rika> Async wouldn’t help with decryption because it is CPU bound I believe |
11:45:07 | FromDiscord | <Rika> String numbers are just strings |
11:45:13 | FromDiscord | <noiryuh> i mean, multiple file decrypting |
11:45:25 | FromDiscord | <Rika> Multiple sure, parallel I don’t think so |
11:45:32 | FromDiscord | <noiryuh> because there are like > 1000 files |
11:45:43 | FromDiscord | <noiryuh> which simply need aes128-cbc decrypting |
11:47:14 | FromDiscord | <Bung> does it a good idea to reimplment a dll in nim when cant known why dll function call fails ? |
11:50:06 | PMunch | Probably not |
11:50:09 | PMunch | Better to debug it |
11:50:26 | PMunch | Totally depends on the DLL though |
11:51:07 | FromDiscord | <Bung> dont know how to debug it , I only get nil access |
11:51:35 | PMunch | Hmm, I want to improve my home-automation system. Currently it's a small Jester server writing state into files, and a script running every minute to control stuff based on the contents of those files |
11:52:00 | PMunch | Oh and a script gathering sensor data that is put into files and served up by the jester page |
11:52:37 | PMunch | But I want to move to some kind of event system |
11:53:58 | PMunch | Hmm, I guess my idea is better suited to a functional language. But my idea was that state was essentially one big object. Then events are fired and carry the new state with them. In order to change the global state you need to fire a new event. |
11:54:20 | PMunch | Things happening on a timed schedule would simply listen for the time tick event |
11:54:58 | FromDiscord | <b1rdf00d> this is going to sound super dumb (reading event driven triggered the though), but my day job is working on a game which is super event driven↵↵it'd be funny to make a digital twin of your house as a "game" then drive the automation by interacting with the twin |
11:55:07 | FromDiscord | <b1rdf00d> (edit) "though)," => "thought)," |
11:56:50 | PMunch | Haha, that would actually be pretty cool |
11:57:14 | PMunch | If we only had better support for functional data structures in Nim.. |
11:57:35 | PMunch | I know I should've implemented persistent dictionaries back when I did the vectors.. |
11:57:56 | PMunch | (they are basically a table which returns a new table whenever you insert a key) |
11:58:03 | FromDiscord | <Rika> Event driven is just “push instead of polll |
11:58:06 | FromDiscord | <Rika> (edit) "polll" => "poll”" |
11:58:34 | PMunch | Yup |
11:59:11 | PMunch | Hmm, I guess I could hack it with filesystem monitoring and bash scripts.. |
11:59:33 | PMunch | It wouldn't be a pretty system, but it would work for what I need it to do right now |
12:00:46 | FromDiscord | <b1rdf00d> actually kinda reminds me of "The GPU Banana Stand" I saw on hackernews this week. Could be cool to make your own "reactive" (React-like) home automation system, where you're driving your house based on state changes instead of refreshing a gui |
12:03:35 | * | thomas_adam joined #nim |
12:04:24 | FromDiscord | <b1rdf00d> is there any reason Nim can't have more functional features? (coincidentally I'm playing with ocaml currently and there are aspects that remind me of Nim). I imagine the main one is imperative is faster and uses less memory? |
12:05:19 | FromDiscord | <b1rdf00d> (edit) "features?" => "features (in your own code)?" |
12:08:35 | FromDiscord | <Rika> What do you mean |
12:09:01 | FromDiscord | <Rika> Nim just doesn’t have the features for some stuff (that isn’t macro implementable) |
12:09:45 | PMunch | It's mostly a library thing |
12:10:21 | PMunch | You often don't get the full benefit of functional programming without going fully functional though |
12:10:50 | PMunch | But in Nim you have the side effect tracking which can help you ensure that parts of your code is side-effect free which definitely helps a lot |
12:11:42 | PMunch | And sure, things would be slower, but that's just the nature of functional programming. Although if you look at something like zero-functional Nim does offer some intriguing features that can take away a lot of the overhead |
12:12:11 | PMunch | But yeah, driving the house based on state-changes was basically the idea |
12:12:12 | FromDiscord | <b1rdf00d> That's what I'd imagine, I would't expect Nim the language to go FP, but making an FP utils could help? But yeah I've tried to do this in lua and while I now have `map` and `filter` I have no compile time checks or pattern matching etc and anything could be `nil` at any point :/↵↵Yeah I really like immutable by default and `func` in Nim |
12:12:50 | PMunch | But I'd like for each state-change event to carry with it the current environment at the time of activation. This means that concurrent events won't mess things up |
12:14:06 | PMunch | I implemented persistent vectors in Nim (basically a seq that returns a new seq whenever you add something to it). The implementation is based on what Clojure uses, and it's pretty neat |
12:14:15 | FromDiscord | <b1rdf00d> that's interesting, would you try to merge conflicting states? |
12:14:28 | PMunch | There is a similar way to implement dictionaries, but I never got around to implement that |
12:14:35 | PMunch | What do you mean? |
12:17:19 | FromDiscord | <b1rdf00d> I might have a half formed idea, but you'd have a global state, and some event is fired where the captured state might not match the global, and maybe a second event which has slightly different state again? (e.g. a door being open, or the temperature?) |
12:18:06 | PMunch | Well the idea is that the state can only be changed through events |
12:18:29 | PMunch | So lets say you open a door, that updates the state and fires the "state changed: door" event |
12:18:46 | PMunch | That event carries the entire global state, including the door being open |
12:19:51 | PMunch | So if you have two event hooks listening for "state changed: door" no event could slip in between the handling of these two hooks and make the state different between the two |
12:20:23 | PMunch | Aah, I think I see what you mean |
12:20:25 | FromDiscord | <b1rdf00d> yep that makes sense |
12:21:40 | FromDiscord | <b1rdf00d> I think I'm thinking concurrent + parallel with no guarantees for how events are processed |
12:21:49 | PMunch | What would happen if I get a "state change: door" event, which in a hook should trigger a "state change: lights on" event, but while the door event was being handled another event came in which changed the state |
12:22:16 | PMunch | Hmm |
12:22:33 | FromDiscord | <b1rdf00d> yeah exactly, what happens if you shut a door and turn on a light _at the same time_ |
12:23:14 | FromDiscord | <b1rdf00d> but if your events are non-blocking and there's only 1 thread I think there's no issue? |
12:23:42 | PMunch | well, there might still be logic issues |
12:24:15 | FromDiscord | <4zv4l> is TCC better than GCC ? or which c compiler is better overall ? |
12:24:33 | PMunch | There is no compiler which is better overall, they all have tradeoffs |
12:25:03 | PMunch | TCC is faster at compiling, but produces slower binaries and has less feature support |
12:25:25 | NimEventer | New thread by Chaemon: Precompiled header in Nim, see https://forum.nim-lang.org/t/9405 |
12:27:19 | FromDiscord | <4zv4l> so for smaller and faster gcc is better ? |
12:27:45 | FromDiscord | <b1rdf00d> you could try with your code and see? |
12:28:02 | FromDiscord | <b1rdf00d> (if clang is in the mix) |
12:28:36 | PMunch | So I have dimmable lights, lets say the door open event should turn the lights on at 100% brightness. I now get a door open event, the hook checks to see if the lights are already on, and if not turns them on at 100%. Now I open the door while turning on the lights to 50%. This fires a door open event, and a lights dimming event. The door event starts processing, figures out lights should be turned on at 100% because they where off when it started processing. |
12:28:37 | PMunch | This event gets scheduled after the dimming event, the dimming event is then processed, which turns on the lights and dims them (effectively invalidating the coming event). Then the event triggered by the door fires and dims the lights to 100%.. |
12:28:49 | PMunch | Well, I guess it all depends on how events and state are handled.. |
12:29:31 | PMunch | If events are queued but state changed immediately I think it might work fine |
12:29:49 | PMunch | Ah no, that might invalidate the event.. |
12:30:01 | PMunch | Well, maybe not |
12:30:35 | PMunch | I guess events would just be "this field changed", and it would be up to the hook to decide what to do with the value in that field in the current state.. |
12:30:45 | PMunch | @4zv4l, benchmarking is always the answer |
12:31:34 | FromDiscord | <b1rdf00d> yeah the hard part is your house can't physically instantly change state |
12:31:39 | PMunch | There is no perfect solution, if you absolutely need the tiniest/fastest/most memory efficient solution for a certain problem you basically have to benchmark to figure out which one it will be |
12:32:04 | PMunch | @b1rdf00d, hmm, that's true |
12:32:09 | FromDiscord | <b1rdf00d> Are you going to use sensors? |
12:32:21 | PMunch | I already have sensors |
12:32:42 | FromDiscord | <noiryuh> In reply to @Rika "String numbers are just": is there anyway i could convert it automatically↵since i already provided one with valid json and string number -> number only |
12:32:48 | PMunch | Currently I have a temperature and humidity sensor, but I'm also going to add some air-quality sensors |
12:33:16 | FromDiscord | <noiryuh> `std/json` seems not have any problem with trailing comma, which is a good thing |
12:33:31 | PMunch | I've also got lights in my house which are dimmable (and currently programmed to dim down in the evening and dim up before the next alarm on my phone) |
12:33:34 | FromDiscord | <noiryuh> (edit) "In reply to @Rika "String numbers are just": is there anyway i could convert it automatically↵since i already provided one with valid json and string number -> number only ... " added "(via `jq`)" |
12:35:03 | FromDiscord | <b1rdf00d> this sounds cool 🙂 the furthest I ever got with a "gentle alarm" was getting my computer to start playing bird songs half an hour before I wanted to wake (this was pre iphone) |
12:36:19 | FromDiscord | <b1rdf00d> I think if your state changes are atomic then your events won't trip them up? |
12:38:42 | PMunch | Well the whole problem is basically what happens if events and state changes end up in an order where an event shouldn't be processed |
12:39:10 | PMunch | But if events only supply the whole state and the address of the field that changed then you'd be fine |
12:41:07 | PMunch | Yeah it's pretty neat, my phone reports its next alarm through a Tasker task, then the server will run a script every minute to determine if the lights should dim down and get warmer (if the current time is between pre-determined time slots) or if it should dim up (half an hour before the next alarm). At the alarm all the lights in the house dim up to 100% |
12:41:55 | PMunch | The next is to have the lights turn off when I plug in my phone at night, and possibly to have the lights turn off if I'm not connected to WiFi |
12:51:45 | * | thomas_adam left #nim (WeeChat 3.4.1) |
13:10:38 | PMunch | Ugh, silly CMS breaks every time I upgrade my server |
13:21:21 | * | derpydoo joined #nim |
13:59:36 | NimEventer | New thread by BarryK: Nim cross-compiled in OpenEmbedded, see https://forum.nim-lang.org/t/9406 |
14:20:39 | * | rockcavera joined #nim |
14:20:40 | * | rockcavera quit (Changing host) |
14:20:40 | * | rockcavera joined #nim |
14:31:45 | * | PMunch quit (Quit: Leaving) |
14:34:24 | FromDiscord | <retkid> how to do i define variables for the scope in a template again |
14:34:25 | FromDiscord | <retkid> ;-; |
14:37:57 | FromDiscord | <retkid> @Rika i saw you doing this |
14:41:27 | FromDiscord | <Rika> What do you mean again |
14:41:34 | FromDiscord | <Rika> (edit) removed "again" |
14:55:53 | FromDiscord | <Require Support> anything in nim that functions like `shlex.split()` thats in python? Have some text that I would like to split like a command line string |
15:14:29 | NimEventer | New Nimble package! NimNN - Neural Networks from scratch, see https://github.com/xcodz-dot/NimNN |
15:16:39 | FromDiscord | <aruZeta> In reply to @retkid "how to do i": do you mean `{.dirty.}` |
15:23:40 | FromDiscord | <auxym> or {.inject.} |
15:23:58 | FromDiscord | <auxym> dirty like makes everything bind/inject by default |
15:25:22 | FromDiscord | <auxym> In reply to @Require Support "anything in nim that": this i think? https://nim-lang.org/docs/os.html#parseCmdLine%2Cstring |
15:26:11 | FromDiscord | <Require Support> yep looks like it |
15:50:32 | NimEventer | New Nimble package! timsort2 - timsort algorithm implemented in Nim, see https://github.com/xrfez/timsort |
16:19:47 | * | def- quit (Quit: -) |
16:24:58 | * | def- joined #nim |
16:26:53 | FromDiscord | <planetis> I get a bunch of warnings from the rand module that casting to bigger size is unsafe but I am only using uint32 range and rand returns uint64, wtf |
16:27:25 | FromDiscord | <planetis> (edit) "I get a bunch of warnings from the rand module that casting to bigger size is unsafe but I am only using ... uint32next" added "rand" | "rand" => "next" |
16:29:10 | FromDiscord | <planetis> Oh wait it's actually correct https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/random.nim#L332 |
16:29:20 | FromDiscord | <planetis> But why? |
16:29:40 | FromDiscord | <planetis> What's unsafe about it? |
16:30:21 | FromDiscord | <haxscramper> result value padding with zeroes or something like that |
16:32:13 | FromDiscord | <planetis> So? Seems just bad. Unless I am casting a negative signed type |
16:32:30 | FromDiscord | <planetis> (edit) "just bad." => "a little poignant." |
16:32:48 | FromDiscord | <planetis> (edit) "type" => "int." |
16:41:03 | * | ehmry quit (Ping timeout: 256 seconds) |
16:42:02 | NimEventer | New thread by Drkameleon: Recursively replace pair of bytes with one byte, within given byte array, see https://forum.nim-lang.org/t/9407 |
17:30:15 | FromDiscord | <konsumlamm> In reply to @planetis "What's unsafe about it?": it's UB, it's not padded with zeroes |
17:31:31 | FromDiscord | <konsumlamm> casting uses C `union`s, so the additional bits are uninitialized |
17:36:23 | FromDiscord | <domosokrat> @konsumlamm\: UB as defined for C? I.e. the C compiler can do what ever it wants ? |
17:47:18 | FromDiscord | <planetis> Wait really? I thought signed used sign extend and unsigned zero extend. |
17:47:57 | FromDiscord | <planetis> 🤯 |
17:51:22 | FromDiscord | <auxym> anyone has a opinion on naming a "nim bindings to {C library}" project? nim{library}? Or that's too boring? |
17:52:48 | FromDiscord | <Generic> last time I checked the generated C code for integer conversions it just uses plain C ones |
17:52:59 | FromDiscord | <Generic> so it should sign extend/zero extend |
17:53:41 | * | pro joined #nim |
17:53:47 | FromDiscord | <Phil> Nim bindings to tauri! |
17:54:13 | FromDiscord | <Phil> That's rust and but a c lib, but I kinda still want it and am afraid of bindings |
17:55:02 | FromDiscord | <Phil> (edit) "but" => "not" |
17:55:03 | FromDiscord | <auxym> is nim-rust FFI a thing? |
17:58:01 | FromDiscord | <Phil> It would likely go via rust offering a c ffi and Nim using that. That was the first approach the tauri devs thought of before saying they have no plans for nim bindings in the future since the idea doesn't seem to have much desire in their community↵↵>The integration will likely be done via a C FFI, similar to https://github.com/tauri-apps/tauri/tree/dev/examples/tauri-dynamic-lib |
17:59:45 | FromDiscord | <Generic> In reply to @auxym "anyone has a opinion": what I find fun, is adding an adjective |
18:00:29 | FromDiscord | <Generic> e.g. my libnx binding (not yet released) is called sunny nim libnx |
18:02:28 | * | pro quit (Quit: pro) |
18:10:37 | * | fredrikhr joined #nim |
18:17:31 | * | fredrikhr quit (Quit: Leaving) |
18:17:51 | * | fredrikhr joined #nim |
18:18:08 | * | fredrik92 joined #nim |
18:18:16 | * | fredrik92 quit (Client Quit) |
18:32:55 | FromDiscord | <Varriount> @Araq Let me know if you want me to stop using the "Requires Araq" labels on GitHub. |
18:41:37 | FromDiscord | <Araq> no, it's great. And sorry for not telling you about my holidays |
18:41:55 | FromDiscord | <Varriount> Nah, it's fine. I figured you were on vacation. |
18:42:07 | FromDiscord | <Araq> and before that I had Covid 🙂 |
19:00:07 | FromDiscord | <Require Support> have a string like this `my string!\r\n` when its printed using echo, how can i convert it to interpret the newline |
19:04:14 | FromDiscord | <Phil> It does that immediately, does it not for you? |
19:05:34 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=48rq |
19:07:16 | FromDiscord | <Require Support> oh ye nvm im dumb 🙂 thanks |
19:07:24 | FromDiscord | <aMOPel> In reply to @leorize "but it's possible to": It took a long time indeed so far https://github.com/aMOPel/tree-sitter-nim. It is kinda close to completion by now, though. Not missing a lot of features now. Admittedly to integrate the last language features, is getting harder. If you want to accelerate the process you are welcome to contribute. I put all the information on the readme and in issues. |
19:07:48 | FromDiscord | <aMOPel> (edit) "In reply to @leorize "but it's possible to": It took a long time indeed so far ... https://github.com/aMOPel/tree-sitter-nim." added "to write" |
19:40:02 | * | PMunch joined #nim |
19:43:45 | FromDiscord | <Forest> Does anyone know how I'm supposed to properly handle the Nim AST from a `PNode`? |
19:44:29 | FromDiscord | <Elegantbeef> That is the AST |
19:45:02 | FromDiscord | <Forest> Yeah i know |
19:46:56 | FromDiscord | <Forest> I'm asking how do i handle it properly? Since directly accessing any of the fields segfaults, and I don't see where procs and objects are defined/represented in the `TNode` object? |
19:47:30 | FromDiscord | <Elegantbeef> You have a nil Pnode if it segfaults when you access a field |
19:47:41 | FromDiscord | <Forest> Any field? |
19:48:27 | FromDiscord | <Forest> In that case I need to figure out how to find out if it's nil lol |
19:48:51 | FromDiscord | <Elegantbeef> `!= nil` is a very complex statement |
19:49:28 | FromDiscord | <Require Support> sent a code paste, see https://play.nim-lang.org/#ix=48rv |
19:49:35 | FromDiscord | <Require Support> (edit) "https://play.nim-lang.org/#ix=48rv" => "https://play.nim-lang.org/#ix=48rw" |
19:49:35 | FromDiscord | <Forest> I may be chronically stupid lmao, sorry beed |
19:49:37 | FromDiscord | <Forest> Beef |
19:49:53 | FromDiscord | <Phil> In reply to @Elegantbeef "`!= nil` is a": Heresy! There's an isNil proc! |
19:50:30 | FromDiscord | <Elegantbeef> There is, but conventionally people do `!= nil` and not `not a.isNil` |
19:50:38 | FromDiscord | <Phil> Double heresy! |
19:51:18 | FromDiscord | <Forest> Hm, is there no difference? |
19:51:57 | FromDiscord | <Elegantbeef> You arent seriously asking are you |
19:52:11 | FromDiscord | <Phil> In effect, no.↵It's a matter of programming style |
19:52:12 | FromDiscord | <Forest> Any |
19:52:28 | FromDiscord | <Prestige> not not isNil |
19:52:31 | FromDiscord | <Forest> I wouldn't think so, just wondering if there's any weird case where it matters lmao |
19:52:46 | FromDiscord | <Elegantbeef> Really make it dumb prestige |
19:52:51 | FromDiscord | <Elegantbeef> `not not isNil(a) != false` |
19:53:10 | FromDiscord | <Phil> Do we have an "isTrue" proc for expressions? |
19:53:29 | FromDiscord | <Elegantbeef> Make a unary `?!` for that |
19:53:35 | FromDiscord | <Elegantbeef> and is false \`!?\~ |
20:05:37 | * | fredrikhr quit (Ping timeout: 256 seconds) |
20:25:34 | FromDiscord | <Forest> Me, not understanding how to properly traverse the AST: Haha this is fine↵https://c.tenor.com/-kZOB16tELEAAAAM/this-is-fine-fire.gif |
20:26:18 | FromDiscord | <Elegantbeef> It's just a tree represented in a sequence of pointers |
20:26:22 | FromDiscord | <Elegantbeef> How complex could it be |
20:26:44 | FromDiscord | <Forest> To a dumbass just fucking around? Very lmao |
20:26:52 | FromDiscord | <Forest> Though it's fun to poke around internals |
20:27:00 | FromDiscord | <Forest> Hopefully I'll learn something (i already have so) |
20:28:18 | * | PMunch quit (Quit: leaving) |
20:30:15 | FromDiscord | <Forest> Hey I did learn something! If something segfaults, check if it's nil :D |
20:30:39 | FromDiscord | <Forest> Wait my module's ast is also nil what |
20:30:50 | FromDiscord | <Forest> Time to fuck around some more- |
20:31:17 | FromDiscord | <Elegantbeef> Look at the bright side after toying around the with the compiler you'll be a macro god |
20:31:37 | FromDiscord | <Forest> Lmao will i? |
20:31:52 | FromDiscord | <Forest> I mean, being a system makes it reaaaally hard to keep memory solid soooooo- |
20:31:53 | FromDiscord | <Elegantbeef> Macros are just user defined compiler extensions |
20:32:10 | FromDiscord | <Forest> (for anyone not sure what a system is, basically DID/OSDD) |
20:32:10 | FromDiscord | <Elegantbeef> Everything you do to a PNode is what a macro does |
20:32:20 | FromDiscord | <Forest> In reply to @Elegantbeef "Everything you do to": Huh that's neat |
20:36:00 | FromDiscord | <Forest> In reply to @Forest "Wait my module's ast": Why is all of the ASTs nil sob |
20:36:24 | FromDiscord | <Forest> `ast` field on `PSym` |
20:36:35 | FromDiscord | <Forest> Maybe I'm using the wrong param on graph (`ifaces`) |
20:36:52 | FromDiscord | <Elegantbeef> Cause symbols dont have AST associated with them iirc |
20:37:06 | FromDiscord | <Elegantbeef> Module symbols are more like an index if i recall correctly |
20:37:22 | FromDiscord | <Forest> Oh huh |
20:37:42 | FromDiscord | <Forest> Then how tf do i get `PNode`s from `ModuleGraph` lmao |
20:37:51 | FromDiscord | <Elegantbeef> No clue |
20:39:32 | FromDiscord | <Forest> Ah I don't think ModuleGraph preserves any file information (like file names), i was going through all the ifaces hoping to see file information too (i got file names but that's it) |
20:40:19 | FromDiscord | <Forest> Wait what |
20:40:24 | FromDiscord | <Forest> Where did i get that from |
20:40:36 | FromDiscord | <Forest> Uhhh i'ma see if iface preserves information because it should? |
20:43:50 | FromDiscord | <Forest> Doesn't look like a way to see defined procs hm |
20:45:46 | FromDiscord | <Forest> ModuleGraph does have a `methods` field? |
20:52:55 | FromDiscord | <Forest> Empty |
20:53:06 | FromDiscord | <Forest> Sob i understand nothing of jsgen.nim |
20:53:12 | FromDiscord | <Forest> reveal to me what you do! |
21:02:32 | FromDiscord | <Forest> So glad i decided to check matrix, I've been going about this in the wrong way lmao |
21:08:12 | FromDiscord | <Schelz> sent a code paste, see https://play.nim-lang.org/#ix=48rL |
21:08:37 | FromDiscord | <Elegantbeef> `proc something(data: pointer): bool {.importc.}` |
21:09:08 | FromDiscord | <Schelz> sent a code paste, see https://play.nim-lang.org/#ix=48rM |
21:09:18 | FromDiscord | <Elegantbeef> Does the procedure come from a header or library? |
21:09:53 | FromDiscord | <Schelz> proc something(yes: pointer): bool {.importcpp: "something (@)", header: "./path/file.h".} |
21:10:04 | FromDiscord | <Schelz> (edit) "proc something(yes: pointer): bool {.importcpp: "something (@)", header: "./path/file.h".}" => "sent a code paste, see https://play.nim-lang.org/#ix=" |
21:10:24 | FromDiscord | <Elegantbeef> That should just work then |
21:10:52 | FromDiscord | <Schelz> sent a code paste, see https://play.nim-lang.org/#ix=48rO |
21:11:44 | FromDiscord | <!!sharpcdf!!> In reply to @Ras "<@459463405636419594> zippy should now": it doesnt? |
21:11:45 | FromDiscord | <!!sharpcdf!!> weird |
21:11:51 | FromDiscord | <!!sharpcdf!!> oh you know what |
21:11:57 | FromDiscord | <!!sharpcdf!!> do i need to update it? |
21:16:22 | FromDiscord | <!!sharpcdf!!> yea i did |
21:16:28 | FromDiscord | <!!sharpcdf!!> `nimble install zippy` fixed it |
21:16:30 | FromDiscord | <!!sharpcdf!!> it works now |
21:16:30 | FromDiscord | <!!sharpcdf!!> wooo |
21:16:32 | FromDiscord | <!!sharpcdf!!> thank you |
21:18:57 | FromDiscord | <Schelz> sent a code paste, see https://play.nim-lang.org/#ix=48rQ |
22:22:30 | * | v9fk quit (Ping timeout: 268 seconds) |
22:24:39 | FromDiscord | <Sabena Sema> you'll wanna take a look at the actual generated C++ code |
22:25:04 | FromDiscord | <Sabena Sema> importcpp is "sloppy" in that nim doesn't really understand the C semantics, it just emits text into the generated code |
22:25:26 | FromDiscord | <Elegantbeef> To be fair can any one person understand the C++ semantics 😛 |
22:32:51 | FromDiscord | <auxym> yeah c++ devs probably just emit text until it seem to be working 😉 |
22:33:17 | FromDiscord | <Tuatarian> what's the easiest way to have one program talk to another? |
22:33:29 | FromDiscord | <Tuatarian> both running on the same machine |
22:33:53 | FromDiscord | <Tuatarian> what I was thinking was to have one launch the other |
22:34:05 | FromDiscord | <Tuatarian> and then read text output from the other program |
22:34:08 | FromDiscord | <Elegantbeef> Sockets, memory mapped memory, using it's stdin/stdout, loading one as a library |
22:34:21 | FromDiscord | <Tuatarian> memory mapped memory? |
22:34:29 | FromDiscord | <Elegantbeef> file |
22:34:33 | FromDiscord | <Elegantbeef> My mind do the breaky |
22:34:40 | FromDiscord | <Tuatarian> file is easiest I agree |
22:34:47 | FromDiscord | <Tuatarian> and is totally fine for my usecase btw |
22:34:50 | FromDiscord | <Elegantbeef> Sockets are easier ime |
22:35:04 | FromDiscord | <Tuatarian> do you have a link for learning about sockets? |
22:35:18 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/asyncnet.html |
22:35:18 | FromDiscord | <Tuatarian> https://nim-lang.org/docs/net.html |
22:36:11 | FromDiscord | <Tuatarian> thanks |
22:40:07 | FromDiscord | <Schelz> In reply to @Sabena Sema "importcpp is "sloppy" in": ok I will try to wrap it in C and import it in nim |
22:56:34 | FromDiscord | <auxym> In reply to @iWonderAboutTuatara "do you have a": this might help you understand how sockets work under the hood (and in C): https://beej.us/guide/bgnet/ |
22:57:17 | FromDiscord | <auxym> but for quick and easy IPC, I really like zeromq |
22:57:39 | FromDiscord | <auxym> there are nim bindings here: https://github.com/nim-lang/nim-zmq |
22:58:31 | FromDiscord | <auxym> it's a pretty simple library in concept, but it handles a bunch of stuff automatically for you that sockets won't (queuing, auto reconnect, etc) |
22:59:10 | FromDiscord | <auxym> good docs too, start here: https://zguide.zeromq.org/ |
23:00:22 | FromDiscord | <auxym> (you can probably stop at chap 2 or 3, unless you need something very specific) |
23:00:39 | FromDiscord | <auxym> (edit) "3, unless you need something very specific)" => "3 for simple use cases)" |
23:02:03 | FromDiscord | <!Patitotective> 👀 |
23:07:04 | FromDiscord | <Sabena Sema> In reply to @Schelz "ok I will try": well, I didn't mean importcpp was bad |
23:56:40 | * | ehmry joined #nim |