<< 23-08-2022 >>

00:13:36FromDiscord<Sabena Sema> I think it just relies on your local python installation since that's what it loads the python library from
00:13:49FromDiscord<Sabena Sema> if you compile it with the proper flags you should be able to link your own
00:13:54FromDiscord<Sabena Sema> or if you just applocal deploy the DSO
00:14:09FromDiscord<Elegantbeef> Is there any reason you want python above anything else?↵(@d4rckh)
00:17:27FromDiscord<Sabena Sema> it's probably a pretty good option
00:17:44FromDiscord<Sabena Sema> using nimscript with additional functions compiled in is a bit tricky I think
00:18:03FromDiscord<Elegantbeef> It's pretty simple
00:18:29FromDiscord<Elegantbeef> I'm very biased as i have nimscripter 😄
00:18:56FromDiscord<Elegantbeef> But yea depending on what you're after insert my WASM advertisement here
00:19:10FromDiscord<Sabena Sema> how does nimscripter work?
00:19:40FromDiscord<Elegantbeef> Adds text to the file and has a module to convert to/from the PNodes
00:19:59FromDiscord<Sabena Sema> oh, so the functions you export are evaluated by the VM
00:20:05FromDiscord<Sabena Sema> not linked into the interpreter and called directly
00:20:06FromDiscord<Elegantbeef> No
00:20:12FromDiscord<Sabena Sema> yeah, the second is what I would want
00:20:23FromDiscord<Elegantbeef> The functions you linked are called in native code
00:20:43FromDiscord<Elegantbeef> The VM has the ability to overload routines
00:20:57FromDiscord<Elegantbeef> I overload those routines and pass the data to the native Nim
00:21:34FromDiscord<Sabena Sema> through what mechanism?
00:21:50FromDiscord<Elegantbeef> The Nim VM's implementRoutine
00:22:26FromDiscord<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:47FromDiscord<Sabena Sema> OK yeah, that's kinda what I would expect then
00:23:36FromDiscord<Elegantbeef> It makes a module named "macrosport" and gives it types to paste into the nimscript. Also procedures to paste and override.
00:24:09FromDiscord<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:15FromDiscord<Elegantbeef> procedure signature\
00:24:24FromDiscord<Sabena Sema> sent a code paste, see https://play.nim-lang.org/#ix=48mF
00:24:39FromDiscord<Sabena Sema> Neither the full path or the filename, or ffi, or libffi-7, or libffi-7.dll, or libffi work
00:25:13FromDiscord<Elegantbeef> i'd wager `ffi-7`?
00:25:24FromDiscord<Sabena Sema> I _think_ I tried that, I'll try again
00:25:55FromDiscord<Elegantbeef> Perhaps it requires the entire path
00:26:00FromDiscord<Sabena Sema> tried that too
00:26:08FromDiscord<Elegantbeef> I do not really know, have never really used dynlib override
00:26:34FromDiscord<Sabena Sema> maybe I need some other path separator or escaping
00:26:56FromDiscord<Sabena Sema> I usually use dynlibOverrideAll, but for building the compiler that doesn't work
00:27:21FromDiscord<Sabena Sema> because for some reason `#import <Window.h>` ends up everywhere, and winlean has definitions that disagree
00:27:30FromDiscord<Sabena Sema> and fixing _that_ is somewhat complicated
00:28:05FromDiscord<Sabena Sema> is there a way to have nim emit `void` but treat the type as an `int` in nim code
00:30:05FromDiscord<Elegantbeef> Not that i know of
00:31:52FromDiscord<Sabena Sema> sigh , fixing that signature is a huge pain, there's a lot of explicitly comparing to -1 and such
00:32:10FromDiscord<Sabena Sema> and even if I do that idk if it would be mergeable upstream because it would break so much code
00:32:27FromDiscord<Sabena Sema> but honestly winlean shouldn't really be using dynlib _anyway_
00:32:43FromDiscord<Sabena Sema> it does `{.importc, dynlib: "kernel32.dll".}` for everything
00:32:49FromDiscord<Sabena Sema> which is just .... not really the best
00:40:07FromDiscord<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:28greyalien502how can i define a generic n-dimensional seq type and then write procedures that accept it?
01:03:46FromDiscord<treeform> In reply to @greyalien502 "how can i define": `seq[seq[T]]` ?
01:04:14greyalien502i mean where the depth is generic
01:05:19FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=48mN
01:10:14greyalien502@Elegantbeef, thanks, but then the dimension is not type checked at all.
01:10:26greyalien502i wanted something like:
01:10:27greyalien502proc 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:24FromDiscord<Elegantbeef> I cannot think of a way to do this
01:21:16FromDiscord<Elegantbeef> Actually might be able to use a concept
01:23:03*derpydoo quit (Ping timeout: 256 seconds)
01:42:23FromDiscord<Elegantbeef> greyalien502 this does kinda work https://play.nim-lang.org/#ix=48mQ
02:29:34greyalien502Elegantbeef, i'm not really understanding how this would be used.
02:31:00greyalien502i suppose i would need two functions, for NSeq[0, T] and one for NSeq[n, T] for n>0?
02:31:20greyalien502or maybe i can use a macro or something to check the value inside.
02:31:37FromDiscord<Elegantbeef> Yea a macro would be best here
02:34:43FromDiscord<Girvo> Something I'd love if it exists, is a way to search Nimble packages for proc type signatures lol
02:37:28FromDiscord<!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:57FromDiscord<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:20FromDiscord<Girvo> https://pursuit.purescript.org/ is an example 🙂
02:46:16FromDiscord<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:55FromDiscord<Rika> How would it work for macros that generate procs when fed a type
02:47:01FromDiscord<Rika> Or macros in general
02:48:32FromDiscord<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:21FromDiscord<Elegantbeef> I could see it working for any concrete procedure, but anything that requires instantiation would be quite difficult
02:51:48FromDiscord<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:27FromDiscord<Elegantbeef> It'd mostly just be working on the genrated doc search function
02:52:57FromDiscord<Elegantbeef> Change the functionality so `a -> b` searches for parameters of `a` that returns `b`
02:53:10FromDiscord<Girvo> Yeah. Even just a nimble-wide index of all that might have use.
02:53:34FromDiscord<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:13FromDiscord<Rika> I can imagine indexing being awful
03:30:28FromDiscord<!&luke> How can I read more than a line from stdin
03:30:50FromDiscord<Elegantbeef> stdin is a file so the same as any file
03:31:10FromDiscord<!&luke> How tho
03:31:16FromDiscord<!&luke> readFile doesn’t work
03:31:23FromDiscord<!&luke> As it expects a file path
03:31:49FromDiscord<Elegantbeef> https://nim-lang.org/docs/io.html
03:33:39FromDiscord<Rika> Read characters until you’re satisfied with all you’ve read
03:33:52FromDiscord<Rika> Use a while loop
03:59:43*xet7 quit (Quit: Leaving)
05:19:52FromDiscord<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:26madpropshttps://github.com/madprops/rumsfeld
05:39:54madpropscounterpart to this https://github.com/madprops/goldie
05:56:54FromDiscord<Phil> .... I just tried out intellij with its nim plugin, the auto complete is so much better it's not even funny
05:57:51FromDiscord<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:45FromDiscord<huantian> Is IntelliJ autocomplete really that good
05:58:55FromDiscord<huantian> Maybe I should try it idk if I still have clion installed
05:59:35FromDiscord<Bung> it maybe because of nimlsp
05:59:59FromDiscord<Elegantbeef> jetbrains made their own Nim tooling
06:00:01FromDiscord<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:05FromDiscord<Elegantbeef> It doesnt rely on nimsuggest
06:00:30FromDiscord<Bung> how do you know that
06:01:06FromDiscord<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:08FromDiscord<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:29FromDiscord<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:52FromDiscord<Girvo> In reply to @Elegantbeef "It doesnt rely on": Oh fascinating. Good on them at least, they do build nice tooling
06:03:18FromDiscord<Elegantbeef> I'd make a `type ImmString = distinct string`
06:04:04FromDiscord<Girvo> Oh yeah, not a bad idea
06:05:00FromDiscord<Phil> Oh, few, you can download the plugin
06:05:57FromDiscord<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:33FromDiscord<Phil> The pains of arch
06:09:09FromDiscord<Phil> Time to download tar.gz files from the intellij page and pray I guess
06:12:16PMunchPains of Arch?
06:12:51FromDiscord<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:20FromDiscord<Phil> Hmm the syntax highlighting is not quite what I'd want
06:23:44PMunchAah,
06:23:57PMunchYeah for proprietary stuff I guess it can be a bit tricky
06:25:56FromDiscord<Prestige> In reply to @Isofruit "intellij is not in": It's not?
06:26:27FromDiscord<Prestige> I see the community edition in `community` and `intellij-idea-ultimate-edition` in the AUR
06:26:31FromDiscord<Prestige> and some others
06:26:40FromDiscord<Phil> main repository, not AUR
06:26:49FromDiscord<Phil> Everything is in the AUR
06:27:04FromDiscord<Phil> I'm pretty sure if you search hard enough, Jesus is in the AUR
06:27:23FromDiscord<Prestige> `aur/foobar2000-component-jesus-bin` interesting, lol
06:27:31FromDiscord<Phil> Called it!
06:28:29FromDiscord<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:03FromDiscord<Phil> Now to figure out how I get intellij to compile my project on save
06:42:54FromDiscord<enthus1ast> https://github.com/Patitotective/ImTemplate looks amazing
06:43:12FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=48nK
06:43:13*PMunch quit (Quit: Leaving)
06:43:23FromDiscord<enthus1ast> Will try it for my next gui
06:43:31FromDiscord<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:28FromDiscord<flywind> Hcr doesn't work with ORC probably
06:45:34FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=48nN
06:45:55FromDiscord<enthus1ast> Waiting for the day koi will be ready....
06:46:12FromDiscord<Phil> In reply to @flywind "Hcr doesn't work with": Ohhhhhhhhh
06:46:44FromDiscord<Phil> I completely overlooked that flag
06:46:44FromDiscord<Elegantbeef> HCR doesnt work FTFY 😄
06:47:07*PMunch joined #nim
06:47:26FromDiscord<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:03FromDiscord<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:54FromDiscord<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:07FromDiscord<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:20FromDiscord<Phil> If anyone has good plugin suggestions I'm all open for it, currently only using filewatcher and the nim plugin
06:54:31FromDiscord<flywind> In reply to @Bung "my procA return ptr": probably a compiler bug
06:55:43FromDiscord<Bung> I have no idea, at the end of procA , I echo repr result just fine
06:56:19FromDiscord<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:51FromDiscord<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:21FromDiscord<Phil> In reply to @flywind "That plugin is closed": I previously had only syntax highlighting and build on save.
07:00:26FromDiscord<Elegantbeef> Are you by any chance returning a stack value?
07:01:15FromDiscord<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:16FromDiscord<Bung> no idea, am coming from web dev
07:01:37FromDiscord<Elegantbeef> Are you returning the address of a locally scoped variable?
07:01:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48nU
07:02:08FromDiscord<Elegantbeef> That's going to get you a dangling pointer and will likely result in faulty repr logic
07:02:09FromDiscord<Bung> `result = cast[ptr ICoreWebView2CreateCoreWebView2ControllerCompletedHandler](↵ alloc0(sizeof(ICoreWebView2CreateCoreWebView2ControllerCompletedHandler)))`
07:02:21FromDiscord<Elegantbeef> Wait until you learn of `create`
07:02:34FromDiscord<Bung> I can't return this ?
07:02:35FromDiscord<Elegantbeef> Also mother of java batman
07:02:41FromDiscord<Elegantbeef> you can return that
07:02:52FromDiscord<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:24FromDiscord<Bung> then what's going on the problem I described
07:04:43*PMunch quit (Client Quit)
07:05:25FromDiscord<Elegantbeef> A possible bug, or possible user error
07:05:26FromDiscord<Elegantbeef> Hard to say
07:06:12FromDiscord<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:58FromDiscord<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:48FromDiscord<Bung> https://media.discordapp.net/attachments/371759389889003532/1011532189395066921/2022-08-23_150724.png
07:08:22FromDiscord<Bung> line 59 works fine, 69 error
07:09:25FromDiscord<Elegantbeef> what's the code for that procedure?
07:11:16FromDiscord<Bung> https://github.com/bung87/webview2/blob/main/src/webview2/browser.nim see here
07:13:40FromDiscord<Elegantbeef> If i was good at guessing i'd say it's replated to the `stdcall` procs
07:14:24FromDiscord<Elegantbeef> That or the vtable stuff
07:15:08FromDiscord<flywind> BTW pragmas after the object is deprecated
07:15:11FromDiscord<flywind> `= object {.pure, inheritable.}`
07:15:27*PMunch joined #nim
07:16:33FromDiscord<Elegantbeef> Why'd you delete that fly arent you right?
07:17:09PMunchSorry to those select few who use IRC with join/leave messages enabled
07:17:31FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48nZ
07:17:41FromDiscord<Elegantbeef> Bung that's probably related to the issue
07:18:01FromDiscord<Elegantbeef> The pragma goes on the Type symbol not the object
07:18:15FromDiscord<Elegantbeef> Unacceptable pmunch
07:18:22FromDiscord<Elegantbeef> You'll be hearing from my lawyers
07:20:57FromDiscord<Bung> wait , still valid to compiler ?
07:21:06FromDiscord<Elegantbeef> Yea
07:21:06FromDiscord<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:34FromDiscord<Elegantbeef> I dont even think it's a bug that it compiles
07:21:39FromDiscord<Elegantbeef> It might be, but i dont know
07:21:58FromDiscord<Elegantbeef> Being able to put pragmas on that seems like something you may want to look at, but idk
07:23:09FromDiscord<Bung> okay, thanks ! I changed the syntax repr problem gone
07:27:21FromDiscord<d4rckh> In reply to @Elegantbeef "Is there any reason": Can I use anything else?
07:27:34FromDiscord<Elegantbeef> Depending what you're after
07:27:45FromDiscord<Elegantbeef> You can use the Nim Vm, Wasm, Lua, Wren,, Dascript, ...
07:29:03FromDiscord<Bung> is there a way to see more information when I call dll function encounter nil access ?
07:29:51FromDiscord<Elegantbeef> No
07:30:01FromDiscord<Elegantbeef> I mean you could use something like valgrind and that might help
07:31:24FromDiscord<d4rckh> I think i can use nim vm
07:35:24FromDiscord<Elegantbeef> You likely can, not going to suggest anything since i dont know what you're doing
07:36:02FromDiscord<d4rckh> I can use anything really
07:36:15FromDiscord<d4rckh> As long as I can run it at run time and call nim functions
07:36:51FromDiscord<d4rckh> Is there any library I can use for Nim VM?
07:38:02FromDiscord<Elegantbeef> https://github.com/beef331/nimscripter makes it relatively easy
07:38:14FromDiscord<Elegantbeef> Depending on the program i'm a big proponent of wasm
07:38:53FromDiscord<d4rckh> Looks good
07:38:55FromDiscord<Elegantbeef> It's just the best if you ever want users to write the code since they can use any language
07:41:52FromDiscord<Ras> how would one transform this into an if statement https://media.discordapp.net/attachments/371759389889003532/1011540764716707881/unknown.png
07:41:57FromDiscord<Ras> elegantly
07:43:07FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48oc
07:43:21FromDiscord<Elegantbeef> Dont get why you'd want to make it an if statement
07:43:22FromDiscord<Elegantbeef> But yea
07:44:02*arkurious joined #nim
07:45:21FromDiscord<Ras> it's a case statement with a single `of` and an `else`
07:45:32FromDiscord<Elegantbeef> So?
07:45:44FromDiscord<Ras> so... nothing, i guess
07:45:45FromDiscord<Elegantbeef> Case statements are more extensible if you ever want to specialise other branches
07:45:46FromDiscord<Ras> suppose you're right
07:46:50FromDiscord<Elegantbeef> I personally always prefer case statements when not dealing with booleans
07:55:48FromDiscord<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:24FromDiscord<Phil> That's a strength and adds clarity of what your intention is there
07:56:29FromDiscord<Ras> fair enough
08:20:13FromDiscord<enthus1ast> And if you not have an else case, it forces you to handle all cases
08:21:01FromDiscord<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:27FromDiscord<Elegantbeef> Think yes to string but no to int
08:21:31FromDiscord<Phil> Does motivate you to use enums when possible though
08:21:58FromDiscord<Elegantbeef> Or use subrange types
08:22:05FromDiscord<Phil> Which would make it more accurate again!
08:22:07FromDiscord<Phil> Win on all sides
08:23:31FromDiscord<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:55FromDiscord<Elegantbeef> You're very much alone and that doesnt represent the same thing
08:23:56FromDiscord<Ras> i mean, it's no big deal, and a matter of personal preference really
08:24:40FromDiscord<ShalokShalom (ShalokShalom)> How would I check, how many arguments has been passed in a shell execution
08:24:43FromDiscord<Phil> By and large yeah. In this specific scenario for sure
08:25:15FromDiscord<Phil> doesn't os have a proc?
08:25:21FromDiscord<ShalokShalom (ShalokShalom)> Like, I want to succeed, if the previous command had been used with one argument or more
08:25:35FromDiscord<ShalokShalom (ShalokShalom)> And quit the operation, if done with no arguments
08:26:10FromDiscord<Phil> If the previous command.... hm
08:27:13FromDiscord<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:19FromDiscord<Ras> semantically it reads as it's written
08:27:32FromDiscord<Elegantbeef> Causue you've got an array of ranges
08:27:33FromDiscord<Elegantbeef> Well slices
08:27:36FromDiscord<Ras> in my head, i have to transform a `case` ... `of` statement into what is going on
08:28:05FromDiscord<Elegantbeef> So now you can only specialise that branch for a range of characters
08:28:42FromDiscord<Elegantbeef> Due to the extensibility of case statements i cannot agree that an if statement is generally better
08:29:11FromDiscord<Ras> i'm not saying it's better at all from a language standpoint
08:29:25FromDiscord<Ras> if this is how it's done in nim then so be it, no biggie
08:29:31FromDiscord<Prestige> Would that alloc a new array?
08:29:51FromDiscord<Ras> i'm just saying that it's just a tad bit harder to read is all
08:30:05FromDiscord<Elegantbeef> It's a constant so it's not really an worrisome allocation
08:30:13FromDiscord<Prestige> cool, good to know
08:30:14FromDiscord<Elegantbeef> But yes it does create an array
08:33:42FromDiscord<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:07FromDiscord<Elegantbeef> What?
08:34:12FromDiscord<aruZeta> huh?
08:34:22FromDiscord<Ras> kind of hard to explain but like, `case [[if 1] [if 2]]` instead of just `[if 1] [if 2]`
08:34:25FromDiscord<Elegantbeef> If you indent the of branches you're doing it wrong
08:34:30FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48om
08:34:37FromDiscord<Ras> this isn't my code
08:34:40FromDiscord<Ras> it's treeform's
08:35:08FromDiscord<Elegantbeef> I didnt stutter
08:35:30FromDiscord<Elegantbeef> Yes that's a joke, it's my opinion that case should not have indented of branches
08:35:32FromDiscord<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:25FromDiscord<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:44FromDiscord<Elegantbeef> Not really cause the same semantics are represented
08:37:55FromDiscord<Elegantbeef> You can write code however you want of course
08:38:07FromDiscord<aruZeta> In reply to @Elegantbeef "You can write code": ^^
08:38:32FromDiscord<Ras> again, this isn't my code, i'm talking about when reading someone else's code
08:39:16FromDiscord<Elegantbeef> Well i disagree with the premise that `if` is "more readable"
08:39:16FromDiscord<Elegantbeef> So i guess i'll go in the corner and shush
08:39:24FromDiscord<Ras> In reply to @Elegantbeef "You can write code": also apparently not because i can't use an `if` statement... :p
08:39:29FromDiscord<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:01FromDiscord<Elegantbeef> Why cant you?↵(@Ras)
08:41:30FromDiscord<Ras> oh, apparently i can, i somehow missed the example you provided entirely
08:41:31FromDiscord<Ras> my bad
08:41:59FromDiscord<aruZeta> everything you can do with a `case` statement, you can do with an `if` too
08:42:07FromDiscord<aruZeta> but not the other way
08:42:22FromDiscord<Elegantbeef> If statement is very much less ergonomic
08:42:44FromDiscord<aruZeta> if you can use case, use it
08:42:49FromDiscord<aruZeta> (edit) "case," => "`case`,"
08:43:48FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48on
08:44:24FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48oo
08:44:35FromDiscord<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:43FromDiscord<Elegantbeef> `11..10` ah yes brain mush
08:45:00FromDiscord<Elegantbeef> Hey you do you
08:45:11FromDiscord<Elegantbeef> I never believe in never
08:45:17FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48op
08:45:24FromDiscord<Elegantbeef> Nop doesnt work
08:45:33FromDiscord<Elegantbeef> You cannot have `set[int]` so you'd have to manually range the types
08:45:38FromDiscord<aruZeta> ah right
08:45:44FromDiscord<aruZeta> forgot
08:45:53FromDiscord<aruZeta> (edit) "forgot" => "forgot, too much int8-16"
08:46:42FromDiscord<Ras> In reply to @Elegantbeef "I never believe in": a boolean can never have three possible values :p
08:46:51FromDiscord<Ras> which is the case i'm trying to describe here
08:47:30FromDiscord<Elegantbeef> Hey i'll bikeshed it into a trioolean
08:48:00FromDiscord<aruZeta> what about a boolean stored in a qubit
08:48:11FromDiscord<Elegantbeef> It's still just a boolean
08:48:19FromDiscord<Elegantbeef> It's just entangled with another bit
08:48:30FromDiscord<Ras> In reply to @Elegantbeef "Hey i'll bikeshed it": does Nim run on the Seturn
08:48:38FromDiscord<Ras> (edit) "Seturn" => "Setun"
08:48:42FromDiscord<Elegantbeef> The Gesa saturn?
08:49:01FromDiscord<Ras> Setun, dunno if the bridge shows edits
08:49:05FromDiscord<Ras> https://en.wikipedia.org/wiki/Setun
08:49:07FromDiscord<Elegantbeef> It does
08:49:12FromDiscord<Elegantbeef> I know the trinary computer
08:51:08FromDiscord<Elegantbeef> To change the phrasing of this conversation, i'd probably make a procedure named `isWhateverImChecking` then do `if a.isWhateverImChecking`
08:51:22FromDiscord<Elegantbeef> But i generally write procedures a lot to compartmentalise logic
09:24:20FromDiscord<Schelz> sent a code paste, see https://play.nim-lang.org/#ix=48oD
09:32:35PMunchJust use `pointer` as the type
09:32:51PMunch`proc thisFunc(myvoid: pointer)`
09:47:27FromDiscord<Schelz> uh I thought thats only for void pointers
09:47:37FromDiscord<Schelz> but thx
09:48:54FromDiscord<4zv4l> does Nim provide tail recursion optimization ?
09:54:15FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=48oN
09:59:26FromDiscord<Ras> wouldn't tail call recursion never happen here anyways? concat happens after the recursive call
09:59:36FromDiscord<Ras> so it has to keep track of the stack
09:59:56FromDiscord<Ras> (edit) "so it has to keep track of the ... stack" added "values on the"
10:00:56FromDiscord<Ras> oh also @4zv4l: https://github.com/treeform/urlly/pull/6
10:37:58PMunch@Schelz, LPVOID is just an alias for a void pointer :)
10:39:08PMunchBut 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:16PMunchOf course nowadays I just use Futhark :)
10:40:03PMunch@Ras, yup that wouldn't be tail-call recursion
10:40:47PMunchAnd @4zv4l Nim doesn't provide tail recursion optimizations AFAIK, but it passes it on to GCC which does
10:42:06FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48p2
10:43:06FromDiscord<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:15FromDiscord<aruZeta> (edit) "proc" => "seq"
10:43:43PMunchHmm, it's certainly possible
10:43:43FromDiscord<aruZeta> (edit) "someVals`" => "someVals[n]`" | "n" => "m"
10:43:57PMunchBut maybe not in a pretty way..
10:44:15FromDiscord<Rika> Capacity or length
10:44:20PMunchAny particular reason why you'd want them to have capacity 3?
10:44:20FromDiscord<aruZeta> cap
10:44:31FromDiscord<aruZeta> just because i think that will make the seqs lighter
10:44:40FromDiscord<Rika> In what context
10:44:44PMunchUhm, it would make them heavier..
10:44:44FromDiscord<Rika> Desktop or embedded
10:44:54FromDiscord<aruZeta> In reply to @PMunch "Any particular reason why": because in the example the hightest len is 3
10:45:14PMunchA seq like that would be initialised to have the cap and length equal to each other
10:45:25FromDiscord<aruZeta> im just guessing a seq's default cap is quite big
10:45:32PMunchSo unless you plan on adding to them then there's no problem
10:45:32FromDiscord<aruZeta> In reply to @PMunch "A seq like that": oh
10:45:39FromDiscord<aruZeta> then that's good
10:45:40FromDiscord<Rika> In reply to @PMunch "A seq like that": Is that really true?
10:45:45PMunchAh, yes the default is pretty big, but that doesn't apply to literals IIRC
10:45:53FromDiscord<aruZeta> nice
10:45:55FromDiscord<aruZeta> (edit) "nice ... " added "then"
10:48:04PMunchhttps://play.nim-lang.org/#ix=48p3 < @Rika, yup
10:48:27PMunch(There really should be a nice read-only way to get the capacity of a seq..)
10:48:44FromDiscord<aruZeta> In reply to @PMunch "(There really should be": +1 to this
10:49:44FromDiscord<aruZeta> ty PMunch :3
10:53:24PMunchNo problem :)
10:53:33FromDiscord<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:49FromDiscord<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:00FromDiscord<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:25FromDiscord<noiryuh> how do i extract a zip with password in Nim
10:57:31FromDiscord<noiryuh> libzip seems like unmaintained
10:58:15FromDiscord<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:32FromDiscord<noiryuh> but i don't know what kind of encryption does zip file use
11:00:20PMunchApparently the most basic one is called ZipCrypto and is seriously flawed :P
11:02:10PMunchYou can probably use libzip with Futhark though
11:15:52FromDiscord<noiryuh> i'll take a look later
11:17:15FromDiscord<Forest> Hey PMunch since you're here, is there a way to turned off the numbered identifiers? :P
11:18:35PMunchNope
11:18:42PMunchThey're a feature
11:18:53PMunchI'm going to investigate if they have to be exported
11:19:08PMunchOtherwise they can be made private and therefore not show up in auto-complete
11:20:49FromDiscord<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:09FromDiscord<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:25PMunchYeah I guess if you autocomplete to one of those it would add that as an import
11:21:43FromDiscord<noiryuh> In reply to @PMunch "Apparently the most basic": thank you for this
11:22:00FromDiscord<Phil> In reply to @PMunch "Yeah I guess if": It doesn't fascinatingly
11:22:15PMunchHuh, well that's a bummer
11:22:18FromDiscord<Phil> You have to import yourself
11:22:28FromDiscord<noiryuh> searching for "Zip decrypting method" yells ~~"how to brute force Zip password with this simple app, bla bla bla"~~
11:22:49FromDiscord<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:59PMunchHaha, 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:48FromDiscord<noiryuh> btw, does stdlib/json parse json with trailing comma?
11:25:19FromDiscord<noiryuh> because the json content has trailing comma (and string number)
11:28:34PMunch!eval import json; echo parseJson("[123,]")
11:28:39NimBotCompile failed: [123]
11:28:52FromDiscord<Rika> Looks like it does
11:28:57FromDiscord<Rika> Even if it’s not standard lol
11:29:11FromDiscord<domosokrat> @noiryuh\: If it has trailing commas then it's not valid json
11:29:39FromDiscord<Rika> In reply to @domosokrat "<@998188037026627696>\: If it has": Well that’s not what he asked
11:29:47FromDiscord<noiryuh> welp, the problem is it not mine
11:29:55FromDiscord<noiryuh> and it's from game data
11:30:04FromDiscord<noiryuh> it's illegal btw
11:30:24FromDiscord<noiryuh> i can't ask them to produce a valid json file :)
11:31:26FromDiscord<Rika> What do you mean by illegal, what you’re doing?
11:31:36FromDiscord<domosokrat> rika\: I know. I was just to slow. I wanted to dampen the expectations. But it seems that was not neccessary
11:31:37FromDiscord<noiryuh> game data mining
11:32:04FromDiscord<Rika> I’d personally say that’s grey area
11:32:13FromDiscord<noiryuh> the character information was encrypted in a file in an encrypted zip file
11:32:27FromDiscord<noiryuh> and they also stated that data mining is prohibited
11:33:17FromDiscord<noiryuh> my current script is hardcoded and work for me on linux
11:33:36FromDiscord<noiryuh> but i want to give some others the script when i'm busy
11:42:22FromDiscord<noiryuh> 🤔
11:44:31FromDiscord<noiryuh> sent a long message, see http://ix.io/48pa
11:44:49FromDiscord<Rika> Async wouldn’t help with decryption because it is CPU bound I believe
11:45:07FromDiscord<Rika> String numbers are just strings
11:45:13FromDiscord<noiryuh> i mean, multiple file decrypting
11:45:25FromDiscord<Rika> Multiple sure, parallel I don’t think so
11:45:32FromDiscord<noiryuh> because there are like > 1000 files
11:45:43FromDiscord<noiryuh> which simply need aes128-cbc decrypting
11:47:14FromDiscord<Bung> does it a good idea to reimplment a dll in nim when cant known why dll function call fails ?
11:50:06PMunchProbably not
11:50:09PMunchBetter to debug it
11:50:26PMunchTotally depends on the DLL though
11:51:07FromDiscord<Bung> dont know how to debug it , I only get nil access
11:51:35PMunchHmm, 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:00PMunchOh and a script gathering sensor data that is put into files and served up by the jester page
11:52:37PMunchBut I want to move to some kind of event system
11:53:58PMunchHmm, 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:20PMunchThings happening on a timed schedule would simply listen for the time tick event
11:54:58FromDiscord<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:07FromDiscord<b1rdf00d> (edit) "though)," => "thought),"
11:56:50PMunchHaha, that would actually be pretty cool
11:57:14PMunchIf we only had better support for functional data structures in Nim..
11:57:35PMunchI know I should've implemented persistent dictionaries back when I did the vectors..
11:57:56PMunch(they are basically a table which returns a new table whenever you insert a key)
11:58:03FromDiscord<Rika> Event driven is just “push instead of polll
11:58:06FromDiscord<Rika> (edit) "polll" => "poll”"
11:58:34PMunchYup
11:59:11PMunchHmm, I guess I could hack it with filesystem monitoring and bash scripts..
11:59:33PMunchIt wouldn't be a pretty system, but it would work for what I need it to do right now
12:00:46FromDiscord<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:24FromDiscord<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:19FromDiscord<b1rdf00d> (edit) "features?" => "features (in your own code)?"
12:08:35FromDiscord<Rika> What do you mean
12:09:01FromDiscord<Rika> Nim just doesn’t have the features for some stuff (that isn’t macro implementable)
12:09:45PMunchIt's mostly a library thing
12:10:21PMunchYou often don't get the full benefit of functional programming without going fully functional though
12:10:50PMunchBut 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:42PMunchAnd 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:11PMunchBut yeah, driving the house based on state-changes was basically the idea
12:12:12FromDiscord<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:50PMunchBut 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:06PMunchI 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:15FromDiscord<b1rdf00d> that's interesting, would you try to merge conflicting states?
12:14:28PMunchThere is a similar way to implement dictionaries, but I never got around to implement that
12:14:35PMunchWhat do you mean?
12:17:19FromDiscord<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:06PMunchWell the idea is that the state can only be changed through events
12:18:29PMunchSo lets say you open a door, that updates the state and fires the "state changed: door" event
12:18:46PMunchThat event carries the entire global state, including the door being open
12:19:51PMunchSo 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:23PMunchAah, I think I see what you mean
12:20:25FromDiscord<b1rdf00d> yep that makes sense
12:21:40FromDiscord<b1rdf00d> I think I'm thinking concurrent + parallel with no guarantees for how events are processed
12:21:49PMunchWhat 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:16PMunchHmm
12:22:33FromDiscord<b1rdf00d> yeah exactly, what happens if you shut a door and turn on a light _at the same time_
12:23:14FromDiscord<b1rdf00d> but if your events are non-blocking and there's only 1 thread I think there's no issue?
12:23:42PMunchwell, there might still be logic issues
12:24:15FromDiscord<4zv4l> is TCC better than GCC ? or which c compiler is better overall ?
12:24:33PMunchThere is no compiler which is better overall, they all have tradeoffs
12:25:03PMunchTCC is faster at compiling, but produces slower binaries and has less feature support
12:25:25NimEventerNew thread by Chaemon: Precompiled header in Nim, see https://forum.nim-lang.org/t/9405
12:27:19FromDiscord<4zv4l> so for smaller and faster gcc is better ?
12:27:45FromDiscord<b1rdf00d> you could try with your code and see?
12:28:02FromDiscord<b1rdf00d> (if clang is in the mix)
12:28:36PMunchSo 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:37PMunchThis 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:49PMunchWell, I guess it all depends on how events and state are handled..
12:29:31PMunchIf events are queued but state changed immediately I think it might work fine
12:29:49PMunchAh no, that might invalidate the event..
12:30:01PMunchWell, maybe not
12:30:35PMunchI 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:45PMunch@4zv4l, benchmarking is always the answer
12:31:34FromDiscord<b1rdf00d> yeah the hard part is your house can't physically instantly change state
12:31:39PMunchThere 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:04PMunch@b1rdf00d, hmm, that's true
12:32:09FromDiscord<b1rdf00d> Are you going to use sensors?
12:32:21PMunchI already have sensors
12:32:42FromDiscord<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:48PMunchCurrently I have a temperature and humidity sensor, but I'm also going to add some air-quality sensors
12:33:16FromDiscord<noiryuh> `std/json` seems not have any problem with trailing comma, which is a good thing
12:33:31PMunchI'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:34FromDiscord<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:03FromDiscord<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:19FromDiscord<b1rdf00d> I think if your state changes are atomic then your events won't trip them up?
12:38:42PMunchWell 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:10PMunchBut if events only supply the whole state and the address of the field that changed then you'd be fine
12:41:07PMunchYeah 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:55PMunchThe 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:38PMunchUgh, silly CMS breaks every time I upgrade my server
13:21:21*derpydoo joined #nim
13:59:36NimEventerNew 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:24FromDiscord<retkid> how to do i define variables for the scope in a template again
14:34:25FromDiscord<retkid> ;-;
14:37:57FromDiscord<retkid> @Rika i saw you doing this
14:41:27FromDiscord<Rika> What do you mean again
14:41:34FromDiscord<Rika> (edit) removed "again"
14:55:53FromDiscord<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:29NimEventerNew Nimble package! NimNN - Neural Networks from scratch, see https://github.com/xcodz-dot/NimNN
15:16:39FromDiscord<aruZeta> In reply to @retkid "how to do i": do you mean `{.dirty.}`
15:23:40FromDiscord<auxym> or {.inject.}
15:23:58FromDiscord<auxym> dirty like makes everything bind/inject by default
15:25:22FromDiscord<auxym> In reply to @Require Support "anything in nim that": this i think? https://nim-lang.org/docs/os.html#parseCmdLine%2Cstring
15:26:11FromDiscord<Require Support> yep looks like it
15:50:32NimEventerNew 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:53FromDiscord<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:25FromDiscord<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:10FromDiscord<planetis> Oh wait it's actually correct https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/random.nim#L332
16:29:20FromDiscord<planetis> But why?
16:29:40FromDiscord<planetis> What's unsafe about it?
16:30:21FromDiscord<haxscramper> result value padding with zeroes or something like that
16:32:13FromDiscord<planetis> So? Seems just bad. Unless I am casting a negative signed type
16:32:30FromDiscord<planetis> (edit) "just bad." => "a little poignant."
16:32:48FromDiscord<planetis> (edit) "type" => "int."
16:41:03*ehmry quit (Ping timeout: 256 seconds)
16:42:02NimEventerNew 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:15FromDiscord<konsumlamm> In reply to @planetis "What's unsafe about it?": it's UB, it's not padded with zeroes
17:31:31FromDiscord<konsumlamm> casting uses C `union`s, so the additional bits are uninitialized
17:36:23FromDiscord<domosokrat> @konsumlamm\: UB as defined for C? I.e. the C compiler can do what ever it wants ?
17:47:18FromDiscord<planetis> Wait really? I thought signed used sign extend and unsigned zero extend.
17:47:57FromDiscord<planetis> 🤯
17:51:22FromDiscord<auxym> anyone has a opinion on naming a "nim bindings to {C library}" project? nim{library}? Or that's too boring?
17:52:48FromDiscord<Generic> last time I checked the generated C code for integer conversions it just uses plain C ones
17:52:59FromDiscord<Generic> so it should sign extend/zero extend
17:53:41*pro joined #nim
17:53:47FromDiscord<Phil> Nim bindings to tauri!
17:54:13FromDiscord<Phil> That's rust and but a c lib, but I kinda still want it and am afraid of bindings
17:55:02FromDiscord<Phil> (edit) "but" => "not"
17:55:03FromDiscord<auxym> is nim-rust FFI a thing?
17:58:01FromDiscord<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:45FromDiscord<Generic> In reply to @auxym "anyone has a opinion": what I find fun, is adding an adjective
18:00:29FromDiscord<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:55FromDiscord<Varriount> @Araq Let me know if you want me to stop using the "Requires Araq" labels on GitHub.
18:41:37FromDiscord<Araq> no, it's great. And sorry for not telling you about my holidays
18:41:55FromDiscord<Varriount> Nah, it's fine. I figured you were on vacation.
18:42:07FromDiscord<Araq> and before that I had Covid 🙂
19:00:07FromDiscord<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:14FromDiscord<Phil> It does that immediately, does it not for you?
19:05:34FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=48rq
19:07:16FromDiscord<Require Support> oh ye nvm im dumb 🙂 thanks
19:07:24FromDiscord<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:48FromDiscord<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:45FromDiscord<Forest> Does anyone know how I'm supposed to properly handle the Nim AST from a `PNode`?
19:44:29FromDiscord<Elegantbeef> That is the AST
19:45:02FromDiscord<Forest> Yeah i know
19:46:56FromDiscord<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:30FromDiscord<Elegantbeef> You have a nil Pnode if it segfaults when you access a field
19:47:41FromDiscord<Forest> Any field?
19:48:27FromDiscord<Forest> In that case I need to figure out how to find out if it's nil lol
19:48:51FromDiscord<Elegantbeef> `!= nil` is a very complex statement
19:49:28FromDiscord<Require Support> sent a code paste, see https://play.nim-lang.org/#ix=48rv
19:49:35FromDiscord<Require Support> (edit) "https://play.nim-lang.org/#ix=48rv" => "https://play.nim-lang.org/#ix=48rw"
19:49:35FromDiscord<Forest> I may be chronically stupid lmao, sorry beed
19:49:37FromDiscord<Forest> Beef
19:49:53FromDiscord<Phil> In reply to @Elegantbeef "`!= nil` is a": Heresy! There's an isNil proc!
19:50:30FromDiscord<Elegantbeef> There is, but conventionally people do `!= nil` and not `not a.isNil`
19:50:38FromDiscord<Phil> Double heresy!
19:51:18FromDiscord<Forest> Hm, is there no difference?
19:51:57FromDiscord<Elegantbeef> You arent seriously asking are you
19:52:11FromDiscord<Phil> In effect, no.↵It's a matter of programming style
19:52:12FromDiscord<Forest> Any
19:52:28FromDiscord<Prestige> not not isNil
19:52:31FromDiscord<Forest> I wouldn't think so, just wondering if there's any weird case where it matters lmao
19:52:46FromDiscord<Elegantbeef> Really make it dumb prestige
19:52:51FromDiscord<Elegantbeef> `not not isNil(a) != false`
19:53:10FromDiscord<Phil> Do we have an "isTrue" proc for expressions?
19:53:29FromDiscord<Elegantbeef> Make a unary `?!` for that
19:53:35FromDiscord<Elegantbeef> and is false \`!?\~
20:05:37*fredrikhr quit (Ping timeout: 256 seconds)
20:25:34FromDiscord<Forest> Me, not understanding how to properly traverse the AST: Haha this is finehttps://c.tenor.com/-kZOB16tELEAAAAM/this-is-fine-fire.gif
20:26:18FromDiscord<Elegantbeef> It's just a tree represented in a sequence of pointers
20:26:22FromDiscord<Elegantbeef> How complex could it be
20:26:44FromDiscord<Forest> To a dumbass just fucking around? Very lmao
20:26:52FromDiscord<Forest> Though it's fun to poke around internals
20:27:00FromDiscord<Forest> Hopefully I'll learn something (i already have so)
20:28:18*PMunch quit (Quit: leaving)
20:30:15FromDiscord<Forest> Hey I did learn something! If something segfaults, check if it's nil :D
20:30:39FromDiscord<Forest> Wait my module's ast is also nil what
20:30:50FromDiscord<Forest> Time to fuck around some more-
20:31:17FromDiscord<Elegantbeef> Look at the bright side after toying around the with the compiler you'll be a macro god
20:31:37FromDiscord<Forest> Lmao will i?
20:31:52FromDiscord<Forest> I mean, being a system makes it reaaaally hard to keep memory solid soooooo-
20:31:53FromDiscord<Elegantbeef> Macros are just user defined compiler extensions
20:32:10FromDiscord<Forest> (for anyone not sure what a system is, basically DID/OSDD)
20:32:10FromDiscord<Elegantbeef> Everything you do to a PNode is what a macro does
20:32:20FromDiscord<Forest> In reply to @Elegantbeef "Everything you do to": Huh that's neat
20:36:00FromDiscord<Forest> In reply to @Forest "Wait my module's ast": Why is all of the ASTs nil sob
20:36:24FromDiscord<Forest> `ast` field on `PSym`
20:36:35FromDiscord<Forest> Maybe I'm using the wrong param on graph (`ifaces`)
20:36:52FromDiscord<Elegantbeef> Cause symbols dont have AST associated with them iirc
20:37:06FromDiscord<Elegantbeef> Module symbols are more like an index if i recall correctly
20:37:22FromDiscord<Forest> Oh huh
20:37:42FromDiscord<Forest> Then how tf do i get `PNode`s from `ModuleGraph` lmao
20:37:51FromDiscord<Elegantbeef> No clue
20:39:32FromDiscord<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:19FromDiscord<Forest> Wait what
20:40:24FromDiscord<Forest> Where did i get that from
20:40:36FromDiscord<Forest> Uhhh i'ma see if iface preserves information because it should?
20:43:50FromDiscord<Forest> Doesn't look like a way to see defined procs hm
20:45:46FromDiscord<Forest> ModuleGraph does have a `methods` field?
20:52:55FromDiscord<Forest> Empty
20:53:06FromDiscord<Forest> Sob i understand nothing of jsgen.nim
20:53:12FromDiscord<Forest> reveal to me what you do!
21:02:32FromDiscord<Forest> So glad i decided to check matrix, I've been going about this in the wrong way lmao
21:08:12FromDiscord<Schelz> sent a code paste, see https://play.nim-lang.org/#ix=48rL
21:08:37FromDiscord<Elegantbeef> `proc something(data: pointer): bool {.importc.}`
21:09:08FromDiscord<Schelz> sent a code paste, see https://play.nim-lang.org/#ix=48rM
21:09:18FromDiscord<Elegantbeef> Does the procedure come from a header or library?
21:09:53FromDiscord<Schelz> proc something(yes: pointer): bool {.importcpp: "something (@)", header: "./path/file.h".}
21:10:04FromDiscord<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:24FromDiscord<Elegantbeef> That should just work then
21:10:52FromDiscord<Schelz> sent a code paste, see https://play.nim-lang.org/#ix=48rO
21:11:44FromDiscord<!!sharpcdf!!> In reply to @Ras "<@459463405636419594> zippy should now": it doesnt?
21:11:45FromDiscord<!!sharpcdf!!> weird
21:11:51FromDiscord<!!sharpcdf!!> oh you know what
21:11:57FromDiscord<!!sharpcdf!!> do i need to update it?
21:16:22FromDiscord<!!sharpcdf!!> yea i did
21:16:28FromDiscord<!!sharpcdf!!> `nimble install zippy` fixed it
21:16:30FromDiscord<!!sharpcdf!!> it works now
21:16:30FromDiscord<!!sharpcdf!!> wooo
21:16:32FromDiscord<!!sharpcdf!!> thank you
21:18:57FromDiscord<Schelz> sent a code paste, see https://play.nim-lang.org/#ix=48rQ
22:22:30*v9fk quit (Ping timeout: 268 seconds)
22:24:39FromDiscord<Sabena Sema> you'll wanna take a look at the actual generated C++ code
22:25:04FromDiscord<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:26FromDiscord<Elegantbeef> To be fair can any one person understand the C++ semantics 😛
22:32:51FromDiscord<auxym> yeah c++ devs probably just emit text until it seem to be working 😉
22:33:17FromDiscord<Tuatarian> what's the easiest way to have one program talk to another?
22:33:29FromDiscord<Tuatarian> both running on the same machine
22:33:53FromDiscord<Tuatarian> what I was thinking was to have one launch the other
22:34:05FromDiscord<Tuatarian> and then read text output from the other program
22:34:08FromDiscord<Elegantbeef> Sockets, memory mapped memory, using it's stdin/stdout, loading one as a library
22:34:21FromDiscord<Tuatarian> memory mapped memory?
22:34:29FromDiscord<Elegantbeef> file
22:34:33FromDiscord<Elegantbeef> My mind do the breaky
22:34:40FromDiscord<Tuatarian> file is easiest I agree
22:34:47FromDiscord<Tuatarian> and is totally fine for my usecase btw
22:34:50FromDiscord<Elegantbeef> Sockets are easier ime
22:35:04FromDiscord<Tuatarian> do you have a link for learning about sockets?
22:35:18FromDiscord<Elegantbeef> https://nim-lang.org/docs/asyncnet.html
22:35:18FromDiscord<Tuatarian> https://nim-lang.org/docs/net.html
22:36:11FromDiscord<Tuatarian> thanks
22:40:07FromDiscord<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:34FromDiscord<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:17FromDiscord<auxym> but for quick and easy IPC, I really like zeromq
22:57:39FromDiscord<auxym> there are nim bindings here: https://github.com/nim-lang/nim-zmq
22:58:31FromDiscord<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:10FromDiscord<auxym> good docs too, start here: https://zguide.zeromq.org/
23:00:22FromDiscord<auxym> (you can probably stop at chap 2 or 3, unless you need something very specific)
23:00:39FromDiscord<auxym> (edit) "3, unless you need something very specific)" => "3 for simple use cases)"
23:02:03FromDiscord<!Patitotective> 👀
23:07:04FromDiscord<Sabena Sema> In reply to @Schelz "ok I will try": well, I didn't mean importcpp was bad
23:56:40*ehmry joined #nim