<< 08-08-2022 >>

00:51:53FromDiscord<Forest> Question, how do i try and attempt to understand the absolutely dreadful futhark code generated? Lmao
00:52:15FromDiscord<Elegantbeef> You dont, you write the code as it was C and never look at it unless you run into a bug
00:52:20FromDiscord<Elegantbeef> It's a really big pain spot for futhark imo
00:53:17FromDiscord<Forest> Rip, need to make clean nim-like bindings for it
00:54:05FromDiscord<leorize> you can wrap the wrapped C api generated from futhark
00:54:16FromDiscord<Elegantbeef> Yea i alrready mentioned that twice now
00:54:49FromDiscord<leorize> you can look at https://github.com/alaviss/kmod for something that does that, though with a different (now unmaintained) project
00:54:51FromDiscord<Forest> In reply to @leorize "you can wrap the": Yeah that's what we're doing
00:54:59FromDiscord<Forest> But it's just messy as fuck to understand lmao
00:55:07FromDiscord<Elegantbeef> It is indeed
00:55:25FromDiscord<Elegantbeef> The output of c2nim is much more concrete but also requires more work
00:55:34FromDiscord<Forest> Thanks aha
00:55:38FromDiscord<Forest> In reply to @Elegantbeef "The output of c2nim": Yeahhh fair
00:55:54FromDiscord<Forest> Wgpu will be a pain to get full coverage for tbh..
00:55:57FromDiscord<Elegantbeef> There's also that wasmedge program for reference aswell
00:56:08FromDiscord<Forest> Oh yeah, how do nim projects generate docs?
00:56:16FromDiscord<Forest> Seen em before but idk how they work
00:56:20FromDiscord<Elegantbeef> `nim doc`
00:56:41FromDiscord<Elegantbeef> All `##` are doc comments and are included in the generated docs
00:58:08FromDiscord<Forest> Ah thanks!
00:58:12FromDiscord<Forest> On the same line as the code?
00:58:26FromDiscord<Forest> Do multiline also work with `##[ ]##` or?
00:58:32FromDiscord<Elegantbeef> Yes
00:58:41FromDiscord<Elegantbeef> Depends on what the thing is but generally next or same line is fine
00:58:58FromDiscord<Forest> Sweet, thanks!
00:59:06FromDiscord<Elegantbeef> https://nim-lang.org/docs/docgen.html
01:00:09FromDiscord<Forest> Thanks!
01:14:24*pch quit (Read error: Connection reset by peer)
01:15:42FromDiscord<Tuatarian> are there any possible issues that could arise from using `type u8 = uint8` ?
01:15:53FromDiscord<Tuatarian> I'm getting kinda annoying having to type out the 5 letters each time
01:15:59FromDiscord<Elegantbeef> No there isnt
01:16:03FromDiscord<Elegantbeef> That's what type aliases are there for
01:17:04*pch joined #nim
01:21:24FromDiscord<!Patitotective> In reply to @iWonderAboutTuatara "are there any possible": use `byte`
01:21:37FromDiscord<!Patitotective> 4 letters only lmao
01:22:40FromDiscord<Elegantbeef> Alternatively stop tying uint8 so much
01:25:53FromDiscord<Tuatarian> I kinda need to since refactoring :(
01:29:29FromDiscord<Elegantbeef> I dont see why you need to type it a lot
01:29:46FromDiscord<Elegantbeef> Like how many functions are you making
01:33:38FromDiscord<Tuatarian> I have a pretty good number of functions
01:33:53FromDiscord<Tuatarian> it's mostly because refactoring though
02:11:56FromDiscord<Forest> What would be the best way to write `WGPUNativeSType` in Nim?
02:12:05FromDiscord<Forest> Also, what does S Type even mean? Lmao
02:12:10FromDiscord<Forest> Don't think understand C well
02:12:18FromDiscord<Elegantbeef> Read the webgpu docs then
02:13:31FromDiscord<Forest> There's no docs for WGPU-Native
02:13:54FromDiscord<Forest> Also, it's different to `WebGPU`, based on the standard but it's it's own thing
02:18:51FromDiscord<Elegantbeef> Refer to the C source then
02:19:32FromDiscord<Forest> Doesn't explain what it does
02:19:50FromDiscord<Forest> Just says it starts at 6 to prevent collisions
02:23:24pchwhat languages can nim be sent through?
02:23:40FromDiscord<Prestige> What do you mean?
02:23:54FromDiscord<Elegantbeef> Think they mean what backends does it have
02:23:55FromDiscord<Elegantbeef> C/C++/JS/Nimscript
02:23:57pchI am writing an OS and do not want it to be C-first, but I like nim too much to do all of my opening userspace work without it easy
02:24:02pchaw crap
02:24:07pchwas hoping to see like
02:24:11pchpascal, fortran, or erlang
02:24:12pchor something
02:24:12FromDiscord<Elegantbeef> There is also nlvm
02:24:15FromDiscord<Elegantbeef> Which uses llvm
02:24:23pchgreat! no.
02:24:24FromDiscord<Elegantbeef> Well use pascal + nim
02:24:34pchpascal + nim, but like
02:24:45pchdo I need to set up C early to use nim early there
02:24:55pchor can I use nim, through pascal instead of through C
02:25:15FromDiscord<Forest> You'll need to use C
02:25:25FromDiscord<Forest> Unless ya create a pascal backend for Nim lmao
02:25:30FromDiscord<Elegantbeef> Nim and pascal share a lot so time to make a pascal backend for Nim
02:25:31pcheverything I have to explicitly get working to start using what I like to use is another step of anguish setting up to actually do work
02:25:44pchyeah i like
02:25:46pchdont want to do that
02:25:50pchnot right now anyways
02:26:12FromDiscord<Elegantbeef> So then just use a pascal that makes you happy then use Nim where you can
02:26:17pchi guess ill skip nim until i have C compat going later
02:34:12FromDiscord<Bubblie> how do I check for whether the os nim is running on is windows mac or linux?
02:34:30FromDiscord<Elegantbeef> `defined(linux)`
02:39:13*arkurious quit (Quit: Leaving)
02:50:18*CyberTailor quit (Remote host closed the connection)
02:51:54*CyberTailor joined #nim
02:55:11FromDiscord<Forest> What's the preferred case for functions? Camelcase?
02:55:28FromDiscord<Forest> (is camelcase `newFunctionFive`?)
02:55:31FromDiscord<huantian> cameCase yes
02:55:33FromDiscord<Elegantbeef> Lowercase camelCase yes
02:55:47FromDiscord<Forest> Thanks! And uppercase camelcase for types then?
02:56:09FromDiscord<Elegantbeef> Yes
02:56:23FromDiscord<Forest> Sweet
02:58:02*xcodz-dot joined #nim
03:01:47*xcodz-dot quit (Client Quit)
03:01:57*Onionhammer quit (Quit: The Lounge - https://thelounge.chat)
03:03:12*xcodz-dot joined #nim
03:03:59*Onionhammer joined #nim
03:04:29FromDiscord<Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=46Yr
03:05:43FromDiscord<Elegantbeef> You make procedures to create objects or use constructors
03:08:17FromDiscord<Bubblie> constructors? is there anything on them?
03:08:23xcodz-dotIs their a way to create custom constructors of a user defined object type? Like `proc Color(): Color` because currently I have to use `proc newColor(): Color`
03:09:17FromDiscord<Elegantbeef> the convention i like is `proc init(_: typedesc[Color]): Color = ...`
03:09:23FromDiscord<Elegantbeef> You then do `Color.init()`
03:10:00FromDiscord<Forest> In reply to @Elegantbeef "the convention i like": That looks so nice wtf
03:10:07xcodz-dotthanks
03:10:23FromDiscord<Bubblie> Ah
03:10:40xcodz-dotonly if i had known that earlier I would have had to refactor hundreds of lines
03:10:50xcodz-dotwouldnt*
03:11:36FromDiscord<Elegantbeef> And of course for ref object you can do `new` instead
03:12:03FromDiscord<huantian> I hope your Color isn't a ref object šŸ˜›
03:12:21FromDiscord<Elegantbeef> I've seen worse huan
03:14:00xcodz-dotNo, I am writing a SDL2 wrapper so I am keeping complexity under the hood
03:14:12xcodz-dotso that the user doesn't have to deal with it
03:17:19FromDiscord<Rainbow Asteroids> In reply to @Elegantbeef "You then do `Color.init()`": That looks cool, but I feel like it's a bit misleading. It implies there are Java-like classes in Nim, even though there isn't. And wouldn't `T.new()` shadow the `new` proc in `system`?
03:17:37FromDiscord<Forest> In reply to @xcodz-dot "so that the user": Oh same here but for wgpu
03:17:57FromDiscord<Elegantbeef> It's really not
03:17:59FromDiscord<Elegantbeef> Yes it does but you can do `system.new(Type)` if you need that one
03:22:27xcodz-dotI have been doing some research recently and is there any way that I can evaluate nimscript in my project?
03:22:53*ingy left #nim (WeeChat 2.8)
03:22:54FromDiscord<Elegantbeef> Yes
03:23:03xcodz-dotplease
03:23:19FromDiscord<Elegantbeef> https://github.com/beef331/nimscripter is the easiest way
03:25:14FromDiscord<Elegantbeef> The jackass that runs that repo is really bad at documenting
03:25:15FromDiscord<Elegantbeef> So i guess have fun solving that
03:26:41xcodz-dotwell, for the mast minute, i am questioning my choice of using it or not
03:27:03xcodz-dotI probabbly would keep it on hold for another month until I am thorough with nim
03:27:25FromDiscord<Elegantbeef> What are you after though?
03:27:44FromDiscord<Elegantbeef> This is where i sell you on wasm šŸ˜„
03:29:32xcodz-dotI am after... learning.
03:30:08xcodz-dotOh no no no no, wasm is scary
03:30:39xcodz-dotI was trying out rust before this but their memory management, although considered revolutionary is pain in the a**
03:30:46FromDiscord<Elegantbeef> But wasm is just glorious
03:30:50FromDiscord<Elegantbeef> Any language that supports wasm to script programs!
03:30:59FromDiscord<Elegantbeef> Wasm is honestly not that bad
03:31:10xcodz-dotnice, but nim supports js? that makes js support superior?
03:31:16FromDiscord<Elegantbeef> Sadly there is no Nim native runtime yet
03:31:29xcodz-dothow do you really bind to native functions with wasm?
03:31:32FromDiscord<spoon> native runtime?
03:31:32FromDiscord<Elegantbeef> If you're doing webdev but wasm is more than for webdev
03:31:38xcodz-dotrust gave me a hard time
03:31:46FromDiscord<Elegantbeef> Depends on the runtime
03:31:47FromDiscord<Forest> In reply to @spoon "native runtime?": No JS runtime written in Nim
03:31:57FromDiscord<Elegantbeef> wasm runtime\
03:32:04FromDiscord<Elegantbeef> I've used wasmedge and it's relatively simple
03:32:24FromDiscord<Rainbow Asteroids> In reply to @Elegantbeef "What are you after": lets say I'm trying to write an extensible program. would that be a use case of wasm?
03:32:32FromDiscord<Elegantbeef> Yes
03:32:42xcodz-dothmm, bye (I am a student and have to attend online classes)
03:32:43FromDiscord<Rainbow Asteroids> has any Nim project done this?
03:32:44FromDiscord<Elegantbeef> If you want runtime scripting that's wasm territory
03:32:50*xcodz-dot left #nim (Leaving)
03:32:52FromDiscord<Elegantbeef> Buh bye
03:33:01FromDiscord<Elegantbeef> I've personally toyed with wasm scripting yes
03:33:13FromDiscord<Elegantbeef> https://github.com/beef331/aiarena is an example project
03:33:27FromDiscord<spoon> is nimscript ready for any sort of game mod work? or is lua a better pick
03:33:40FromDiscord<Elegantbeef> Wasm is better than both šŸ˜‰
03:33:49FromDiscord<Elegantbeef> But lua is probably better than nimscript
03:33:58FromDiscord<spoon> assumed so
03:34:00FromDiscord<Elegantbeef> It's faster and made to be embedded
03:34:10FromDiscord<spoon> would love to see nimscript reach that point
03:34:13FromDiscord<Elegantbeef> Wasm is the best as it allows using any language
03:34:37FromDiscord<Tuatarian> I have a function `func contains(i : SomeInteger, b : Board) : bool = ...`
03:34:41FromDiscord<Elegantbeef> I will whore out using wasm for scripting programs until the end of time
03:34:50FromDiscord<Tuatarian> and I call `z notin b...`
03:35:01FromDiscord<Tuatarian> but it gives an issue where the order of the params is reversed
03:35:03FromDiscord<Tuatarian> and I see the issue
03:35:04FromDiscord<Elegantbeef> `not system.contains(b, a)`
03:35:06FromDiscord<Tuatarian> now that I have posted it
03:35:15FromDiscord<Tuatarian> contains proc is for whatever reason
03:35:19FromDiscord<Tuatarian> specified in the reverse order
03:35:29FromDiscord<Elegantbeef> `a.contains(b)`
03:35:33FromDiscord<Elegantbeef> It's specified correctly
03:35:34FromDiscord<Tuatarian> wasm has pretty garbage debugging
03:35:40FromDiscord<spoon> might use wasm for other things that are not the thing i'm currently doing
03:35:53FromDiscord<Elegantbeef> how does wasm have pretty garbage debugging
03:35:57FromDiscord<Tuatarian> contains puts the container first
03:35:57FromDiscord<Elegantbeef> It's literally down to the runtime you're using
03:36:14FromDiscord<Tuatarian> debugging the wasm itself is a pretty terrible experience from what I remember
03:36:17FromDiscord<Elegantbeef> It's specified in the correct order
03:36:31FromDiscord<Elegantbeef> I dont get why it would be that terrible
03:36:34FromDiscord<spoon> you mean writing in wasm directly?
03:36:42FromDiscord<Tuatarian> `a in b` checks if item a is in container b
03:36:49FromDiscord<Elegantbeef> yes
03:36:53FromDiscord<Tuatarian> contains has the container come first though
03:37:01FromDiscord<Tuatarian> which I disagree with conceptually
03:37:06FromDiscord<Elegantbeef> Yes cause `a.contains(b)`
03:37:07*xcodz-dot joined #nim
03:37:20FromDiscord<Tuatarian> good point
03:37:25FromDiscord<Elegantbeef> `in` is a template that makes `contains` more expressive
03:37:28FromDiscord<Tuatarian> great point
03:37:34FromDiscord<Elegantbeef> If you dont like it, dont use it
03:37:37FromDiscord<Tuatarian> yes I have no response to that
03:37:43FromDiscord<Tuatarian> very good point about `a.contains(b)`
03:37:51xcodz-dotI missed some conversation, what happened?
03:38:03FromDiscord<Elegantbeef> nothing
03:38:11FromDiscord<Tuatarian> but I mostly us `in`, so I didn't realize this for a bit
03:38:29FromDiscord<Elegantbeef> Nim has some nice shortcuts for the common solution
03:39:15FromDiscord<Elegantbeef> `<` `<=` `>=` `!=` `in` `notin` `not` are all just templates for the corresponding calls
03:39:34FromDiscord<Elegantbeef> Only having to implement half the problem is nice
03:46:15FromDiscord<Forest> How expensive is it converting Nim types to C types?
03:46:30FromDiscord<Forest> (int to cint, string to cstring, float to cfloat, etc)
03:46:33FromDiscord<Elegantbeef> It doesnt
03:46:40xcodz-dotzero overhead
03:47:06xcodz-dotnim stores string just like how cstring does to make it a zero overhead situation
03:49:02FromDiscord<Forest> Sweet
03:49:07FromDiscord<Forest> Thanks!
03:54:06xcodz-dotSo I looked at the logs and got confused, `a in b` == `b.contains(a)`?
03:55:03FromDiscord<Elegantbeef> yes
03:55:14xcodz-dotthanks
03:58:39xcodz-dothas anyone written a bare metal os in nim?
03:59:04FromDiscord<Elegantbeef> https://github.com/dom96/nimkernel
04:05:53xcodz-dothow tf someone managed to write a kernel in just that many lines? Last time I wrote a kernel in rust, it went way above 400 lines
04:06:08xcodz-dotDoes it support GC?
04:06:15xcodz-dotor ref objects?
04:06:22FromDiscord<Elegantbeef> Using arc yes
04:06:34xcodz-dotnow, what is arc?
04:06:43FromDiscord<Elegantbeef> RAII like memory management
04:07:00xcodz-dotn wat is RAII?
04:07:22FromDiscord<Elegantbeef> C++ move semantics and scope based memory management
04:07:28FromDiscord<Elegantbeef> C++ like\
04:07:35FromDiscord<Elegantbeef> How rust manages memory practically
04:08:07xcodz-dotI quit. I would never in my life ever touch rust memory management again.
04:08:58FromDiscord<Elegantbeef> Nim isnt Rust
04:09:16FromDiscord<Elegantbeef> Nim doesnt force ownership on you
04:10:40FromDiscord<Elegantbeef> Unlike Rust with arc Nim copies when it cannot move
04:10:50FromDiscord<Elegantbeef> It's a much more programmer friendly system
04:10:56xcodz-dotoh
04:10:59FromDiscord<Elegantbeef> The assumption is you know what you're doing
04:11:15xcodz-dotwell, that sounds cozy
04:11:36xcodz-dotyou have no idea, how rust can take the life out of you
04:11:59FromDiscord<Elegantbeef> Using Arc/Orc is pretty much like using refc
04:12:22FromDiscord<Elegantbeef> It should be mostly indistinguishable minus the features of the scoped based memory management making it more deterministic
04:13:05xcodz-dotAnd, how do one support gc in that environment? like am I suppose to do some manual work?
04:13:57FromDiscord<Elegantbeef> It's scoped based memory management so as long as you dont have cyclical types at the end of a procedure call all the memory allocated will be freed
04:14:12FromDiscord<Elegantbeef> All the memory that should be freed\
04:14:29xcodz-dotan example of cyclical types?
04:14:31FromDiscord<Elegantbeef> It's basically just auto insertion of `free` calls
04:14:40FromDiscord<Elegantbeef> A type that references itself
04:14:46xcodz-dotk
04:14:59FromDiscord<Elegantbeef> Arc does not have any way to detect/deallocate cycles so they leak
04:15:08FromDiscord<Elegantbeef> Orc is Arc + Cycle collector
04:15:12xcodz-dothmm, thanks
04:18:32FromDiscord<riceman> Hey, I would love some help here - i'm pretty stuck. Trying to use winim to do some networking stuff. Does anyone know what this second object is? (`[(stuff)]`): https://media.discordapp.net/attachments/371759389889003532/1006053773707321355/unknown.png
04:19:24*xcodz-dot quit (Quit: Leaving)
04:19:37FromDiscord<riceman> Based on the win32 documentation, this should be a 2 dimensional array, like a spreadsheet. However, I can't seem to work out how to properly access values from any other rows than the one you see above.
04:20:52FromDiscord<riceman> The "Entries" part is the number of rows that should exist in that second object, but I have had 0 luck finding the reality where those rows truly do exist.
04:21:10FromDiscord<Elegantbeef> It's an array of tuples or an array of objects
04:23:04FromDiscord<riceman> Thanks for answering, I was worried no one was on! šŸ™‚ Do you know of any examples that depict accessing arrays of objects in Nim? Quick googling right now isn't turning up much (though I'm sure I can find something)
04:23:23FromDiscord<Elegantbeef> The magical thing is looking at the Nim code and the procedure that you called's definition
04:23:25FromDiscord<Elegantbeef> Giving random outputs isnt a way for anyone to help you
04:24:26FromDiscord<Elegantbeef> Accessing arrays is just `myArray[index]`
04:25:11FromDiscord<riceman> of course, that makes sense. Here's the code:ā†µhttps://play.nim-lang.org/#ix=46Yy
04:25:19FromDiscord<!Patitotective> In reply to @riceman "Thanks for answering, I": search engines are bad at indexing nim documentation .sk
04:25:24FromDiscord<!Patitotective> (edit) ".sk" => "šŸ’€ šŸ’€"
04:26:54FromDiscord<Rainbow Asteroids> but he was asking and extremely basic question...
04:27:00FromDiscord<riceman> In reply to @Elegantbeef "Accessing arrays is just": I'm sure I'm missing something super obvious, but I haven't had any luck there. For instance, I can access the individual items seen in the output above, but I can't actually find a way to iterate through rows vertically.
04:27:34FromDiscord<Rainbow Asteroids> what is this win32 function you're talking about
04:28:03FromDiscord<Forest> Futhark is so bloated wth... Why is it so bloated?
04:28:04FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Yz
04:28:20FromDiscord<Elegantbeef> To support the features it has
04:28:27FromDiscord<Forest> Like, the generated code is so massive
04:28:31FromDiscord<Forest> In reply to @Elegantbeef "To support the features": Ah
04:29:00FromDiscord<!Patitotective> In reply to @Forest "Like, the generated code": _PRs welcome_
04:29:14FromDiscord<Forest> I need to work on a small tool to automate renaming functions to be more idiomatic
04:29:32FromDiscord<Forest> Like `wgpuCommandBufferDrop` to `commandBufferDrop` automatically
04:29:34FromDiscord<Elegantbeef> You do know futhark has a rename callback
04:29:40FromDiscord<Forest> ...what?
04:29:48FromDiscord<Elegantbeef> > If you want to implement more complex renaming you can use the renameCallback directive and pass in a callback function that takes the original name, a string denoting what kind of identifier this is, and an optional string denoting which object or procedure this identifier occurs in, and which returns a new string. This callback will be inserted into the renaming logic and will be called on the original C identifier before all the
04:29:54FromDiscord<Elegantbeef> RTFM
04:30:17FromDiscord<Forest> I skimmed past that
04:30:20FromDiscord<Forest> I am so dumb
04:30:25FromDiscord<Elegantbeef> `proc myCallback(name, kind, place: string): string`
04:30:26FromDiscord<Forest> Thank you, this'll be a life saver
04:30:28FromDiscord<riceman> @ElegantBeef Thanks for the answer! I think something must be going wrong in my usage of winim, because it doesn't appear that there are any rows. Hmm... I saw this before and thought I must have been doing something wrong https://media.discordapp.net/attachments/371759389889003532/1006056776900292699/unknown.png
04:30:55FromDiscord<Elegantbeef> You're iterating too far
04:32:22FromDiscord<Forest> In reply to @Elegantbeef "`proc myCallback(name, kind, place:": Now i gotta figure out how to make it all uniform and follow camelcase (wasn't there a library for this a while ago?)
04:32:34FromDiscord<!Patitotective> ~~pmunch really likes long text ngl~~
04:34:27*xcodz-dot joined #nim
04:35:53FromDiscord<riceman> Ah, the iterator was correct but the object within wasn't. With that fixed, there seem to be some type errors. Is a typecast the correct way to go about dealing with this?ā†µhttps://play.nim-lang.org/#ix=46YA
04:36:10FromDiscord<riceman> Thanks a million for the guidance, by the way. I have been at this for hours!
04:38:10FromDiscord<Elegantbeef> No a typecast is not the correct way
04:38:21FromDiscord<Elegantbeef> You're attempting to index an object
04:39:38FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46YB
04:40:15FromDiscord<riceman> Ah, that's the code that outputted the above "index 1 not in 0 .. 0"
04:40:36FromDiscord<Elegantbeef> https://github.com/khchen/winim/blob/bda7de3b63f4644183a2b70cb9163b61e2320f12/winim/inc/iphlpapi.nim#L315-L325
04:40:39FromDiscord<Elegantbeef> Look at the type defs
04:41:14FromDiscord<Forest> https://github.com/PMunch/futhark/blob/master/src/opir.nim#L27 poking around, what is this-
04:41:25FromDiscord<Forest> Nim calling convention?
04:41:53FromDiscord<Elegantbeef> Cmon people RTFM!
04:42:01FromDiscord<Forest> #google
04:42:09FromDiscord<Elegantbeef> No
04:42:25FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#types-procedural-type
04:43:03FromDiscord<Forest> Yeah google took me to that page
04:43:21FromDiscord<Forest> (after using find to get the keywords)
04:43:52FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46YC
04:43:57FromDiscord<Elegantbeef> It does exceed the buffer though
04:45:20FromDiscord<Elegantbeef> Should be `0..<` of course
04:45:24FromDiscord<Elegantbeef> I was testing
04:45:50FromDiscord<riceman> If it returns 122 and says buffer exceed, the returned data is inaccurate, unfortunately
04:46:00FromDiscord<Elegantbeef> Yes i know
04:46:11FromDiscord<Elegantbeef> I'm not on windows so i cannot properly test the code
04:46:22FromDiscord<Elegantbeef> I get stack overflow issues if i incrrease `ulSize`
04:47:14FromDiscord<riceman> Ah, if I increase ulSize, it gets the appropriate TcpTable2 data but returns the "index 1 not in 0 .. 0" error message.
04:47:31FromDiscord<Elegantbeef> how many `dwNumEntires` do you get?
04:47:43FromDiscord<riceman> The correct amount, about 250
04:48:04FromDiscord<Elegantbeef> That array is only capable of holding a single element
04:48:09FromDiscord<Elegantbeef> `Any_Size` is 1
04:48:46FromDiscord<Elegantbeef> Oh god
04:48:48xcodz-dotI am infact on windows, want me to test?
04:48:59FromDiscord<Elegantbeef> No i see the stupidity
04:49:19FromDiscord<Elegantbeef> Windows defined that table as a `MIB_TCPROW2 table[ANY_SIZE];` which is what the nim library imported it as
04:49:41FromDiscord<Elegantbeef> But it seems `table` is an `ptr UncheckedArray[MibTcpRow2]` actually
04:50:31FromDiscord<riceman> aha, so is that a winim issue? I was beating my head against the wall
04:50:52FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46YD
04:50:52FromDiscord<Elegantbeef> No it's a windows issue really
04:51:19FromDiscord<Elegantbeef> Like i said it's `MIB_TCPROW2 table[ANY_SIZE];`, but the docs sayā†µ> A pointer to a table of TCP connections implemented as an array of MIB\_TCPROW2 structures.
04:52:04FromDiscord<Elegantbeef> Shit sorry that's supposed to be `table.table[0].addr`
04:53:05FromDiscord<Elegantbeef> Are you following https://docs.microsoft.com/en-us/windows/win32/api/tcpmib/ns-tcpmib-mib_tcptable2#examples ?
04:53:21FromDiscord<riceman> Yep, that was what I was porting.
04:53:42FromDiscord<riceman> sent a code paste, see https://play.nim-lang.org/#ix=46YE
04:53:45FromDiscord<riceman> the table.table is throwing it off
04:53:49FromDiscord<Elegantbeef> Yes i wasnt writing the entire variable name
04:53:55FromDiscord<Elegantbeef> That variable name is atrocious
04:54:03FromDiscord<riceman> ah šŸ™‚
04:55:45FromDiscord<Elegantbeef> that's a nasty API
04:56:05FromDiscord<riceman> Yes, it's been painville.
04:56:26FromDiscord<riceman> To confirm, you're saying it should be `pTcpTable.table[0].addr`?
04:56:27FromDiscord<Elegantbeef> it abuses a static C array for no reason really
04:56:41FromDiscord<Elegantbeef> Correct
04:56:54FromDiscord<riceman> (19, 14) Error: undeclared identifier: 'table'ā†µ: (
04:57:37FromDiscord<riceman> believe it or not, this is a heavily used windows API for network tables. Rough intro to win32 api for me
04:57:40FromDiscord<Elegantbeef> You've done something wrong
04:58:02FromDiscord<Elegantbeef> You have another `table.table` somewhere i asssume
04:58:18FromDiscord<Elegantbeef> Yea i mean this is just a badly written apiā†µ(@riceman)
04:58:37FromDiscord<Elegantbeef> They make it more confusing by using a static sized array, for no reason
04:58:55FromDiscord<riceman> OMG! IT WORKS! I owe you my life.
04:59:14FromDiscord<Elegantbeef> Well while you owe me something might i suggest installing a real OS šŸ˜›
04:59:40FromDiscord<riceman> haha! I'm a native linux user but I have to use Windows for work, sadly. It's been a rough transition!
04:59:43FromDiscord<Elegantbeef> https://github.com/khchen/winim/blob/bda7de3b63f4644183a2b70cb9163b61e2320f12/winim/inc/winerror.nim#L87 also their errors exist
05:00:01FromDiscord<riceman> Ah, perfect. I hadn't found that in my googling, thank you!
05:00:02FromDiscord<Elegantbeef> I mean if you had to deal with any code like the above i'd believe you
05:00:07FromDiscord<Elegantbeef> Dont google
05:00:13FromDiscord<Elegantbeef> Search the repo directly
05:00:25FromDiscord<Elegantbeef> Search engines suck, github search is ok, and searching locally is the best
05:00:44xcodz-dotGoogle should prolly provide api for sites to become more discoverable
05:00:45FromDiscord<Bubblie> is there any example of the renameCallback being used?
05:00:49FromDiscord<Bubblie> in futhark that is
05:01:07FromDiscord<Elegantbeef> Bubblie look at my wasmedge library
05:01:09FromDiscord<riceman> I'll start using that as my first line of attack. Thanks a ton, I really appreciate it.
05:01:23FromDiscord<Elegantbeef> No problem
05:01:30FromDiscord<Elegantbeef> I'm still just in awe at that api
05:02:09FromDiscord<Elegantbeef> Why the hell dont they just do `MibTcpRow2` and have another `MibTcpRow2` field, it's the same semantics but much much more clear
05:02:41FromDiscord<riceman> Wait until you see the undocumented windows APIs. I think it gets much darker than this...
05:02:50FromDiscord<Elegantbeef> I'm good
05:02:56FromDiscord<Bubblie> In reply to @Elegantbeef "Bubblie look at my": okay
05:03:00FromDiscord<Bubblie> thank you :)
05:03:04FromDiscord<Elegantbeef> I cant stand this stupidity of weakly typed/unchecked code
05:03:09FromDiscord<Elegantbeef> It's just so dumb
05:04:17FromDiscord<riceman> Dumb indeed. Thanks again for your help, I'm headed to bed. Have a good evening!
05:04:23FromDiscord<Elegantbeef> Buh bye
05:04:32FromDiscord<Elegantbeef> Why did i have to see this code, it offends me so much
05:06:03FromDiscord<flywind> Do you think it is gonna to submit the sample to windows defender? https://github.com/quantimnot/nim_windows_defender/blob/master/.github/workflows/windows_defender.yml
05:06:09FromDiscord<flywind> (edit) removed "to"
05:07:33FromDiscord<Elegantbeef> I'd wager it sends the signature to MS but no clue
05:07:35FromDiscord<flywind> I can add something like this to our CI.
05:07:52xcodz-dotriceman is going to bed while I just woke up an hour ago in the morning
05:08:47FromDiscord<flywind> In reply to @Elegantbeef "I'd wager it sends": Anyway I will add a cron everyday somewhere.
05:23:23FromDiscord<!&luke> I'm wrapping an api, and I'm only 6/57 endpoints throughšŸ’€
05:23:29FromDiscord<!&luke> This will take a while
05:25:35xcodz-dotI am wrapping sdl2 with pygame like api and I have barely managed to create a empty window
05:26:21FromDiscord<!&luke> Is it more efficient to write testes while wrapping, or after wrapping
05:28:39xcodz-dotprobabbly during wrapping so you find out bugs instantly rather afterwards where you are forced to search through whole codebase
05:29:02xcodz-dotbut chads like me do not write tests
05:29:14xcodz-dot;)
05:45:02*xcodz-dot quit (Quit: Leaving)
06:13:08FromDiscord<Elegantbeef> You cant test code you cannot runā†µ(@!&luke)
06:23:00*pch is now known as disso_peach
06:47:31*om3ga quit (Ping timeout: 252 seconds)
07:19:28FromDiscord<Freakwill (William Song)> I want to generate a fixed-length array randomly. I use `collect(for _ in 1..3: rand(1))` and try to convert it to an array which is not easy. Dose there exist some direct way to achieve it?
07:23:28FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Zg
07:27:21FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Zh
07:32:04FromDiscord<Zectbumo> In reply to @xcodz-dot "I am wrapping sdl2": for fun or why not use nimgame https://nimble.directory/pkg/nimgame2
07:40:30FromDiscord<Freakwill (William Song)> thanks a lot
08:18:58*attah quit (Ping timeout: 240 seconds)
08:19:03*def- quit (Quit: -)
08:19:15*def- joined #nim
08:22:54*attah joined #nim
08:34:19FromDiscord<Bung> I've developed a gui app on windows 11, based on webgui , my app use local file resources , js css etc. but when I move exe to other location , it still works , does it means I dont need bundle static resource to exe ?
08:35:04FromDiscord<enthus1ast> browsercache maybe?
08:35:28FromDiscord<Bung> oh, maybe or app level cache ?
08:35:53FromDiscord<Bung> so I indeed need bundle these resources.
08:38:08*rockcavera quit (Remote host closed the connection)
08:46:54FromDiscord<enthus1ast> which webgui do you have used?
08:49:28FromDiscord<Bung> https://github.com/juancarlospaco/webgui 0.9.0 the master branch doesn't even show page
08:50:34FromDiscord<Bung> also I use local modification version , see my last PR
09:19:13FromDiscord<d4rckh> Is there any alternative for rust's clap in nim?
09:20:14*CyberTailor quit (Remote host closed the connection)
09:20:39FromDiscord<Elegantbeef> cligen, argparse, there are a bunch of CLI parsers
09:28:09FromDiscord<Elegantbeef> Annoyingly you cannot get doc comments from the type after the code
09:28:34FromDiscord<Elegantbeef> I was thinking about trying to do something similar but doc comments are not in macros
09:36:19FromDiscord<EyeCon> In reply to @Elegantbeef "cligen, argparse, there are": Also therapist: https://bitbucket.org/maxgrenderjones/therapist/src/master/
09:38:56FromDiscord<Bung> can i make proc body call readFile or staticRead depends on caller whether use `static:`
09:39:46FromDiscord<Elegantbeef> No you can take a `static bool` as a parameter
09:41:41FromDiscord<Bung> okay, thanks
09:44:08NimEventerNew thread by Drkameleon: How to use Github's actions/cache with Nim?, see https://forum.nim-lang.org/t/9354
09:59:37*attah quit (Ping timeout: 245 seconds)
10:04:21*attah joined #nim
10:51:40*wallabra_ joined #nim
10:53:01*wallabra quit (Ping timeout: 268 seconds)
10:53:18*wallabra_ is now known as wallabra
10:59:22FromDiscord<Forest> Heya so I'm using a rename callback on futhark and most things seem to work, but some things like `Wgpushaderdefine" still show up when I'm trying to remove the prefix
11:00:09FromDiscord<Forest> sent a code paste, see https://play.nim-lang.org/#ix=4701
11:04:15FromDiscord<mischa_u> Your first replace is overwritten. By the 2nd `else: name` when it doesn't matches against the 3rd prefix
11:04:32FromDiscord<mischa_u> (edit) "overwritten. By" => "overwritten by"
11:06:10FromDiscord<Forest> Aah that makes sense
11:06:13FromDiscord<Forest> Thanks!
11:08:50FromDiscord<Forest> It's not automatically using Camelcase and that's annoying-
11:52:10FromDiscord<krisppurg> Is there a reason why does sometimes `stream.readStr(...)` take longer on windows when reading from an `outputStream` from a `Process`?
11:55:12FromDiscord<Phil> In reply to @krisppurg "Is there a reason": Longer than what?
11:55:25FromDiscord<Phil> Or just that it sometimes takes long in general?
11:56:42FromDiscord<krisppurg> it sometimes take long like 1 second or >100ms
12:15:21FromDiscord<krisppurg> In reply to @Isofruit "Or just that it": either long in general ig
12:20:50FromDiscord<noiryuh> sent a code paste, see https://play.nim-lang.org/#ix=470h
12:27:58FromDiscord<Shiba> where is stdlib_tables.nim located ?
12:27:59FromDiscord<Rika> Nim doesnā€™t have the concept of const pointer from C++ so itā€™s a copy
12:32:53FromDiscord<noiryuh> In reply to @Rika "Nim doesnā€™t have the": it's not from C++
12:33:16FromDiscord<noiryuh> but thanks
12:34:04FromDiscord<noiryuh> welp, i'm trying using https://github.com/treeform/pixie in C
12:35:08FromDiscord<noiryuh> but the `pixie_read_image(path: char)` (probably from `proc pixie_read_image(path: cstring)`)ā†µit's a mutable string
12:35:33FromDiscord<noiryuh> (edit) "string" => "string, for file path"
12:35:47FromDiscord<noiryuh> (edit) "cstring)`)ā†µit's" => "cstring) {.exportc.}`)ā†µit's"
12:38:26FromDiscord<noiryuh> sent a code paste, see https://play.nim-lang.org/#ix=470n
12:39:46*oz joined #nim
12:40:15*oz is now known as Guest7938
12:40:23FromDiscord<noiryuh> so i just want to make sure i could use `const char` without any trouble
12:46:42FromDiscord<Rika> In reply to @noiryuh "it's not from C++": Iā€™m forgetful of what C has or doesnā€™t
12:56:02FromDiscord<mersenne> How would I write a micro/picokernel in nim, and use gnu grub as the bootloader?
12:57:32FromDiscord<Rika> Thatā€™s very broad
13:08:54FromDiscord<Shiba> In reply to @Shiba "where is stdlib_tables.nim located": !
13:24:33FromDiscord<auxym> huh? why? depends on your OS anyways and your installation method (choosenim etc)
13:25:42FromDiscord<auxym> and I think the file is just called tables.nim
13:36:15FromDiscord<Professor Actual Factual> sent a long message, see http://ix.io/470F
13:37:04FromDiscord<Professor Actual Factual> (edit) "http://ix.io/470F" => "http://ix.io/470G"
13:45:44FromDiscord<auxym> never heard of that. The nim compiler always does dead code elimination though? so whatever you don't use isn't included in the final binary
13:47:40*arkurious joined #nim
13:50:49FromDiscord<mersenne> In reply to @Rika "Thatā€™s very broad": So I mean write a small kernel in Nim, in place of a language like C or Cpp.
13:51:02*jmdaemon quit (Ping timeout: 240 seconds)
13:51:57FromDiscord<Rika> Yeah, thatā€™s still very broad; you can basically follow a kernel tutorial for C but do it in Nim
13:52:18FromDiscord<Rika> If you have questions whilst doing so then please ask those instead because itā€™s hard to tell you how to do such a big task
13:52:45FromDiscord<Rika> There are already some kernels in Nim
13:52:56FromDiscord<Rika> I donā€™t remember the name but a quick search on GitHub should suffice
14:01:14NimEventerNew post on r/nim by Mibuna: OSDev in Nim, see https://reddit.com/r/nim/comments/wj9l8t/osdev_in_nim/
14:08:39*Guest7938 is now known as om3ga
14:23:29FromDiscord<auxym> @mersenne have you seen Rika's suggestion of searching github? https://github.com/dom96/nimkernel
14:44:39*rockcavera joined #nim
14:44:39*rockcavera quit (Changing host)
14:44:39*rockcavera joined #nim
14:53:55*xcodz-dot joined #nim
14:55:45xcodz-dothow does one write windows specific code? is there some sort of template?
14:59:47FromDiscord<Rika> Thereā€™s a define flag ā€œwhen defined windows:ā€ I think?
15:02:13FromDiscord<!&luke> sent a code paste, see https://play.nim-lang.org/#ix=471b
15:02:37FromDiscord<!&luke> Replace the echo with what you want to do
15:03:02FromDiscord<leorize> use `when defined(windows)` for compile-time selection
15:05:34xcodz-dotthanks! and what are the keywords for mac, linux and all other supported platforms?
15:06:10*derpydoo joined #nim
15:06:37FromDiscord<leorize> there is a 1\:1 mapping between `--os:` and those symbols
15:06:53FromDiscord<leorize> `macosx` for mac, `linux` for linux, etc.
15:07:33FromDiscord<leorize> some "broader" symbols\: `posix` for POSIX-like OS (incl. linux, mac, bsd) and `bsd` for any BSD
15:22:14*xcodz-dot quit (Ping timeout: 255 seconds)
15:35:23*xcodz-dot joined #nim
15:37:11xcodz-dotexit
15:37:14*xcodz-dot quit (Client Quit)
15:39:54FromDiscord<Rika> this isnt your shell's input šŸ˜‰
15:58:35FromDiscord<Forest> Is there a way to tell Futhark to keep the original casing of the header files?
16:14:01NimEventerNew post on r/nim by Ok_World__: My first Nim project - qwatcher, see https://reddit.com/r/nim/comments/wjcube/my_first_nim_project_qwatcher/
16:16:49FromDiscord<Rika> cool
16:19:43FromDiscord<Forest> :p
16:27:29FromDiscord<Forest> In reply to @Forest "Is there a way": Anyone?
16:28:07FromDiscord<Forest> Ig i could use a custom rule then use manual rename calls after for lower case to custom cased
16:28:12FromDiscord<Forest> Camelcased
16:40:27FromDiscord<Shiba> its takes me 10 seconds to compile my project
16:41:11FromDiscord<Shiba> is there anything useless i can remove from those standard libaries to speed this
16:41:15FromDiscord<Shiba> im gonna try
16:41:20FromDiscord<Shiba> (edit) "this" => "this?"
16:44:06*vicecea quit (Remote host closed the connection)
16:44:35*vicecea joined #nim
17:20:03FromDiscord<planetis> Last time I checked it used the .nimcache directory and created a random name for each run. So maybe remove that logic?
17:37:10FromDiscord<Phil> Trying to wrap my head around how norm converts types and man it isn't easy
17:39:34FromDiscord<flywind> Which part is hard?
17:41:12FromDiscord<Phil> I'm trying to basically "convert" it's "fromRowPos" proc into something that could work with normal objects instead of a Model type (because I want a utility proc that accepts raw sql, executes it and converts the object into a random object-type given by the user)ā†µā†µHowever, that proc does bonkers stuff with optionals and recursion that runs into additional issues when you start wanting to use normal objects, one sec
17:41:29FromDiscord<Phil> sent a code paste, see https://paste.rs/Cij
17:42:28FromDiscord<Phil> Now, for some elaboration:ā†µ`isModel` is a proc that works on `Option[ModelType]` as well as `ModelType`, so keep that in mind.ā†µ`model` is a proc that will implicitly convert any value of type `ModelType` into a value of type `Option[ModelType` (the `some` version)
17:44:08FromDiscord<flywind> What's your modified version?
17:44:16FromDiscord<Phil> And the proc expects to receive an object that it can fill.ā†µYou also have to keep in mind that there's essentially 2 things that can be nil:ā†µEither a column-value from the row can be nil (`row[pos].kind == dvkNull`) OR the `value` may be another field of type `Model` which might be nil, in that case you want to not fil it.
17:47:24FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=471S
17:48:51FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=471T
17:49:52FromDiscord<Phil> The first issue for this is that I have no func that covers `string` for now, which can be fixedā†µBut there's also int, float and bool and it's a bit weird to define the same proc 5 times
17:50:08FromDiscord<flywind> `typeof(value).isObject()` shoud be `isObject(T)`
17:50:40FromDiscord<flywind> And add a overload for `isObject` should work: `func isObject[T](val: T): bool = false`
17:50:48FromDiscord<Phil> fromRawPos is not a generic so it doesn't have a T
17:51:19FromDiscord<flywind> (edit) "`isObject(T)`" => "`isObject(value)`"
17:52:03FromDiscord<Phil> Wait, god damnit was I trapped in my entire thinking of wanting to have things compiletime when moigagoo did all his things at runtime
17:52:14FromDiscord<flywind> `typeof(value)` returns `typedesc` not the actual value
17:52:24FromDiscord<Phil> Which is likely why I went "typeof" because I used that a lot in the other features I added to norm where I moved as much as I could into compiletime
17:52:46FromDiscord<Phil> Though for now I just want to have something that works and can refactor stuff into compiletime when I get there
17:52:56FromDiscord<flywind> if `typeof(value)` is object or `typeof(value)` is ref can probably work too.
17:53:07FromDiscord<flywind> (edit) "if" => "``if" | "is" => "``ā†µis"
17:53:14FromDiscord<flywind> (edit) "`typeof(value)`" => "`typeof(value)`:"
17:53:27FromDiscord<flywind> (edit) "`typeof(value)`:" => "`typeof(value)` is ref:"
17:53:33FromDiscord<flywind> (edit) "``ā†µis ref can" => "``ā†µcan"
17:53:43FromDiscord<Phil> For now I'm only covering the case of the object being a value type, ref type would need me de-referencing for the fieldpairs iterator
17:53:46FromDiscord<flywind> (edit) "`typeof(value)`" => "typeof(value)" | "`typeof(value)`" => "typeof(value)"
18:00:46FromDiscord<Phil> Do we have some sort of pretty-print proc?
18:01:00FromDiscord<Phil> Like python's pretty print module?
18:03:27FromDiscord<flywind> I use repr everything, treeform probably has a pretty print module irrc
18:03:36FromDiscord<flywind> (edit) "I use repr ... everything," added "to print"
18:03:58FromDiscord<Phil> In reply to @flywind "I use repr to": I'd pretty much love a pretty print of a repr of an array
18:04:27FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=471Y
18:04:34FromDiscord<flywind> https://github.com/treeform/print
18:05:09FromDiscord<Phil> I am smart, if you don't use repr with print it even does the indentation really well
18:09:46FromDiscord<Forest> What's the nim alternative to `shutil.which` from Python? It tries to get the full path of the binary from checking in the path
18:14:34FromDiscord<Forest> getAppDir gets the current executable, not the name of the executable i need bta
18:14:36FromDiscord<Forest> Btw
18:14:45FromDiscord<Sabena Sema> probably `os.findExe`
18:14:50FromDiscord<Forest> Thanks!
18:28:50FromDiscord<Sabena Sema> was programming in julia for a bit and wow, nim's macro system is so, so much better
18:29:06FromDiscord<Sabena Sema> the whole multi-stage semantic analysis makes things so much more useful
18:32:17FromDiscord<Rika> Mind elaborating whatā€™s wrong with Julia in this sense?
18:32:28FromDiscord<Rika> Most of us arenā€™t familiar with Julia
18:32:44FromDiscord<Sabena Sema> macros in julia operate only on the syntax tree, before any semantic analysis
18:32:51FromDiscord<Sabena Sema> so the input has no type information at all
18:33:36FromDiscord<Sabena Sema> and the macro can't make any decisions based on the types (well, it sorta can, it can "eval" in the calling module's global scope to figure out type information, but obviously this isn't great for performance)
18:35:43FromDiscord<Sabena Sema> sent a code paste, see https://play.nim-lang.org/#ix=4725
18:35:45FromDiscord<Sabena Sema> because the macro can't access the names of the fields!
18:35:51FromDiscord<Rika> Fun
18:37:03FromDiscord<Sabena Sema> the "reason" for this is that if macros could have access to the types then type analysis is no longer really "one step" since macros could generate yet more types
18:37:21FromDiscord<Sabena Sema> oh, wait, I think the above example might be possible with generated functions
18:37:48FromDiscord<Sabena Sema> but generated functions are macros that define the _body_ of an actual function, so they can't mess with the calling scope
18:52:01*kenran joined #nim
19:02:00FromDiscord<Forest> Is there a bot that uses the outputted json from nimdocs to let ya search through them within discord or?
19:02:23FromDiscord<Forest> If not, I'll need to work on it
19:02:35FromDiscord<Rika> Why though just asking
19:02:38FromDiscord<leorize> `nim jsondoc`, the output is horrendous, though
19:03:14FromDiscord<Forest> In reply to @Rika "Why though just asking": More convenient and searching via google is tedious and generally bleh
19:03:21FromDiscord<Forest> In reply to @leorize "`nim jsondoc`, the output": Hm
19:03:57FromDiscord<Forest> Also, funni
19:03:59FromDiscord<Rika> Iā€™m at the point where when I think of a proc I immediately can tell what module itā€™s in so
19:04:09FromDiscord<Rika> At least for commonly used procs
19:04:10FromDiscord<Rika> Xd
19:04:52FromDiscord<Forest> Fair
19:05:39FromDiscord<Forest> How do i make nimble generate the docs?
19:05:48FromDiscord<Forest> For projects such as the Nim repo itself lmao
19:06:04*jmdaemon joined #nim
19:07:12FromDiscord<leorize> `nim doc --outdir:html --project /path/to/your/entry/file.nim`
19:07:33FromDiscord<Forest> Thanks!
19:07:35FromDiscord<leorize> you can repeat that command for every entry files you have, they will be linked together
19:08:30FromDiscord<Forest> It has no specific entry file uh
19:08:31FromDiscord<leorize> here is how I generate mine in CI in case you're interested\: https://github.com/alaviss/nim-sys/blob/0830710e5b9743215ab8511e8cf5ff503c6860d9/.github/workflows/ci.yml#L76-L89
19:08:33FromDiscord<Forest> For compiler
19:08:41FromDiscord<leorize> for Nim itself, `./koch docs`
19:08:52FromDiscord<Forest> Ooh thanks!
19:09:15FromDiscord<Forest> In reply to @leorize "for Nim itself, `./koch": Need to create docs in the form of json specifically, unless you're suggesting i parse the html instead?
19:09:21FromDiscord<leorize> the compiler entry file is `compiler/nim.nim`, if you ever need to generate that by hand
19:09:38FromDiscord<leorize> check out `tools/kochdocs.nim`, it's the code that drives `./koch docs`
19:09:51FromDiscord<Forest> Aah thank you!
19:15:50*kenran quit (Quit: WeeChat info:version)
19:28:44FromDiscord<Sabena Sema> In reply to @Forest "More convenient and searching": the doc index is generally good for searching, although it would be nice to have some more organization in the docs
19:30:43FromDiscord<Forest> Fair
19:30:52FromDiscord<Forest> Would still be nice for a way to do it in discord
19:31:20FromDiscord<leorize> the index is available as `<module>.idx` on Nim documentation site
19:31:31FromDiscord<leorize> a bot to search through it is certainly possible
19:32:32FromDiscord<Sabena Sema> more output formats for the index would be neat
19:32:41FromDiscord<Sabena Sema> a devhelp2 index would be cool
19:32:53FromDiscord<Forest> Oh hm that'd be sweet then
19:34:59FromDiscord<leorize> oh lol I just did a quick test on the doc page
19:35:14FromDiscord<leorize> turns out the search box fetches theindex.html then search based on it
19:35:23FromDiscord<leorize> I thought it used the `idx` files
19:37:09FromDiscord<Sabena Sema> does chronos use iocp on windows and uring on linux?
19:37:11FromDiscord<Sabena Sema> or is it epoll?
19:37:13*def- quit (Quit: -)
19:37:17FromDiscord<Sabena Sema> or god forbid select!?
19:37:25*def- joined #nim
19:37:40FromDiscord<leorize> epoll
19:38:07FromDiscord<Sabena Sema> does it have a thread pool for like file opening and closing?
19:39:44FromDiscord<Forest> Ah rip
19:39:49FromDiscord<leorize> a quick skim shows that it doesn't support regular files at all
19:40:36FromDiscord<Sabena Sema> ah
19:51:53FromDiscord<Sabena Sema> tbf tokio is kinda the main thing drawing me toward rust, though idk if it's actually faster than say, libuv with the uring backend
19:52:18FromDiscord<Sabena Sema> I really wanna see an async runtime designed from the ground up for only completion queue based APIs
19:52:18FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=472j
19:52:55FromDiscord<leorize> I was working on that, but school got in the way \:P
19:53:09FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=472j" => "https://play.nim-lang.org/#ix=472k"
19:53:32FromDiscord<leorize> https://github.com/alaviss/nim-sys/pull/24 \<- you can see this for a sockets implementation
19:55:45FromDiscord<Sabena Sema> that looks like it uses epoll tho
19:55:53FromDiscord<Sabena Sema> although it adapts it to a more queue based api
19:57:08FromDiscord<leorize> the goal is\: stuff done inside async has to be the same as stuff done outside async
19:57:20FromDiscord<Sabena Sema> like the same API?
19:58:27FromDiscord<leorize> yea
19:58:59FromDiscord<Sabena Sema> yeah, I've never quite understood why the APIs are ever different (assuming you're using state-machine type coroutines)
19:59:36FromDiscord<leorize> the idea of completion interface is that\: if stuff can't be done now, it would be queued and you will only get the final result
19:59:40FromDiscord<lantos> @dom96 hey could you please help me with gaining access to my forum account peterm tried to yesterday but the email password reset isn't working
19:59:41FromDiscord<Sabena Sema> Like it's quite different code, but I don't see why you couldn't make each "suspend point" a synchronous call instead
20:00:50FromDiscord<Sabena Sema> In reply to @leorize "the idea of completion": sure, but if I want async IO I really want everything to be queued (to allow reordering, if nothing else)
20:02:24FromDiscord<leorize> that's a different model and can be easily built on top of my design \:P
20:02:44FromDiscord<Sabena Sema> for the stuff that the kernel doesn't know how to do async I usually do want a thread pool (notably if only the IO ops happen on the pool you don't get into trouble with threadpool work spawning other threadpool in situations where that spawn isn't a tail call
20:03:03FromDiscord<Sabena Sema> actually: I think I lot of io_uring ops are implemented by just doing them in a kernel threadpool
20:03:26FromDiscord<Sabena Sema> this still saves you syscalls and some memory though
20:04:39FromDiscord<Forest> How do i delete a node from a json node?
20:05:28FromDiscord<leorize> there should be a `delete` proc or smt
20:05:31FromDiscord<Forest> I have a json file which is an array containing dictionaries (tables?) and i need to delete a few of them from the table
20:05:36FromDiscord<Forest> In reply to @leorize "there should be a": That's only for strings
20:05:47FromDiscord<Forest> https://nim-lang.org/docs/json.html#delete%2CJsonNode%2Cstring
20:05:51FromDiscord<Forest> The error i gotv
20:05:52FromDiscord<Forest> :
20:06:15FromDiscord<Forest> sent a code paste, see https://play.nim-lang.org/#ix=472q
20:06:31FromDiscord<leorize> oh, you need to know the key
20:06:41FromDiscord<leorize> otherwise, the only way is to build a new JsonNode without that node
20:06:58FromDiscord<Forest> Rip fair enough, thanks!
20:09:13FromDiscord<leorize> it's easier to implement for the most partā†µ(@Sabena Sema)
20:10:01FromDiscord<Sabena Sema> yeah
20:10:03FromDiscord<dom96> In reply to @lantos "<@132595483838251008> hey could you": can't PM you
20:10:35FromDiscord<Sabena Sema> and most languages dont let you customize how async suspend points work quite like nim
20:10:36FromDiscord<leorize> in Nim there is no native closure iterator chaining for example, so something like `Future` is required
20:11:12FromDiscord<Sabena Sema> wait what? cant closure iterators include other closure iterators in their closures?
20:11:14FromDiscord<leorize> lua and kotlin are pretty much on top of this
20:11:32FromDiscord<Sabena Sema> or do you mean chaining based on tail calls
20:12:15FromDiscord<leorize> we don't have `yield` like in JS, though I suppose you can do a `for-loop` chainā†µ(@Sabena Sema)
20:13:07NimEventerNew thread by Loge: Fidget - vmath - vector graphics undeclared identifier, see https://forum.nim-lang.org/t/9355
20:14:00FromDiscord<leorize> but even that is inflexible, lua and kotlin design allow a much better composition interface for suspended routine
20:14:24FromDiscord<leorize> for example, a suspension can be triggered at any point in the call chain, you can `async -> "non"-async -> async` and the chaining will be seamless
20:16:25FromDiscord<leorize> and well, you can also `async -> async` chain, which is non-trivial for closure iterator without a backing structure (in this case `Future`)
20:17:33FromDiscord<dom96> In reply to @Sabena Sema "I really wanna see": why?
20:19:15FromDiscord<Sabena Sema> In reply to @leorize "and well, you can": isnā€™t the backing structure mostly to store the parameters? That isnā€™t additional overhead over other languages, they just do that implicitly
20:20:07FromDiscord<Sabena Sema> In reply to @dom96 "why?": mostly curious how it might look
20:20:26FromDiscord<Sabena Sema> probably the same if the api was state-machine coroutines
20:23:34FromDiscord<dom96> The reason I ask is because I would consider the asyncdispatch API to be "completion queue based", though maybe I'm misunderstanding what you mean by "completion queue based"
20:23:52FromDiscord<leorize> you need to store the chain to resume as well, the differences are minor, but it's kinda like this\:ā†µā— In closure for-chaining, resuming means\: `resume -@Sabena Sema)
20:24:18FromDiscord<leorize> asyncdispatch is mostly callbacks, and it's not consistent as well
20:25:38FromDiscord<Sabena Sema> In reply to @leorize "you need to store": hmm is this because the activation record for a closure iterator is, in fact, a normal stack frame?
20:27:19FromDiscord<leorize> yea, and you're forced to walk the stack from top on every resume
20:28:17FromDiscord<leorize> and since this stuff is implemented using heap-allocated objects, it become a pointer chasing fest for the CPU
20:28:33FromDiscord<Sabena Sema> can you thunk through some assembly that manipulates the stack pointer and return address?
20:28:58FromDiscord<leorize> you don't need to do that, you just have to make control transfer a thing
20:29:04FromDiscord<Sabena Sema> its pretty hard to avoid heap allocated objects for the state
20:29:30FromDiscord<leorize> you can't avoid the heap, but you can avoid chasing the chain to resume
20:29:44FromDiscord<Sabena Sema> In reply to @leorize "you don't need to": I mean isnt ā€œmaking it a thingā€ just having the compiler do those manipulations for you?
20:29:51FromDiscord<Sabena Sema> yeah
20:30:23FromDiscord<leorize> pretty much, that's why JS have syntax dedicated for that
20:30:31FromDiscord<leorize> expressing intent is always preferable
20:31:04FromDiscord<Sabena Sema> not to mention allowing the optimizer to see through the resume
20:32:55FromDiscord<leorize> \<plug\> you might be interested in cps if you're looking for a scheme designed for composition of routines instead of fancy pausable iterators \</plug\>
20:35:28FromDiscord<Sabena Sema> this doesnā€™t just apply to yield right? you can get the bad behavior by just awaiting some function that itself awaits
20:36:09FromDiscord<Sabena Sema> In reply to @leorize "\<plug\> you might be": I donā€™t really understand the difference tbh, except that cps is a lib impl
20:36:37FromDiscord<Sabena Sema> like async functions are just fancy iterators, thats how they work
20:36:40FromDiscord<leorize> await chain is the hack for control flow transfer
20:37:11FromDiscord<Sabena Sema> it wont do that for simple nesting?
20:37:54FromDiscord<leorize> in Nim for example `await` yields `Future[T]` of `thirdClosure`, then `secondClosure` appends its continuation code to that Future and yield it, and so on
20:38:23FromDiscord<leorize> then when the Future is resumed, it runs from `thirdClosure -> .. -> firstClosure`
20:39:29FromDiscord<exelotl> I like ucontext-based coroutines tbh: https://github.com/zevv/nimcoro
20:39:50FromDiscord<exelotl> they're truly colourless, like the ones in Lua
20:41:46FromDiscord<exelotl> with the upcoming .forbids pragma it should be possible to ensure that you never accidentally yield from non-coroutine code too: https://github.com/nim-lang/Nim/pull/20050
20:42:00FromDiscord<leorize> sent a long message, see http://ix.io/472E
20:42:25FromDiscord<huantian> cps looks cool I gotta try it
20:42:31FromDiscord<Sabena Sema> In reply to @exelotl "I like ucontext-based coroutines": ucontext is horrible and should essentially never be used
20:42:42FromDiscord<leorize> we tried too \:P https://github.com/nim-works/cps/blob/master/examples/coroutine.nimā†µ(@exelotl)
20:42:50FromDiscord<Sabena Sema> you gotta reimplement the whole runtime for it
20:43:24FromDiscord<Sabena Sema> and they are really not much faster at all than OS threads, esp on linux (where you can use cgroups to prevent starvation)
20:43:48FromDiscord<Sabena Sema> they were important back when there was the BKL around the scheduler
20:43:55FromDiscord<Sabena Sema> but that is long gone
20:46:19FromDiscord<exelotl> right, I actually don't know the implications of ucontext on the desktop, I'm simply using a bare metal implementation of it in my GBA game for cutscene & dialogue scripting
20:47:15FromDiscord<exelotl> i.e. I have a coroutine which needs to run once in a frame, and that's it
20:48:09FromDiscord<Sabena Sema> yeah, tbh they arenā€™t _that_ bad if you only ever resume on the same thread as you suspended
20:50:25FromDiscord<Sabena Sema> you also do save some memory, I forget how big kernel stacks are on linux but its a few k
20:50:34FromDiscord<Sabena Sema> and they are not allocated on-demand
20:53:24*pech joined #nim
20:54:49*def-- joined #nim
20:55:10*via__ joined #nim
20:56:07*mahlon_ joined #nim
20:56:16*oz` joined #nim
20:57:23*MightyJoe joined #nim
20:57:37*__________ joined #nim
20:58:09*emery joined #nim
20:58:43*oprypin_ joined #nim
21:02:16*def- quit (*.net *.split)
21:02:16*arkurious quit (*.net *.split)
21:02:17*disso_peach quit (*.net *.split)
21:02:17*_________ quit (*.net *.split)
21:02:17*ehmry quit (*.net *.split)
21:02:19*via_ quit (*.net *.split)
21:02:19*ox quit (*.net *.split)
21:02:19*FromDiscord quit (*.net *.split)
21:02:19*def-- is now known as def-
21:02:23*fallback quit (Ping timeout: 240 seconds)
21:02:23*derpydoo quit (Ping timeout: 240 seconds)
21:02:23*mahlon quit (Ping timeout: 240 seconds)
21:02:54*FromDiscord joined #nim
21:05:52*fallback joined #nim
21:06:17*oprypin quit (Ping timeout: 240 seconds)
21:06:17*cyraxjoe quit (Ping timeout: 240 seconds)
21:07:17*arkurious joined #nim
21:09:10*__________ quit (Quit: Reconnecting)
21:09:28*_________ joined #nim
21:12:49FromDiscord<Forest> Anyone know why i could be getting this error?
21:12:52FromDiscord<Forest> https://hastebin.com/ebujayekab.nim
21:12:55FromDiscord<Forest> sent a code paste, see https://play.nim-lang.org/#ix=472H
21:13:11FromDiscord<Forest> sent a code paste, see https://play.nim-lang.org/#ix=472I
21:13:18FromDiscord<Forest> Same code as the file, just copy and pasted into the channel
21:13:27FromDiscord<Forest> (edit)
21:14:28FromDiscord<Forest> Anyone interested in the actual repo can look at https://github.com/Mythical-Forest-Collective/NGPU-Bindings
21:16:17FromDiscord<dom96> directory not writeable? i.e. permission problems
21:18:25FromDiscord<Forest> It should be writable, that's what I don't understand rip
21:18:35FromDiscord<Forest> It's running in Termux
21:19:45FromDiscord<leorize> isn't the issue that the file could not be found for `readFile`?
21:20:12FromDiscord<Forest> Hm maybe...
21:20:52FromDiscord<Forest> The cache dir is definitely read
21:24:08FromDiscord<leorize> I'm pretty sure your problem is in that conditional for copying
21:24:08FromDiscord<leorize> looks like the path you have is the full path, it won't start with `opir_` but rather `cache/opir_` or something
21:25:44FromDiscord<Forest> Aaaah that makes sense
21:26:09FromDiscord<Forest> Thanks aha, that makes sense lmao
21:30:48FromDiscord<Forest> That was fixed!
21:30:52FromDiscord<Forest> Now though, getting this:
21:31:01FromDiscord<Forest> sent a code paste, see https://play.nim-lang.org/#ix=472L
21:34:05FromDiscord<leorize> I'm pretty sure the iterator is called `items()`
21:34:27FromDiscord<Forest> Aah okay, thanks!
21:34:55FromDiscord<Forest> Same issue anyway
21:36:53FromDiscord<leorize> the problem could be that your node is an Object node and not an Array node
21:37:27FromDiscord<leorize> do you have a sample of the json file?
21:37:30FromDiscord<Forest> Possibly?
21:38:03FromDiscord<Forest> In reply to @Forest "Anyone interested in the": Oh yeah, it's absolutely massive though so i recommend looking at the GitHub repo for the smaller one
21:38:09FromDiscord<Forest> In the releases, `output.json`
21:41:27FromDiscord<Forest> Snippet
21:41:30FromDiscord<Forest> sent a code paste, see https://play.nim-lang.org/#ix=472P
21:43:09FromDiscord<leorize> looks like the matrix bridge is lagging again...
21:43:24FromDiscord<leorize> I guess your only option now is to print the parsed node to see what it is
21:44:24FromDiscord<Forest> Ah fair
21:44:32FromDiscord<Forest> In reply to @leorize "I guess your only": Alright, that'll be uh, very big
21:44:54FromDiscord<Forest> I'll hard code this json in for now
21:46:35FromDiscord<leorize> you can start with `echo jnode.kind` \:P
21:46:52*Goodbye_Vincent1 joined #nim
21:48:09FromDiscord<Forest> Aight
21:48:29*\u joined #nim
21:49:04FromDiscord<leorize> sent a code paste, see https://play.nim-lang.org/#ix=472R
21:49:16FromDiscord<leorize> maybe everything is just in this one field of the object and that's all you need to access
21:50:09FromDiscord<Forest> It's likely gonna be an array because of how the file is organised
21:50:32FromDiscord<Forest> The jnode kind is `JArray`
21:50:33*tanami_ joined #nim
21:51:00FromDiscord<leorize> top ten reasons why having stacktrace would save a lot of time...
21:51:16FromDiscord<Forest> Is there a way to show the stacktrace? :p
21:51:22*notchris_ joined #nim
21:51:23FromDiscord<Forest> Is it --stacktrace:on?
21:51:26FromDiscord<leorize> don't build it with release \:P
21:51:28FromDiscord<Forest> Idk just guessing+
21:51:30FromDiscord<Forest> Ooooh
21:51:58FromDiscord<leorize> I guess your problem is in that for loop
21:52:25FromDiscord<Forest> sent a code paste, see https://play.nim-lang.org/#ix=472S
21:52:32FromDiscord<Forest> In reply to @leorize "I guess your problem": Yeah it definitely is, crashes after one iteration
21:53:12FromDiscord<leorize> ah, there is the problem
21:53:27*laintree joined #nim
21:53:33FromDiscord<leorize> `contains()` when used on a node check if the node have the given key
21:53:41*fallback quit (Ping timeout: 272 seconds)
21:53:43FromDiscord<leorize> you need to `getStr` to unwrap that node into a string first
21:54:16*neceve joined #nim
21:54:19FromDiscord<Forest> Aaah okay, thanks aha, sorry for wasting ya time
21:55:08*Goodbye_Vincent quit (Ping timeout: 240 seconds)
21:55:08*tanami quit (Ping timeout: 240 seconds)
21:55:08*notchris quit (Ping timeout: 240 seconds)
21:55:08*madprops quit (Ping timeout: 240 seconds)
21:55:08*meowray quit (Ping timeout: 240 seconds)
21:55:09*lain quit (Ping timeout: 240 seconds)
21:55:09*Goodbye_Vincent1 is now known as Goodbye_Vincent
21:55:09*notchris_ is now known as notchris
21:55:27FromDiscord<Forest> Sweet it works! Thanks!
21:55:37*madprops joined #nim
21:55:37*madprops quit (Changing host)
21:55:37*madprops joined #nim
21:55:40FromDiscord<Forest> Is there also a way to save the JSON as a prettyprinted string?-
21:55:43FromDiscord<Forest> For indentation
21:57:06FromDiscord<leorize> `pretty()`
21:57:07FromDiscord<leorize> the packed form uses less space, though
21:57:10FromDiscord<leorize> use that if you don't need human to read it
21:57:14FromDiscord<Forest> Thanks!
21:57:36FromDiscord<Forest> In reply to @leorize "use that if you": Fair enough, just thinking it may be useful to read the file in situations we need to debug it
22:05:02FromDiscord<tomByrer> Is there a Nim lib for Chrome DevTools Protocol (eg 'headless Chrome browser')?ā†µā†µI'm used to Puppeteer & Playwright (JS) for this, but need more speed & less memory. Thought about using Go or Rust at first, but willing to try out Nim if there's already a lib wrapper for that API.
22:06:12*fallback joined #nim
22:07:30*tiorock joined #nim
22:07:30*tiorock quit (Changing host)
22:07:30*tiorock joined #nim
22:07:30*rockcavera quit (Killed (erbium.libera.chat (Nickname regained by services)))
22:07:30*tiorock is now known as rockcavera
22:08:13FromDiscord<leorize> https://nimble.directory/ \<- this would be the best place to look for such tools
22:08:24FromDiscord<leorize> though I couldn't find anything with my few cursory searches
22:13:04*krux02 joined #nim
22:22:58FromDiscord<dom96> In reply to @tomByrer "Is there a Nim": https://github.com/dom96/webdriver https://github.com/halonium/halonium
22:26:46FromDiscord<dom96> doubt you'll see more speed and less memory though tbh
22:38:31*neceve quit (Ping timeout: 268 seconds)
23:11:21FromDiscord<Forest> How do i prevent futhark from adding anything like `enum` to the names?
23:11:42FromDiscord<Forest> I just want the lowercased names with `_` and `` removed, that's it
23:16:15FromDiscord<hotdog> In reply to @Forest "How do i prevent": I think it adds enum when thereā€™s a name collision iirc
23:16:38FromDiscord<hotdog> You can provide a rename callback to have your own renaming mechanism
23:17:15FromDiscord<Forest> In reply to @hotdog "I think it adds": Does it? Huh
23:17:34FromDiscord<Forest> In reply to @hotdog "You can provide a": I'm gonna have to remove all those renamed functions then bleh
23:20:49FromDiscord<hotdog> In reply to @Forest "Does it? Huh": Yeah from the futhark readme - ā€œsome identifiers might collide the name will then further have the kind appended,ā€
23:20:57FromDiscord<hotdog> Check the section on renaming
23:21:19FromDiscord<Forest> Ah okay, thanks
23:21:30FromDiscord<!Patitotective> beef would say "RTFM"
23:21:56FromDiscord<hotdog> In reply to @Forest "Ah okay, thanks": No prob
23:22:31FromDiscord<Forest> In reply to @Patitotective "beef would say "RTFM"": Lmao probably for good reason
23:23:06FromDiscord<Forest> Wonder if i can get futhark to spit out a list of the renamed objects with a mapping to the original names
23:38:29FromDiscord<Forest> > If you want to rename an object or a field you can use the rename directive. Simply put rename <from>, <to> along with your other options. <from> can be either just an object name (before any other renaming) as a string or ident, or a field in the format <object>.<field> both the original C names either as two identifiers, or the whole thing as a single string.ā†µā†µSo the original C name is what we should use for `from` to rename it?
23:38:36FromDiscord<Forest> Brain is dying but i must get it complete lmao
23:38:54FromDiscord<Elegantbeef> https://github.com/beef331/wasmedge_playground/blob/master/src/wasmedge.nim#L5-L29
23:39:11FromDiscord<Elegantbeef> the `name` you get is the verbatim name iirc
23:39:25FromDiscord<Elegantbeef> You can do `echo name` to see
23:39:46FromDiscord<Forest> Verbatim name?
23:39:54FromDiscord<Elegantbeef> The C name
23:40:08FromDiscord<Forest> I'm not using the callback now, just using the `rename` field
23:40:18FromDiscord<Forest> In reply to @Elegantbeef "The C name": Thank fucking god i was so dumb
23:40:33FromDiscord<Forest> This is a piece of cake now, i thought it had to be something else specifically
23:42:37FromDiscord<Elegantbeef> This is the downside of futhark it's fully too difficult to see what the generated code looks like
23:42:59FromDiscord<Elegantbeef> Oh huantian i reasoned a second method of unexpanded macros in error messages
23:43:26FromDiscord<Elegantbeef> It's more likely to being accepted but still isnt ideal
23:43:39FromDiscord<Forest> Yeah understandable
23:43:45FromDiscord<Forest> In reply to @Elegantbeef "It's more likely to": Fair
23:43:53FromDiscord<Elegantbeef> What?
23:44:25FromDiscord<huantian> ooh what is it?
23:44:44FromDiscord<Elegantbeef> Dumbly storing a `Table[PNode, PNode]` on the `PContext` šŸ˜„
23:51:47FromDiscord<huantian> hmmm
23:52:03FromDiscord<huantian> I mean it sounds like it should work fine
23:52:20FromDiscord<Elegantbeef> https://github.com/beef331/Nim/commit/5ede9a2223b621ad7d6fba8d5b8249a16a9d25a2
23:52:28FromDiscord<Elegantbeef> Yea it's much better for memory than the other method
23:53:56FromDiscord<Elegantbeef> I really cant think of any other way of doing this with the current compiler design