00:03:22 | PMunch | @rem, for titlebars you need to reparent into a window and then draw the title yourself with whatever drawing library you're comfortable with |
00:03:44 | * | PMunch quit (Quit: leaving) |
00:04:16 | FromDiscord | <pmunch> @π§ππ’\: ^ |
00:04:48 | FromDiscord | <Elegantbeef> What a world pmunch have to go from one protocol to another just to ping someone on a completely seperate platform π |
00:07:42 | FromDiscord | <pmunch> That's just the kind of service I offer for this community π |
00:08:11 | FromDiscord | <Elegantbeef> Servicing the community one round about ping at a time |
00:13:40 | * | Guest24e joined #nim |
00:13:50 | Guest24e | uwu |
00:13:53 | * | Guest24e quit (Client Quit) |
00:18:38 | FromDiscord | <π§ππ’> ill take a look at it in a bit thank you pmunch |
00:44:25 | nrds | <Prestige99> Ah it pinged me but I was asleep |
00:44:38 | FromDiscord | <Elegantbeef> I have a name! |
00:44:55 | nrds | <Prestige99> I meant the program but yes, hello beef :) |
00:45:00 | nrds | <Prestige99> it pinged me both times |
00:47:07 | FromDiscord | <Elegantbeef> Of course that's what you meant, but my shitty jokes dont care! |
00:52:05 | * | krux02 quit (Remote host closed the connection) |
00:55:01 | * | lumo_e quit (Remote host closed the connection) |
00:59:15 | * | src_ quit (Quit: Leaving) |
01:34:07 | FromDiscord | <creikey> Anybody up to review a bit of nim code? |
01:34:55 | FromDiscord | <creikey> (edit) "Anybody up to review a bit of nim code? ... " added "https://github.com/creikey/learn-nim/blob/main/bf.nim would love to know what language features I should be using that would make this more concise" |
01:35:20 | FromDiscord | <Elegantbeef> Oh hell yea time make you cry! |
01:37:41 | FromDiscord | <Elegantbeef> https://github.com/creikey/learn-nim/blob/main/bf.nim#L64-L89 can be replaced with https://play.nim-lang.org/#ix=3FDb |
01:40:15 | FromDiscord | <Elegantbeef> https://github.com/creikey/learn-nim/blob/main/bf.nim#L9-L21 is just a more complicated https://play.nim-lang.org/#ix=3FDc |
01:40:54 | FromDiscord | <Elegantbeef> Dont need `result =` here https://github.com/creikey/learn-nim/blob/main/bf.nim#L34-L38 |
01:42:36 | FromDiscord | <Elegantbeef> Actually that can be done better |
01:43:53 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3FDd for instance |
01:44:25 | FromDiscord | <Elegantbeef> @creikey\: hopefully that's good enough π |
01:45:09 | FromDiscord | <creikey> In reply to @Elegantbeef "https://play.nim-lang.org/#ix=3FDd for instance": wow didn't know you could return var like that |
01:45:17 | FromDiscord | <creikey> In reply to @Elegantbeef "<@180866243819995136>\: hopefully that's good": yeah thanks a lot |
01:45:43 | FromDiscord | <Elegantbeef> `var` is just a pointer that cannot be held onto directly |
01:45:51 | FromDiscord | <Elegantbeef> Well presently |
01:46:28 | FromDiscord | <Elegantbeef> It's slightly safer than `ptr int`, since you cannot hold onto it and have a pointer that outlives an object |
01:46:52 | FromDiscord | <creikey> yeah I read in the tutorial that ptr was mainly for C interop but I couldn't figure out how else to do what I was trying to do |
01:47:01 | FromDiscord | <creikey> https://github.com/creikey/learn-nim/blob/main/bf.nim |
01:47:03 | FromDiscord | <creikey> added all of your changes |
01:47:20 | FromDiscord | <creikey> 3 less lines and easier to read 10/10 review |
01:47:25 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FDe |
01:48:02 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=3FDf |
01:48:12 | FromDiscord | <Elegantbeef> Neither, it'll silently work |
01:48:28 | FromDiscord | <Elegantbeef> It's a dangling pointer so you just have a pointer to memory that can be grown into and reused |
01:48:53 | FromDiscord | <Elegantbeef> The way the stack works is when you enter a new procedure you grow the stack with all the variables you need, so eventually you'll have a pointer to something you dont want to |
01:49:21 | FromDiscord | <creikey> the stack isn't lost after the proc is finished? |
01:49:35 | FromDiscord | <creikey> In reply to @Elegantbeef "It's a dangling pointer": oh yeah I see what you mean |
01:49:48 | FromDiscord | <Elegantbeef> Well it is but it doesnt 0 it or anything, it just goes up and new initialisation will write over it |
01:49:52 | FromDiscord | <creikey> it's still valid program memory so the operating system won't get mad but it's somewhere farther up in the stack the program isn't using right now |
01:50:01 | FromDiscord | <Elegantbeef> Yep |
01:50:10 | FromDiscord | <Elegantbeef> Dangling pointers are worse than nilable ptrs |
01:50:31 | FromDiscord | <Elegantbeef> Atleast when you dereference a nil pointer you know it's a nil reference, a dangling pointer will seem phantomlike |
01:50:37 | FromDiscord | <creikey> var is guaranteed to not dangle? you said you couldn't hold a reference to it, does that mean you couldn't do like var foo = getMem() |
01:50:50 | FromDiscord | <creikey> In reply to @Elegantbeef "Atleast when you dereference": yeah I actually like when a program segfaults |
01:50:54 | FromDiscord | <creikey> at least you know |
01:51:07 | FromDiscord | <Elegantbeef> You can do that but it's a copy until view types are stable |
01:51:08 | FromDiscord | <Elegantbeef> View types are nim's borrowed checked type stuff |
01:51:28 | FromDiscord | <creikey> worst thing to deal with ever is a silent memory bug in a machine learning backpropagation function so the model doesn't learn things and you think it's a problem with the math not the programming |
01:51:37 | FromDiscord | <Elegantbeef> In a future Nim when you'd do `var foo = getMem()` it'd check to ensure `foo` does not outlive the place of borrow |
01:51:47 | FromDiscord | <Elegantbeef> So with a global variable it'd never outlive it |
01:51:58 | FromDiscord | <creikey> In reply to @Elegantbeef "In a future Nim": like the borrow checker in rust |
01:52:13 | FromDiscord | <Elegantbeef> Yep |
01:52:44 | FromDiscord | <π§ππ’> so i took a nap, sorry for that but i can send my code |
01:52:49 | FromDiscord | <Elegantbeef> The premise of them are very nice since they allow you to get more performance and safer APIs |
01:53:04 | FromDiscord | <creikey> In reply to @Elegantbeef "You can do that": would view types need a special annotation? it seems kinda strange that things would just be copied like that and there's no indication that you're not mutating the variable returned as var |
01:53:18 | FromDiscord | <Elegantbeef> Well `var` would be the annotation |
01:53:36 | FromDiscord | <creikey> at the call site I mean |
01:54:03 | FromDiscord | <Elegantbeef> I think there was at a point, but idk if the newer stuff needs it |
01:54:07 | FromDiscord | <creikey> so like `var foo = getMem()` copies the `var uint8` that's returned instead of having amutable reference |
01:54:19 | FromDiscord | <creikey> (edit) "so like `var foo = getMem()` copies the `var uint8` that's returned instead of having amutable reference ... " added "right now, but after the change it goes to having a mutable reference with no change in syntax" |
01:54:19 | FromDiscord | <Elegantbeef> the syntax `var foo: var uint8 = getMem()` was floated at one point |
01:54:25 | FromDiscord | <creikey> (edit) "amutable" => "a mutable" |
01:54:30 | FromDiscord | <Elegantbeef> Dont know if that's the present idea |
01:54:39 | FromDiscord | <π§ππ’> https://pastebin.com/3AXZrarE |
01:54:56 | FromDiscord | <π§ππ’> could u guys have a look and see if im reparenting it wrong? |
01:55:11 | FromDiscord | <Elegantbeef> You can read about them if you want, but it's not stable so stuff will change https://nim-lang.org/docs/manual_experimental.html#view-types |
01:55:51 | FromDiscord | <creikey> lol proc view type |
01:55:58 | FromDiscord | <creikey> monkeypatching when |
01:56:29 | FromDiscord | <π§ππ’> elegantbeef could u and possibly pmunch have a look at that code pls? |
01:56:41 | FromDiscord | <creikey> In reply to @π§ππ’ "https://pastebin.com/3AXZrarE": is this nim calling C or is there a nice x11 nim library |
01:56:53 | FromDiscord | <Elegantbeef> It's nim -\> C X11 |
01:56:55 | FromDiscord | <π§ππ’> nim x11 library but its very raw |
01:57:03 | FromDiscord | <π§ππ’> i abstracted most of the functions myself |
01:57:07 | FromDiscord | <Elegantbeef> X11 isnt a terrible C API, there are some ugly bits, but it's pretty tame |
01:57:29 | * | Guest4437 joined #nim |
01:57:31 | FromDiscord | <Elegantbeef> Like i said rem i'm not that competent with X11, it seems mostly fine |
01:57:42 | FromDiscord | <π§ππ’> except its not because it doesnt show the titlebar... |
01:57:52 | FromDiscord | <creikey> In reply to @Elegantbeef "X11 isnt a terrible": I wouldn't say the api is the problem, more how the underlying structure of x11 is obfuscated and poorly documented |
01:58:11 | FromDiscord | <π§ππ’> it has white here https://media.discordapp.net/attachments/371759389889003532/911797607301545995/unknown.png |
01:58:17 | FromDiscord | <Elegantbeef> Indeed, the most fun part is trying to reason how to make it work |
01:58:21 | FromDiscord | <π§ππ’> the titlebar should be `0x0000ff` |
01:58:42 | FromDiscord | <π§ππ’> i spent hours trying to get this working and couldnt figure out whats wrong w/ it |
01:59:10 | FromDiscord | <Elegantbeef> Isnt the colour stuff an index in a colour map and not a hex colour? |
01:59:27 | FromDiscord | <creikey> In reply to @π§ππ’ "i spent hours trying": the most productive x11 development session |
01:59:32 | FromDiscord | <π§ππ’> In reply to @Elegantbeef "Isnt the colour stuff": no |
01:59:41 | FromDiscord | <π§ππ’> this works fine |
01:59:49 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=3FDh |
01:59:51 | FromDiscord | <π§ππ’> BgColor and BorderColor are hex values |
02:00:38 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=3FDl |
02:00:39 | FromDiscord | <π§ππ’> so it makes zero fucking sense |
02:01:13 | FromDiscord | <π§ππ’> it definitely supports hex codes to some degree @ElegantBeef |
02:03:29 | FromDiscord | <Elegantbeef> So doing `0x00ff00` makes it what colour? |
02:04:03 | FromDiscord | <π§ππ’> green |
02:04:10 | FromDiscord | <π§ππ’> but NOT the titlebar |
02:04:11 | * | Guest4437 quit (Ping timeout: 256 seconds) |
02:04:18 | FromDiscord | <π§ππ’> just the frames background color or border |
02:05:10 | FromDiscord | <Elegantbeef> Well i dont know what to say |
02:05:18 | FromDiscord | <Elegantbeef> X11 hasnt been kind to me even at the best of times |
02:06:13 | * | Guest2 joined #nim |
02:06:52 | FromDiscord | <π§ππ’> can we ping the x11 gods |
02:07:02 | nrds | <Prestige99> hello, what's going on here |
02:07:09 | FromDiscord | <π§ππ’> oh shit he has spoken |
02:07:14 | nrds | <Prestige99> lmao |
02:07:17 | FromDiscord | <π§ππ’> my x11 titlebar isnt showing up |
02:07:24 | FromDiscord | <Elegantbeef> Psh most of his knowledge comes from my first WM π |
02:07:25 | FromDiscord | <π§ππ’> and i cant figure out why |
02:07:39 | nrds | <Prestige99> shhh beef |
02:08:52 | * | Guest2 quit (Client Quit) |
02:09:40 | FromDiscord | <π§ππ’> so any ideas prestige? |
02:09:47 | FromDiscord | <π§ππ’> i sent the code above i can relink if u want |
02:09:56 | nrds | <Prestige99> Looking at the pastebin atm, was this? https://pastebin.com/3AXZrarE |
02:10:08 | FromDiscord | <π§ππ’> yeah this is it |
02:10:36 | nrds | <Prestige99> Isn't the decoration the parent? |
02:10:39 | nrds | <Prestige99> supposed to be* |
02:11:38 | nrds | <Prestige99> If you haven't seen https://jichu4n.com/posts/how-x-window-managers-work-and-how-to-write-one-part-iii/ I'd recommend it |
02:11:52 | nrds | <Prestige99> there's a bit in there about reparenting |
02:12:13 | FromDiscord | <π§ππ’> read this |
02:12:18 | FromDiscord | <π§ππ’> btu it didnt cover this much |
02:12:22 | FromDiscord | <π§ππ’> besides framing the window |
02:13:01 | FromDiscord | <π§ππ’> if i make the thing a parent |
02:13:03 | FromDiscord | <π§ππ’> i get this |
02:13:10 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=3FDo |
02:13:12 | nrds | <Prestige99> is this all the code? I could check it out in like 30 mins when I'm not busy |
02:13:22 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=3FDp |
02:13:24 | FromDiscord | <π§ππ’> this is just the code for reparenting |
02:13:50 | FromDiscord | <π§ππ’> if u can throw together a dummy x11 thing quickly and get this working id appreciate it |
02:14:16 | FromDiscord | <π§ππ’> i could push the broken code to github if u would rather |
02:14:23 | nrds | <Prestige99> sure |
02:15:36 | FromDiscord | <π§ππ’> lemme make a branch temporarily |
02:16:18 | FromDiscord | <π§ππ’> actually fuck it ill just push to main and add a ntoe its broken |
02:16:18 | FromDiscord | <Elegantbeef> I'm waiting for a DM from prestige that says "Stop telling people i know anything about X11, the shit is unknowable" |
02:17:18 | nrds | <Prestige99> lol |
02:18:30 | nrds | <Prestige99> I'm busy for like 30 mins but should be able to help after |
02:20:16 | FromDiscord | <π§ππ’> https://github.com/megabytesofrem/whim |
02:54:12 | FromDiscord | <π§ππ’> could u take a look at it? |
02:55:03 | nrds | <Prestige99> taking a look now |
02:55:45 | FromDiscord | <codic> oh wow @π§ππ’ it's you |
02:57:20 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3FDC |
02:58:09 | FromDiscord | <π§ππ’> wdym |
02:58:18 | FromDiscord | <π§ππ’> im tryint to add the subwindow for the titlebar frame |
02:58:21 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3FDE |
02:58:34 | FromDiscord | <codic> 1 sec lemme look at your code |
02:59:36 | nrds | <Prestige99> So is anything working atm? or |
02:59:44 | FromDiscord | <π§ππ’> wdym |
02:59:50 | FromDiscord | <π§ππ’> the border around the windows works |
02:59:53 | FromDiscord | <codic> @π§ππ’ you never map `w` π |
02:59:57 | FromDiscord | <π§ππ’> just the titkebar color doesnt work |
02:59:59 | FromDiscord | <codic> change this to |
03:00:03 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3FDF |
03:00:04 | nrds | <Prestige99> hm I tried to spawn a terminal but it's just black |
03:00:11 | FromDiscord | <π§ππ’> bc u dont have urxvt |
03:00:15 | FromDiscord | <codic> sent a code paste, see https://paste.rs/Q9r |
03:00:24 | nrds | <Prestige99> nah I tried spawning my terminal inside it |
03:00:29 | FromDiscord | <codic> you need to map the child of the frame too |
03:00:31 | FromDiscord | <π§ππ’> weird it works fro me |
03:00:45 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=3FDJ |
03:01:01 | nrds | <Prestige99> yeah looks like you only map the frame |
03:01:02 | FromDiscord | <codic> That should work yeah |
03:01:30 | FromDiscord | <codic> well |
03:01:33 | FromDiscord | <codic> [frame, w, decoration] |
03:01:35 | FromDiscord | <codic> you need to map all 3 |
03:01:50 | FromDiscord | <codic> I don't know how it's working for you right now |
03:01:51 | FromDiscord | <π§ππ’> hoyl shit that did it |
03:01:53 | FromDiscord | <codic> π |
03:01:54 | FromDiscord | <π§ππ’> idk |
03:02:01 | FromDiscord | <π§ππ’> i followed that guys tutorial in C++ |
03:02:02 | nrds | <Prestige99> Lol |
03:02:05 | FromDiscord | <π§ππ’> pretty shit tutorial if i may add |
03:02:13 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3FDK |
03:02:15 | FromDiscord | <codic> the code is shit but it explains the concepts rather nicely |
03:02:18 | FromDiscord | <π§ππ’> https://github.com/jichu4n/basic_wmβ΅this shit tutorial |
03:02:21 | nrds | <Prestige99> there aren't many good tuts around I think |
03:02:42 | FromDiscord | <π§ππ’> @codic send ur wm |
03:02:46 | FromDiscord | <π§ππ’> ill take a look at it |
03:02:51 | nrds | <Prestige99> but yeah, need to map everything. Makes the windows visible |
03:03:02 | nrds | <Prestige99> @codic is your wm reparenting? |
03:03:04 | FromDiscord | <π§ππ’> i thought u only map the parent window |
03:03:44 | FromDiscord | <codic> In reply to @nrds "<Prestige> <@562086061153583122> is your": indeed |
03:03:49 | FromDiscord | <codic> In reply to @π§ππ’ "i thought u only": no, you need to map everything |
03:03:58 | FromDiscord | <codic> by that logic mapping `root` would map everything lol |
03:04:13 | FromDiscord | <π§ππ’> ahh |
03:04:43 | nrds | <Prestige99> Nice. I don't reparent, but then again I don't care for titlebars |
03:04:43 | FromDiscord | <π§ππ’> so that was just the issue the whole time |
03:04:45 | FromDiscord | <π§ππ’> the code was fine |
03:04:57 | FromDiscord | <codic> I haven't published it on github or anything yet, and it needs a couple other files to run (and also I need to refactor some shit), but it should help with getting gist: https://www.toptal.com/developers/hastebin/wocoqehure.rust |
03:05:01 | FromDiscord | <codic> (edit) "gist:" => "the gist of how to do stuff:" |
03:05:10 | FromDiscord | <codic> In reply to @nrds "<Prestige> Nice. I don't": Yeah tbh reparenting is a huge pain in the ass |
03:05:14 | FromDiscord | <π§ππ’> whys it say this is rust |
03:05:22 | FromDiscord | <Elegantbeef> Cause codic likes self harm |
03:05:23 | FromDiscord | <Elegantbeef> I mean |
03:05:30 | FromDiscord | <codic> Idk |
03:05:30 | FromDiscord | <codic> hastebin sucks |
03:05:31 | FromDiscord | <codic> I don't know why the Hastebin link changed either |
03:05:36 | FromDiscord | <codic> no it's nim |
03:05:38 | FromDiscord | <codic> smh |
03:05:44 | FromDiscord | <π§ππ’> also wtf is XInternAtom |
03:05:51 | FromDiscord | <codic> gets atom int from string |
03:05:58 | FromDiscord | <codic> https://tronche.com/gui/x/xlib/window-information/properties-and-atoms.html |
03:06:00 | FromDiscord | <Elegantbeef> It uses a herusitic to find the file extension and nim has similarities to rust |
03:06:01 | FromDiscord | <π§ππ’> do i need to worry about this shit yet |
03:06:07 | FromDiscord | <Elegantbeef> `let x: T` for instance |
03:06:18 | FromDiscord | <π§ππ’> thats like saying typescript is rust |
03:06:21 | FromDiscord | <codic> nah, but you do if you want to write something usable in the long run |
03:06:22 | FromDiscord | <π§ππ’> because both have lets |
03:06:28 | FromDiscord | <codic> hastebin's file detection is the worst thing ever |
03:06:34 | FromDiscord | <Elegantbeef> That's not what i said |
03:06:35 | FromDiscord | <π§ππ’> this documentation looks kinda aids ngl |
03:06:37 | FromDiscord | <codic> it often classifies languages it supports as other shit |
03:06:40 | FromDiscord | <Elegantbeef> I said it uses heuristics |
03:06:52 | FromDiscord | <π§ππ’> so what the fuck do i need to implement in the WM |
03:06:55 | FromDiscord | <π§ππ’> and how would i go about doing it |
03:07:13 | nrds | <Prestige99> depends on the goals of your WM really |
03:07:15 | FromDiscord | <Elegantbeef> That doc is pretty much where i got most the information |
03:07:27 | FromDiscord | <codic> ^ + reading and stealing from other WMs :p |
03:07:28 | FromDiscord | <codic> and stack overflow |
03:07:30 | FromDiscord | <π§ππ’> this doc looks very aids to read |
03:07:47 | nrds | <Prestige99> https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html |
03:08:11 | FromDiscord | <Elegantbeef> Well then stop implementing the WM there isnt much on X11's api |
03:08:12 | nrds | <Prestige99> https://tronche.com/gui/x/xlib/ btw |
03:08:25 | FromDiscord | <π§ππ’> In reply to @Elegantbeef "Well then stop implementing": wdym |
03:08:42 | FromDiscord | <π§ππ’> i wanna write my own for fun but this looks confusing as fuck to implement all these stuff |
03:08:50 | FromDiscord | <codic> Also ewmh is very useful https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html |
03:08:53 | FromDiscord | <codic> Oh damn prestige just sent that |
03:08:57 | nrds | <Prestige99> :) |
03:09:04 | nrds | <Prestige99> @ : yes it's crazy a bit |
03:09:05 | FromDiscord | <Elegantbeef> There isnt much easily digestable information on X11 so these docs are the best, plus already existing implementations |
03:09:07 | FromDiscord | <π§ππ’> so are these just variables i set on the WM? |
03:09:21 | FromDiscord | <codic> Atoms are very general purpose |
03:09:25 | FromDiscord | <π§ππ’> to let clients know shit about it? |
03:09:36 | FromDiscord | <codic> They can be "Variables" you set on windows, they can be used in ClientMessageEvents, etc |
03:09:42 | FromDiscord | <codic> For example |
03:09:56 | FromDiscord | <codic> Say you want to set the window title of your window (from client perspective ) |
03:10:03 | FromDiscord | <codic> You set the WM_NAME or _NET_WM_NAME atom on it |
03:10:10 | FromDiscord | <codic> Or, if your WM wants to set it's name, you do that on the root window |
03:10:21 | FromDiscord | <π§ππ’> can i read that atom and get the window title? |
03:10:27 | FromDiscord | <codic> yes |
03:10:34 | FromDiscord | <π§ππ’> ahhhh i see |
03:10:38 | FromDiscord | <codic> XFetchName, the other is a bit more complex, but the code is in my wm |
03:10:40 | FromDiscord | <π§ππ’> this isnt that hard as i thought then |
03:10:43 | FromDiscord | <codic> Another use case; say you (the client) wanna fullscreen a window |
03:10:45 | FromDiscord | <π§ππ’> its just global variables i assume |
03:11:07 | FromDiscord | <codic> You send a ClientMessage to the root window saying _NET_WM_WINDOW_FULLSCREEN |
03:11:12 | FromDiscord | <codic> And you give your window id as the 2nd parameter |
03:11:27 | FromDiscord | <codic> And whether to fullscreen or un-fullscreen as 3rd |
03:11:36 | FromDiscord | <codic> Then the WM reads that and, well, fullscreens/unfullscreens |
03:11:45 | FromDiscord | <π§ππ’> i see |
03:11:55 | FromDiscord | <π§ππ’> but if my wm wont support fullscreen windows for e g? |
03:11:59 | FromDiscord | <π§ππ’> then i dont nee dto add that or? |
03:12:36 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3FDM |
03:12:47 | FromDiscord | <codic> In reply to @π§ππ’ "then i dont nee": sure, ig |
03:12:57 | FromDiscord | <π§ππ’> can i just use XFetchName |
03:13:01 | FromDiscord | <codic> that was just one example of course |
03:13:02 | FromDiscord | <π§ππ’> instead of this or |
03:13:30 | FromDiscord | <π§ππ’> also what is netAtoms |
03:13:44 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3FDO |
03:13:47 | FromDiscord | <codic> but a lot of modern clients will set _NET_WM_NAME |
03:13:50 | FromDiscord | <codic> and ancient ones WM_NAME |
03:13:53 | FromDiscord | <codic> so my method tries both |
03:13:57 | FromDiscord | <π§ππ’> is `ret.addr` same as addr ret |
03:14:00 | FromDiscord | <π§ππ’> just you did it weirdly |
03:14:13 | FromDiscord | <codic> In reply to @π§ππ’ "is `ret.addr` same as": yes |
03:14:15 | FromDiscord | <codic> I don't see what's weird |
03:14:19 | FromDiscord | <codic> Nim has ufcs |
03:14:32 | FromDiscord | <π§ππ’> i thought it was a keyword at first |
03:14:34 | FromDiscord | <codic> x y and y.x are equivalent |
03:14:37 | FromDiscord | <codic> no, it's a function |
03:14:54 | FromDiscord | <codic> a "magic" function (implemented in compilier), but still a function, so syntaxually all the function rules apply |
03:15:13 | FromDiscord | <codic> netAtoms is the array of atoms, which I might or might not have copied from Prestige's nimdow because too lazy to write it all out |
03:15:33 | nrds | <Prestige99> https://github.com/avahe-kellenberger/nimdow if you're interested |
03:15:50 | nrds | <Prestige99> I think.. https://github.com/avahe-kellenberger/nimdow/blob/master/src/nimdowpkg/xatoms.nim |
03:16:20 | FromDiscord | <π§ππ’> ill take a look, thanks |
03:19:08 | FromDiscord | <codic> yes I stole it from there |
03:19:14 | FromDiscord | <codic> I have no shame! |
03:19:51 | FromDiscord | <codic> i did add a couple things I needed for my wm though |
03:20:52 | FromDiscord | <codic> btw prestige I implemented _NET_FRAME_EXTENTS in worm, mind if I submit a pr to nimdow for that? |
03:21:10 | nrds | <Prestige99> Sure thing |
03:21:13 | FromDiscord | <codic> ewmh says it is a "MUST", and for nimdow it's really simple to add because of no titlebar |
03:21:17 | FromDiscord | <codic> π |
03:21:21 | FromDiscord | <π§ππ’> wait are u the worm guy |
03:21:35 | FromDiscord | <π§ππ’> @codic |
03:21:41 | FromDiscord | <codic> yes |
03:21:48 | FromDiscord | <π§ππ’> ur thing inspired me kinda |
03:22:17 | FromDiscord | <codic> π the link I sent is the rewrite of worm |
03:22:39 | FromDiscord | <codic> (edit) "π the ... linkcontains" added "hastebin" | "is" => "contains part of" |
03:23:12 | FromDiscord | <codic> btw you just said 4 days ago β΅> yeah i could never do thatβ΅and now you are, cool! |
03:25:26 | FromDiscord | <π§ππ’> im rewriting the code to be more modular rn |
03:25:41 | FromDiscord | <π§ππ’> i only started learning nim a few days ago but i got the hang of it fast |
03:26:00 | FromDiscord | <π§ππ’> probably bc its syntactically similar to python and other languages mixed together |
03:36:31 | * | arkurious quit (Quit: Leaving) |
03:37:26 | nrds | <Prestige99> @Elegantbeef pointer question again. Need to call a proc from inside a cdecl callback, I'm able to store a pointer to this proc and that pointer is passed to the callback. But I must not be referencing it correctly, again |
03:37:49 | nrds | <Prestige99> https://play.nim-lang.org/#ix=3FDQ |
03:39:42 | FromDiscord | <Pietro Peterlongo> More mentions of Nim than expected in this HN discussion about upcoming Advent of Code\: https://news.ycombinator.com/item?id=29292818 |
03:40:13 | FromDiscord | <Elegantbeef> Where do you reference it again? |
03:40:29 | nrds | <Prestige99> that userData object is just a pointer |
03:40:40 | nrds | <Prestige99> so that let cb line |
03:41:00 | FromDiscord | <Elegantbeef> Ok so can we remove this from your code? |
03:41:24 | nrds | <Prestige99> which part? |
03:41:54 | FromDiscord | <Elegantbeef> The entire thing so i can reason the issue at hand and run it |
03:42:37 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3FDT like this |
03:43:08 | nrds | <Prestige99> what's the nimcall pragma? |
03:43:18 | FromDiscord | <Elegantbeef> It's a calling convention |
03:43:33 | FromDiscord | <Elegantbeef> Like `cdecl` or `closure` it's Nim's default calling convention |
03:44:04 | nrds | <Prestige99> uh I'll slim down my example I guess |
03:44:20 | nrds | <Prestige99> https://play.nim-lang.org/#ix=3FDU |
03:44:23 | FromDiscord | <Elegantbeef> It's nice to be able to run it π |
03:44:31 | nrds | <Prestige99> I'll have to think about how to easily recreate this |
03:44:56 | FromDiscord | <Elegantbeef> The issue is probably the `ptr proc` since nim stores them as pointers that's redundant |
03:45:08 | nrds | <Prestige99> wouldn't it be a ptr to a ptr? |
03:45:11 | FromDiscord | <Elegantbeef> it should just be `proc(){.nimcall.}` or similar |
03:45:47 | nrds | <Prestige99> seems I can't past a proc to a pointer |
03:45:52 | nrds | <Prestige99> cast* |
03:46:03 | FromDiscord | <Elegantbeef> I literally just did |
03:46:36 | nrds | <Prestige99> weird, I get an error saying I can't |
03:46:48 | FromDiscord | <Elegantbeef> A concrete proc to pointer? |
03:47:27 | nrds | <Prestige99> I have tho `callback: proc()` param, then I create `var c = callback` then I can't cast c to a pointer |
03:47:35 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3FDV |
03:47:37 | FromDiscord | <Elegantbeef> Remember `proc()` is a closure |
03:47:44 | FromDiscord | <Elegantbeef> you need to specify `{.nimCall.}` |
03:48:09 | nrds | <Prestige99> oh? I need to find the docs on that |
03:48:47 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#types-procedural-type |
03:49:50 | nrds | <Prestige99> hm I'll try recreating it |
03:50:21 | * | vicecea quit (Remote host closed the connection) |
03:50:50 | * | vicecea joined #nim |
03:53:16 | nrds | <Prestige99> ok https://play.nim-lang.org/#ix=3FE1 |
03:53:22 | nrds | <Prestige99> (original recreated) |
03:53:52 | nrds | <Prestige99> so you're saying I should add {.nimCall.} to the callback param type? |
03:57:16 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3FE3 |
03:58:54 | nrds | <Prestige99> aha, thanks |
03:59:26 | nrds | <Prestige99> "As a special extension, a procedure of the calling convention nimcall can be passed to a parameter that expects a proc of the calling convention closure" |
03:59:34 | nrds | <Prestige99> So how is this different from {.closure.} ? |
03:59:54 | FromDiscord | <Elegantbeef> closures store other data with the pointer to hold the state |
04:00:39 | nrds | <Prestige99> so it's just a little more efficient? Cool, I could be using this in a lot of places instead of closure then... |
04:02:47 | FromDiscord | <Elegantbeef> A bit and it also points at the proc π |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:31 | * | supakeen joined #nim |
06:23:19 | FromDiscord | <π§ππ’> hey all |
06:23:24 | FromDiscord | <π§ππ’> i have another ambiguous error |
06:23:51 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=3FEu |
06:24:03 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=3FEv |
06:24:04 | FromDiscord | <π§ππ’> trying to use it like |
06:24:12 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=3FEw |
06:24:34 | FromDiscord | <π§ππ’> what am i doing wrong here |
06:24:57 | FromDiscord | <Elegantbeef> You're using a macro for a template |
06:25:32 | FromDiscord | <π§ππ’> wdym |
06:25:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FEx |
06:27:03 | FromDiscord | <π§ππ’> same issue |
06:27:11 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=3FEy |
06:27:18 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=3FEz |
06:27:26 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=3FEA |
06:27:38 | FromDiscord | <π§ππ’> (edit) "same" => "still has" |
06:28:24 | FromDiscord | <Elegantbeef> should binding be `: string`? |
06:28:32 | FromDiscord | <π§ππ’> yeah |
06:28:33 | FromDiscord | <Elegantbeef> I dont even see `'8'` here |
06:28:45 | FromDiscord | <π§ππ’> not the issue tho |
06:28:50 | FromDiscord | <π§ππ’> Mod1Mask is being converted to 8 |
06:28:58 | FromDiscord | <π§ππ’> its `int literal(8)` |
06:29:09 | FromDiscord | <π§ππ’> cant do shit about that btw its just the ugly X11 api |
06:29:17 | FromDiscord | <Elegantbeef> Yea i know |
06:29:31 | FromDiscord | <π§ππ’> so what do i do to fix it |
06:29:35 | FromDiscord | <π§ππ’> the template broke it |
06:29:38 | FromDiscord | <Elegantbeef> ah yes the issue is `modMask` is replaced with `8: 8` |
06:29:40 | FromDiscord | <π§ππ’> it wasnt working w/ the macro before |
06:29:48 | FromDiscord | <π§ππ’> yeah |
06:29:51 | FromDiscord | <π§ππ’> so what do i do |
06:29:55 | FromDiscord | <Elegantbeef> change the `modMask` param to something like `modMsk` |
06:30:06 | FromDiscord | <Elegantbeef> then the field `modMask` will not get replaced with `7` |
06:30:12 | FromDiscord | <Elegantbeef> `8` even |
06:30:26 | FromDiscord | <π§ππ’> back to the fucking problem 1 |
06:30:33 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=3FEB |
06:30:37 | FromDiscord | <Elegantbeef> Do you have tables imported? |
06:30:47 | FromDiscord | <π§ππ’> im about to kill myself |
06:30:48 | FromDiscord | <π§ππ’> no |
06:31:07 | FromDiscord | <π§ππ’> this is the only language that requires that which is weird |
06:31:24 | FromDiscord | <Elegantbeef> type bound operations are a RFC, so go upvote that if you want it |
06:31:28 | FromDiscord | <Elegantbeef> Well free standing procedures are lovely |
06:31:55 | FromDiscord | <Elegantbeef> Why dont you put an `export tables` in the file where you import? |
06:32:07 | FromDiscord | <Elegantbeef> in the file you import\ |
06:32:42 | FromDiscord | <Elegantbeef> Might i suggest right here put `export tables` |
06:32:44 | FromDiscord | <Elegantbeef> https://github.com/megabytesofrem/whim/blob/main/src/whim/types.nim#L3 |
06:33:06 | FromDiscord | <Elegantbeef> Then you dont have to import tables ever you just `import types` |
06:34:37 | FromDiscord | <Elegantbeef> not having it come with the type is annoying in some cases, but you didnt do yourselfs any favours ignoring me π |
06:36:13 | FromDiscord | <π§ππ’> thats old code on github i rewrote the entire thing |
06:36:19 | FromDiscord | <π§ππ’> ill add an export tho lol |
06:36:56 | FromDiscord | <Elegantbeef> Hey the code was changed 4 hours ago, so that's after i said you can/should export tables! π |
06:39:09 | FromDiscord | <Rika> In reply to @π§ππ’ "this is the only": Well this language is weird, and I guess it also embraces it really hard |
06:41:09 | NimEventer | New thread by Oyster: Strformat with user-defined width?, see https://forum.nim-lang.org/t/8644 |
06:41:21 | FromDiscord | <π§ππ’> 4 hrs is an eternity :p https://media.discordapp.net/attachments/371759389889003532/911868868748804136/unknown.png |
06:44:52 | FromDiscord | <Rika> Damn beef you quick |
06:45:34 | FromDiscord | <Elegantbeef> Gotta race to get those invisible karma points |
06:46:27 | FromDiscord | <Elegantbeef> Do have to appreciate that they used `var width = 2` for simulating user input, nice to see |
06:46:38 | FromDiscord | <Rika> No u |
06:50:36 | FromDiscord | <Elegantbeef> I'm nice to see? |
06:50:41 | FromDiscord | <Elegantbeef> Dont fucking lie to me rika |
07:27:15 | NimEventer | New thread by Plgupa: Course on Nim programming language, see https://forum.nim-lang.org/t/8645 |
07:55:57 | * | gbrlmarn joined #nim |
07:56:33 | * | gbrlmarn quit (Client Quit) |
08:37:24 | * | terminalpusher joined #nim |
09:36:41 | FromDiscord | <Samyak2306> greetings developers. I need help regarding the following. I m a programmer since 5 years. I make physics and maths simulations and sometimes 2d games for fun. I want to earn with my skills. Is there a server where a beginner like me can get opportunity to start earning |
09:38:15 | FromDiscord | <Elegantbeef> This server is related to the Nim programming language |
09:38:45 | FromDiscord | <Samyak2306> oh |
09:40:12 | FromDiscord | <enthus1ast> @Samyak2306\: But now that you're here, you could have a look at Nim, its fun \:) |
09:40:59 | FromDiscord | <Rika> What |
09:41:17 | FromDiscord | <Samyak2306> no thanks. I m a maths and physics enthusiast. I make simulations and I m happy with thatπ
|
09:42:04 | FromDiscord | <Rika> Okay |
09:44:24 | * | Vladar joined #nim |
09:44:36 | FromDiscord | <evoalg> @ElegantBeef once you asked me what programming language I come from (python for me, but I don't even know that well) ...what programming language did you come from? |
09:45:50 | FromDiscord | <Rika> C# |
09:45:54 | FromDiscord | <Rika> He comes from C# |
09:46:34 | FromDiscord | <evoalg> oh ok! |
09:47:07 | FromDiscord | <evoalg> and you Rika from C/C++ ? |
09:47:11 | FromDiscord | <Elegantbeef> Yea what rika said |
09:47:48 | FromDiscord | <Elegantbeef> I'd hardly say i came from C# though since i was a shit programmer |
09:47:56 | FromDiscord | <Rika> I come from Python surprisingly |
09:48:07 | FromDiscord | <Rika> Surprisingly for you perhaps |
09:48:13 | FromDiscord | <Elegantbeef> But then again i never used a system language which i feel encourages becoming a less shitty one |
09:48:17 | FromDiscord | <evoalg> hehe |
09:48:34 | FromDiscord | <Rika> I was frustrated with how slow it was like most people who move from Python |
09:49:02 | FromDiscord | <evoalg> Rika do you still do stuff in python sometimes though? |
09:49:16 | FromDiscord | <Rika> No |
09:49:19 | FromDiscord | <Rika> Iβve completely left it |
09:49:30 | FromDiscord | <evoalg> wow ... divorced |
09:49:37 | FromDiscord | <Rika> All I can do in Python I can do in Nim better |
09:49:51 | FromDiscord | <evoalg> Nice |
09:49:55 | FromDiscord | <Rika> Not touching that shit again |
09:50:03 | FromDiscord | <evoalg> lol |
09:50:12 | FromDiscord | <Rika> Unless god forces my hand or something I guess |
09:50:27 | FromDiscord | <evoalg> @ElegantBeef will you go back for c#? ... perhaps for work? |
09:50:39 | FromDiscord | <Recruit_main707> He still uses c# iirc |
09:50:46 | FromDiscord | <Rika> How dare he |
09:50:48 | FromDiscord | <Elegantbeef> No i dont |
09:50:52 | FromDiscord | <evoalg> lol |
09:50:54 | FromDiscord | <Recruit_main707> Nice |
09:51:03 | FromDiscord | <Rika> Recruit arrested for libel |
09:51:14 | FromDiscord | <Elegantbeef> I mainly used C# due to the Unity engine, but i've since moved on from there |
09:51:30 | FromDiscord | <evoalg> omg I can't stop laughing again |
09:51:38 | FromDiscord | <Recruit_main707> In reply to @Rika "Recruit arrested for libel": I apologize for my sins please forgive me |
09:51:45 | FromDiscord | <Elegantbeef> Good that was a rude thing to accuse someone of |
09:51:50 | FromDiscord | <Rika> Lol |
09:53:19 | FromDiscord | <Recruit_main707> In reply to @Rika "All I can do": This deserves to be quoted in a talk |
09:53:40 | FromDiscord | <Rika> In reply to @Recruit_main707 "This deserves to be": The downside is that it just takes longer to write everything since ya know |
09:53:43 | FromDiscord | <Rika> Batteries not included |
09:53:55 | FromDiscord | <Rika> Hell screws not fucking included |
09:54:07 | FromDiscord | <Rika> Hell maybe even βmake the fucking product yourselfβ |
09:54:13 | FromDiscord | <Elegantbeef> To answer the question personally i dont have any reason to use C# |
09:54:44 | FromDiscord | <Elegantbeef> It'll almost certainly infuriate me now π |
09:55:46 | FromDiscord | <Elegantbeef> "I want a set of enums, time to bit op them together"... "It'd be nice if ranges were IEnumerables" ... "Would be cool if this function was attached to the type aswell as an instance without an extension method" and so on |
09:56:43 | FromDiscord | <evoalg> one day I'll understand those examples |
09:56:55 | FromDiscord | <Rika> Youβre planning on learning C#?!?!? |
09:57:00 | FromDiscord | <Rika> What the fuck |
09:57:02 | FromDiscord | <evoalg> no way |
09:57:11 | FromDiscord | <Rika> What beef mentioned were C# stuff |
09:57:15 | FromDiscord | <Elegantbeef> C# introduced ranges but you cannot do `foreach(var a in 3...5)` for instance (This is the ienumerable) |
09:57:23 | FromDiscord | <Rika> Why? |
09:57:31 | FromDiscord | <Elegantbeef> Cause they're idiots |
09:57:32 | FromDiscord | <Rika> Sounds absolutely stupid |
09:57:48 | FromDiscord | <Elegantbeef> They now have switch expressions in a fucking atrocious syntax |
09:58:05 | FromDiscord | <Elegantbeef> Say what you will about the Nim implementation but atleast the syntax is sensible and works well |
09:58:48 | FromDiscord | <Elegantbeef> Oh another thing is that in C# most people use a dictionary for a Enum -\> value relation |
09:58:51 | FromDiscord | <Rika> Iβm scared to Google |
09:59:13 | FromDiscord | <Rika> W-what is this syntax |
10:00:01 | FromDiscord | <Recruit_main707> I have recently gone down the rabbit hole of stack based langs because I think they are underrated, but normally i use Nim or write glue code in c++/python to use nim |
10:00:24 | FromDiscord | <Rika> I have no idea what Iβm reading when I see this C# switch exp syntax lol |
10:00:32 | FromDiscord | <Recruit_main707> It took me 5 minutes to write that shit because discord is fucking broken in the phone |
10:00:46 | FromDiscord | <Elegantbeef> Yea it's absurd to me |
10:01:15 | FromDiscord | <Elegantbeef> Why not just make all statements expressions if they have a value, not a fucking clue |
10:01:16 | * | krux02 joined #nim |
10:01:26 | FromDiscord | <Elegantbeef> Rust and Nim both do this and it's sensible |
10:01:37 | FromDiscord | <evoalg> In reply to @Recruit_main707 "I have recently gone": glue code is easier or something? |
10:02:00 | FromDiscord | <Rika> In reply to @evoalg "glue code is easier": Glue code just means using a programming language to glue two other languages together |
10:02:34 | FromDiscord | <Rika> So if thereβs like no easy way to use x library in Nim you use a glue language to communicate |
10:02:52 | FromDiscord | <evoalg> like numpy or something? |
10:03:05 | FromDiscord | <Rika> I mean yeah |
10:03:49 | FromDiscord | <Rika> Numpy to Python to Nim via Nimpy afaik? |
10:03:52 | FromDiscord | <Rika> I guess |
10:04:17 | FromDiscord | <evoalg> Rika you don't miss ipython? |
10:04:40 | FromDiscord | <evoalg> (to do something quick) |
10:05:17 | FromDiscord | <Rika> No I never used it |
10:05:41 | FromDiscord | <Elegantbeef> Have you used inim evoalg? |
10:05:42 | FromDiscord | <Rika> I wrote scripts on either a temp file or echo then piped it into Python/Nim |
10:05:59 | FromDiscord | <Elegantbeef> Yea i do the same just `nvim /tmp/test.nim` π |
10:06:09 | * | stkrdknmibalz joined #nim |
10:06:20 | FromDiscord | <Rika> I have a βscratchesβ folder lol |
10:06:35 | FromDiscord | <Rika> Never know if I need whatever random shit I write again |
10:07:11 | FromDiscord | <Elegantbeef> There is so much stuff I have lost to time helping people, i've written too many macros, that i'd like to revist and just dont have anymore |
10:07:22 | FromDiscord | <Elegantbeef> One too many commas that time! |
10:08:33 | FromDiscord | <evoalg> you should be collecting them for your book |
10:08:44 | FromDiscord | <Elegantbeef> Silly you i cannot write |
10:08:58 | FromDiscord | <evoalg> that once called "Playing with Nim" |
10:09:13 | FromDiscord | <evoalg> one |
10:09:15 | FromDiscord | <Elegantbeef> Nah it'll be called "Playing with Nimself" |
10:09:22 | FromDiscord | <evoalg> LOL |
10:09:48 | FromDiscord | <Rika> Letβs coauthor a book beef |
10:10:14 | FromDiscord | <Elegantbeef> Murder mystery? |
10:10:18 | FromDiscord | <Rika> Lol |
10:10:23 | FromDiscord | <Rika> Who killed the Nim compiler |
10:10:38 | FromDiscord | <Elegantbeef> Who and why killed the Nim compiler\ |
10:10:45 | FromDiscord | <Elegantbeef> You'll be the who, and i'll find the why |
10:11:13 | FromDiscord | <Rika> Lol |
10:11:34 | FromDiscord | <Rika> I make the worst macro (thatβs supposed to work) in existence and you fix the compiler so it works |
10:11:58 | FromDiscord | <Elegantbeef> Nice a tutorial on how to "Break and repair the Nim compiler" |
10:12:14 | FromDiscord | <Rika> Thatβs gonna be one challenge though ngl |
10:13:35 | NimEventer | New thread by Vladar: Converter is used through intermediate module?, see https://forum.nim-lang.org/t/8646 |
10:16:55 | FromDiscord | <evoalg> well, that conversation produced real tears |
10:17:20 | FromDiscord | <Elegantbeef> Lol |
10:44:05 | * | filcuc joined #nim |
10:46:08 | filcuc | i'm trying to add support for arc in NimQml after a bit of shuffling the code around due to automatic creation of the =destroy method i get this error Error: internal error: expr: proc not init "delete" |
10:46:23 | filcuc | any idea without having to create a full bug report? |
10:47:34 | filcuc | another thing is that if i want to use =destroy istead of finalizers i've to split my QObject type definition into the "ref" and not "ref" since the =destroy() wants a "var object" |
10:51:14 | filcuc | in other words what's the meaning of "expr: proc not init" |
10:58:40 | filcuc | ok during the shuffling of code i thought that forward declaring the finalizers would be enough...for solving the proc not init "delete" i had to put the actual implementation of the finalizer proc before the "new" |
11:41:36 | * | src joined #nim |
11:52:30 | * | filcuc quit (Ping timeout: 260 seconds) |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:55 | * | supakeen joined #nim |
12:07:52 | * | beeswax joined #nim |
12:08:28 | beeswax | I've got a problem with some asyncnet code. when trying someting like let future = await connect(socket, host, port) |
12:08:48 | beeswax | the compiler complains that the expression has no type or is ambiguous |
12:15:22 | beeswax | could it be because the return type of asyncnet/connect is Future[void]? How do I tell wether an error occured or not? |
12:22:25 | FromDiscord | <hotdog> In reply to @beeswax "I've got a problem": If you want the future just remove the βawaitβ |
12:22:34 | FromDiscord | <hotdog> As await will consume the future |
12:23:34 | beeswax | oh okay, the documentation in std/asyncdispatch shows await being used like that |
12:24:11 | FromDiscord | <hotdog> Are you sure? |
12:24:19 | FromDiscord | <hotdog> Await should return the value |
12:24:24 | FromDiscord | <hotdog> Not a future |
12:24:57 | FromDiscord | <hotdog> E.g if the proc returns Future[string], await will give you the string |
12:25:15 | FromDiscord | <hotdog> You can catch errors the normal way with try/except |
12:25:20 | beeswax | yep, I didn't realize you'd immediately get the value from await, not the future |
12:26:00 | beeswax | okay, there seems to be a note that try/except might not work and the safer way would be to use yield & checking future.failed |
12:26:44 | FromDiscord | <hotdog> In reply to @beeswax "okay, there seems to": You can do that, getting the future and handling it manually |
12:27:10 | FromDiscord | <hotdog> I havenβt had problems catching errors though so I canβt really comment on how necessary it is |
12:28:02 | FromDiscord | <Yardanico> In reply to @beeswax "okay, there seems to": this note was actually removed in the devel nim :) |
12:28:22 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/pull/19108 |
12:28:51 | FromDiscord | <Yardanico> i mean the order of priority was changed - you can use try/except normally, but also yield if you really want to |
12:29:07 | beeswax | thanks, I think I'll be asking some more questions about await in the future (no pun intended) |
12:46:33 | FromDiscord | <dom96> beeswax: that note is outdated, the docs are updated in devel |
12:51:01 | FromDiscord | <dom96> bah, and I see Yardanico already said that π |
13:01:51 | * | Vladar quit (Quit: Leaving) |
13:19:41 | FromDiscord | <lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FG7 |
13:19:45 | FromDiscord | <lenis> it looks quite disgusting and im not sure if it even works |
13:20:49 | FromDiscord | <Yardanico> that's the normal way, `[]` in nim is pointer dereferencing operator |
13:21:01 | FromDiscord | <Yardanico> the code you showed underlying contents of one pointer to another |
13:21:07 | FromDiscord | <Yardanico> ah, right, this code is a bit wrong |
13:21:17 | FromDiscord | <Yardanico> `pointer` is the "generic pointer" type, nim won't know what to do if you dereference it |
13:21:24 | FromDiscord | <lenis> ok youre right |
13:21:26 | FromDiscord | <Yardanico> just write it like this |
13:21:29 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3FG8 |
13:21:35 | FromDiscord | <lenis> yeah thats pretty much what i got |
13:21:41 | FromDiscord | <Yardanico> this will copy underlying contents from the pointer that someOtherPointer() returns to myPointer |
13:21:43 | FromDiscord | <lenis> actually much more disgusting but it should be the same |
13:21:53 | FromDiscord | <Yardanico> In reply to @lenis "actually much more disgusting": pointers aren't mean to be nice to work with :) |
13:21:57 | FromDiscord | <Yardanico> (edit) "mean" => "meant" |
13:22:07 | FromDiscord | <lenis> uhh |
13:22:07 | FromDiscord | <lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FG9 |
13:22:23 | FromDiscord | <lenis> that |
13:22:26 | FromDiscord | <Yardanico> how do you get fvPosOut ? |
13:22:26 | FromDiscord | <lenis> (edit) "https://play.nim-lang.org/#ix=3FG9" => "https://play.nim-lang.org/#ix=3FGa" |
13:22:35 | FromDiscord | <Yardanico> also why are you using `[]` in such a wrong way |
13:22:35 | FromDiscord | <lenis> passed in from a callback from a library |
13:22:47 | FromDiscord | <Yardanico> it's an array subscript operator in nim |
13:22:59 | FromDiscord | <lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FGb |
13:23:20 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3FGc |
13:23:25 | FromDiscord | <Yardanico> `fvPosOut: ptr Vec3f` in argument list |
13:23:31 | FromDiscord | <lenis> (edit) "https://play.nim-lang.org/#ix=3FGb" => "https://play.nim-lang.org/#ix=3FGd" |
13:23:48 | FromDiscord | <lenis> ah yeah that makes sense |
13:24:06 | FromDiscord | <lenis> the ptr stores 3 cfloats which is the same structure as Vec3f |
13:24:15 | FromDiscord | <lenis> and i need to write into it |
13:24:36 | beeswax | okay, I've got some more issues. Any ideas why wrapConnectedSocket won't perform a proper TLS handshake? |
13:24:59 | FromDiscord | <Yardanico> In reply to @beeswax "okay, I've got some": are you not compiling with `-d:ssl` by any chance? |
13:25:08 | beeswax | there's the typical SYN, ACK, SYNACK and then the client tries to send the client hello but only sends a couple bytes |
13:25:13 | FromDiscord | <Yardanico> hmm |
13:25:43 | FromDiscord | <lenis> Thanks btw Yardanico |
13:25:58 | FromDiscord | <lenis> its a bit cleaner |
13:26:09 | FromDiscord | <Yardanico> In reply to @lenis "Thanks btw Yardanico": what types are mesh.indices and mesh.vertexPositions btw? |
13:26:21 | FromDiscord | <Yardanico> also what type is `m_pUserData` |
13:26:36 | beeswax | then the next call to sock.send raises an Error "no ciphers available", which makes sense. Wireshark shows that no proper handshake has been performed |
13:27:10 | beeswax | I do compile with `-d:ssl`. Without it the newContext proc isn't even available |
13:28:37 | FromDiscord | <lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FGf |
13:29:29 | FromDiscord | <lenis> they're GltfArray[uint16] and GltfArray[Vec3f] |
13:30:05 | FromDiscord | <Yardanico> ah ok then, just didn't understand why are you using the array subscript operator like that |
13:30:25 | FromDiscord | <Yardanico> [] as a proc means it's an array subscript operator |
13:30:40 | FromDiscord | <lenis> I know. but i believe it wont run it if its in the same file |
13:30:44 | FromDiscord | <lenis> or at least i thought so |
13:30:59 | FromDiscord | <Yardanico> huh? |
13:31:03 | FromDiscord | <lenis> its the same when you override getters and setters |
13:31:07 | FromDiscord | <Yardanico> your last line in that callback is the same as `posOut[] = mesh.vertexPositions[int mesh.indices[iFace 3 + iVert][]][]` |
13:31:09 | FromDiscord | <lenis> thats how you can do property types in nim |
13:31:15 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/dyu |
13:31:35 | FromDiscord | <lenis> cause you can do this |
13:32:54 | * | arkurious joined #nim |
13:33:28 | FromDiscord | <lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FGg |
13:33:35 | FromDiscord | <Yardanico> yes, but how is this related to the array subscript operator? |
13:33:42 | FromDiscord | <Yardanico> i know you can do getters and setters in nim :) |
13:33:49 | FromDiscord | <Yardanico> also in your example you didn't export the setter |
13:34:09 | FromDiscord | <lenis> you're right i forgot |
13:34:30 | FromDiscord | <Yardanico> array subscript operator doesn't have limitations like "cannot be used in the same module" or something like that |
13:34:39 | FromDiscord | <lenis> but to use the setter you have to use `time=`(myType, 10) in the file |
13:34:45 | FromDiscord | <Rika> You donβt? |
13:34:54 | FromDiscord | <Yardanico> In reply to @lenis "but to use the": no |
13:34:57 | FromDiscord | <Rika> Oh you mean |
13:34:59 | FromDiscord | <Rika> I get it |
13:35:00 | FromDiscord | <lenis> I thought you did, to prevent recursive issues |
13:35:10 | FromDiscord | <Rika> Because otherwise you would access the field |
13:35:16 | FromDiscord | <Rika> It doesnβt apply for [] |
13:35:16 | FromDiscord | <lenis> yes |
13:35:20 | FromDiscord | <Yardanico> In reply to @lenis "I thought you did,": ah, you mean it that way - yes, but that doesn't apply for [] anyway |
13:35:29 | FromDiscord | <Yardanico> it applies to setters specifically only if you have the same name for the field and the setter |
13:35:37 | FromDiscord | <Yardanico> so you can easily fix that by naming the field in the object differently |
13:35:53 | FromDiscord | <Yardanico> also you don't need to export your field in the object if you also export the setter and getter |
13:36:02 | FromDiscord | <Yardanico> because otherwise it'll be ambiguous again |
13:36:28 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3FGi |
13:36:30 | FromDiscord | <Yardanico> this is your example rewritten "properly" |
13:36:31 | FromDiscord | <lenis> you're right i just rushed it haha |
13:36:35 | FromDiscord | <lenis> your version is correct |
13:36:41 | FromDiscord | <Yardanico> also forgot the return value for the getter |
13:36:43 | FromDiscord | <lenis> anyway, the array accesspr works |
13:36:46 | FromDiscord | <lenis> I had no idea |
13:36:53 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3FGj |
13:37:15 | FromDiscord | <lenis> i just thought all special `` procs could only be called externally unless referenced by name |
13:37:18 | FromDiscord | <Yardanico> In reply to @lenis "I had no idea": but it would be very weird if a language had that sort of limitations, no? |
13:37:24 | FromDiscord | <Yardanico> (edit) "limitations," => "limitation," |
13:37:39 | FromDiscord | <Yardanico> In reply to @lenis "i just thought all": `` by itself is actually just syntax for stropping |
13:38:00 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3FGk |
13:38:07 | FromDiscord | <Yardanico> so that the symbols inside are treated as a part of the identifier and not as actual operators |
13:39:01 | FromDiscord | <lenis> yes but i thought [] is a special operator like @ |
13:39:13 | FromDiscord | <Yardanico> wdym "special"? |
13:40:02 | FromDiscord | <Yardanico> @lenis also about your MyType example - i was wrong too, you don't need to name it differently |
13:40:15 | FromDiscord | <Yardanico> but it didn't work in your case because you exported both the field and the getter |
13:40:23 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3FGl |
13:40:37 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#procedures-propertiesβ΅"the builtin dot access is preferred if it is available" |
13:41:26 | FromDiscord | <lenis> mhh |
13:41:35 | FromDiscord | <Yardanico> hm |
13:41:36 | FromDiscord | <lenis> well @ is weird because it acts up when you try to override it |
13:41:47 | FromDiscord | <Rika> How? |
13:42:15 | FromDiscord | <lenis> that works |
13:42:18 | FromDiscord | <lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FGm |
13:42:27 | FromDiscord | <lenis> but as soon as you add a second argument to the template, nim gets confused |
13:42:52 | FromDiscord | <Yardanico> and how did you call it with two arguments? |
13:42:58 | FromDiscord | <lenis> because, lets say you do this |
13:43:26 | FromDiscord | <lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FGn |
13:43:26 | FromDiscord | <lenis> now you need 2 parameters |
13:43:29 | FromDiscord | <lenis> so, you would think |
13:43:31 | FromDiscord | <Rika> Okay |
13:43:45 | FromDiscord | <lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FGo |
13:43:48 | FromDiscord | <Rika> Thatβs not how you would call it |
13:43:58 | FromDiscord | <lenis> but that doesnt work because now it assumed (KeyPressEvent, keyW) is a tuple |
13:44:03 | FromDiscord | <Rika> Because it is |
13:44:08 | FromDiscord | <Rika> Because thatβs how itβs parsed |
13:44:29 | FromDiscord | <Rika> @ is more akin to a unary operator than a function |
13:44:39 | FromDiscord | <lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FGq |
13:44:40 | FromDiscord | <lenis> and then it works |
13:44:49 | FromDiscord | <Rika> Just like +(1, 2) is not 1+2 |
13:45:33 | FromDiscord | <lenis> but, if you dont use @ but you use an unused identifier like "on" |
13:45:36 | FromDiscord | <lenis> then it works fine |
13:45:56 | FromDiscord | <Yardanico> In reply to @lenis "but, if you dont": because it's a function, not an operator then |
13:46:50 | FromDiscord | <Rika> Anything that starts with a symbol (kinda vague when talking about Unicode but you get the gist) would be an operator |
13:46:59 | FromDiscord | <Rika> Anything with a letter would be a function |
13:47:13 | FromDiscord | <lenis> well there you go. thats what i meany by special treatment I guess |
13:47:22 | FromDiscord | <Rika> Itβs not only on @ though |
13:47:27 | FromDiscord | <Yardanico> In reply to @lenis "well there you go.": see https://nim-lang.org/docs/manual.html#lexical-analysis-operators |
13:48:37 | FromDiscord | <lenis> Thats a useful part of the documentation |
13:48:42 | FromDiscord | <lenis> Havent seen that before |
13:48:48 | FromDiscord | <Yardanico> well, duh, it's the manual :) |
13:48:53 | FromDiscord | <Yardanico> it explains most of the language :) |
13:49:02 | FromDiscord | <lenis> so the issue with the @ example is that it's priority as an operator is greater than if it were a function? |
13:49:36 | FromDiscord | <Rika> No, itβs an operator |
13:49:57 | FromDiscord | <Rika> You donβt use function syntax on operators |
13:50:25 | FromDiscord | <lenis> In reply to @Yardanico "well, duh, it's the": Well I skimmed though it selectivelt haha |
13:50:28 | FromDiscord | <Yardanico> yes, they're either unary (that's why it worked with 1 argument) or binary (two arguments) |
13:50:39 | FromDiscord | <lenis> And i mostly went off whats explained in the 2 tutorials, and the book on manning |
13:50:56 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3FGt |
13:51:01 | FromDiscord | <Yardanico> because in the latter case you're actually using it as a binary operator |
13:51:09 | FromDiscord | <Yardanico> and if it was `@KeyPressEvent` then you're using it as an unary operator |
13:51:09 | FromDiscord | <lenis> I see |
13:51:21 | FromDiscord | <lenis> unfortunately the syntax isnt as intuitive for what I wanted to use it for haha |
13:51:42 | FromDiscord | <lenis> I thought it would be nice to use @ like "at" for event handling but it wasnt meant to be |
13:51:44 | FromDiscord | <Yardanico> i mean, using `on` instead of `@` is pretty intuitive too |
13:51:57 | FromDiscord | <lenis> it is, thats what i changed to |
13:52:18 | FromDiscord | <Rika> Iβd say on is better than @ |
13:52:27 | FromDiscord | <lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FGv |
13:54:40 | FromDiscord | <lenis> i wanted to add the first one so you could filter events, which improves performance overhead because im using this in nimscript interop |
13:55:00 | FromDiscord | <lenis> so there is some noticeable performance overhead in calling the event handler |
14:48:32 | * | Colt quit (Quit: Leaving) |
15:20:24 | FromDiscord | <sharpcdf> how can i add a icon to the program at compile time? |
15:21:17 | FromDiscord | <Yardanico> In reply to @sharpcdf "how can i add": like this https://github.com/nim-lang/Nim/blob/devel/compiler/nim.nim#L11 |
15:21:27 | FromDiscord | <Yardanico> of course you need to prepare .res or .o beforehand |
15:21:53 | FromDiscord | <Yardanico> https://forum.nim-lang.org/t/5680 |
15:22:02 | FromDiscord | <Yardanico> https://forum.nim-lang.org/t/1862 |
15:26:26 | * | PMunch joined #nim |
15:41:17 | * | fputs6 joined #nim |
15:42:41 | * | fputs quit (Ping timeout: 250 seconds) |
15:42:41 | * | fputs6 is now known as fputs |
15:59:11 | * | beeswax quit (Ping timeout: 264 seconds) |
16:14:24 | FromDiscord | <gdquest> Hey there. Is there a place you can conveniently download the manual and class reference for offline use? |
16:15:38 | * | stkrdknmibalz quit (Quit: WeeChat 3.0.1) |
16:15:58 | FromDiscord | <Yardanico> it's not offered officially, but you can build docs for offline use (if you have the full nim installation) |
16:16:36 | FromDiscord | <gdquest> I'm on the Nim repository right now. I can't find instructions to build the docs. Do you know where I could find them? |
16:17:04 | FromDiscord | <gdquest> I'm pretty new to Nim, still getting started |
16:17:59 | FromDiscord | <gdquest> Okay I see now, gotta read the `koch` tool's docs |
16:18:35 | FromDiscord | <Yardanico> `./koch docs --localdocs:folder` should work if you're on linux |
16:18:43 | FromDiscord | <gdquest> Thanks much! |
16:18:52 | FromDiscord | <gdquest> That's really easy and perfect, thanks |
16:19:00 | FromDiscord | <Yardanico> sorry `./koch --localdocs:folder docs` |
16:19:29 | FromDiscord | <Yardanico> it'll take quite a while though, because a lot of examples in the nim documentation are compiled to ensure that they're working |
16:19:37 | FromDiscord | <Yardanico> some are even being run tested |
16:19:37 | FromDiscord | <gdquest> It's also a great example, this program, I'm looking to code a similar little "build system" |
16:20:41 | FromDiscord | <Yardanico> you can also build PDFs for some stuff like the manual, but it requires some latex stuff to be installed |
16:21:34 | FromDiscord | <gdquest> Html would be perfect to me |
16:23:04 | FromDiscord | <gdquest> Thanks for your help, compiling now |
16:37:52 | FromDiscord | <Yardanico> there's no way to force nim to see an array of uint8 as that without specifying the suffix for the first value, right? |
16:38:14 | FromDiscord | <Yardanico> just adding nim support to wasm4 and their template for png2src (converts a png into a sprite for wasm4) only allows you to get all bytes |
16:38:30 | FromDiscord | <Yardanico> so you get var bunny: array[64, uint8] = [0x1, 0x2, 0x3, ...] and nim will complain |
16:48:10 | FromDiscord | <Yardanico> guess i'll just add more replaces to the template |
16:48:39 | FromDiscord | <hmmm> what's the nim approved way of writing if 20 <= thingy <= 30: do thongy |
16:48:56 | FromDiscord | <Yardanico> if 20 <= thingy and thingy <= 30 |
16:49:12 | FromDiscord | <hmmm> oh, for one time my way is equal to the official way |
16:49:16 | FromDiscord | <hmmm> ty yardy |
16:49:21 | FromDiscord | <Yardanico> there's no "official way" |
16:49:40 | FromDiscord | <hmmm> ye but u know what I mean |
16:49:44 | * | beeswax joined #nim |
16:49:47 | FromDiscord | <hmmm> π |
17:02:15 | * | dtomato quit (Quit: The Lounge - https://thelounge.chat) |
17:03:06 | * | dtomato joined #nim |
17:11:51 | * | robertmeta quit (Remote host closed the connection) |
17:15:14 | * | Vladar joined #nim |
17:19:05 | * | euantorano quit (Ping timeout: 246 seconds) |
17:23:21 | * | elph quit (Ping timeout: 256 seconds) |
17:23:25 | * | ormiret quit (Ping timeout: 250 seconds) |
17:23:50 | * | notchris quit (Ping timeout: 260 seconds) |
17:24:17 | * | LyndsySimon quit (Ping timeout: 250 seconds) |
18:15:57 | * | Zevv joined #nim |
18:24:32 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=3FIp |
18:24:35 | * | beeswax quit (Quit: leaving) |
18:24:58 | FromDiscord | <π§ππ’> anything look amiss? |
18:24:59 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=3FIq |
18:50:12 | * | robertmeta joined #nim |
18:50:21 | FromDiscord | <creikey> In reply to @gdquest "Hey there. Is there": What's gdquest doing in here?? |
18:58:12 | * | euantorano joined #nim |
19:03:09 | FromDiscord | <deech> sent a code paste, see https://play.nim-lang.org/#ix=3FIC |
19:03:27 | FromDiscord | <Yardanico> In reply to @deech "When I pass `--app:staticlib": yes, noMain means it won't make the `main` C function |
19:03:56 | FromDiscord | <Yardanico> Nim still makes its own `NimMain` because modules might have Nim code on the global level which won't be called if you don't call NimMain |
19:04:54 | FromDiscord | <deech> When I try to link this from another Nim program as just a plain static archive with some `extern`ed function these functions clash. |
19:06:35 | * | notchris joined #nim |
19:08:21 | * | ormiret joined #nim |
19:08:25 | FromDiscord | <deech> Is there any way to not generate this? I have a static archive generated with the CPP backend that `extern`s some functions to be used with a program written with the C backend, both have `NimMain`, `PreMain` etc and fails to link the executable. |
19:11:13 | * | LyndsySimon joined #nim |
19:11:54 | FromDiscord | <Yardanico> In reply to @deech "Is there any way": I don't think so, not without patching the compiler or patching the C source manually after the Nim compilation step :( |
19:12:07 | FromDiscord | <Yardanico> There's at least https://github.com/nim-lang/Nim/issues/15955 open about it, maybe more issues. You can comment in that issue to make it more active |
19:12:44 | FromDiscord | <Yardanico> oh, seems like one workaround is to use `-Wl,--allow-multiple-definition` from that issue, but it might result in broken code |
19:13:13 | * | elph joined #nim |
19:14:09 | FromDiscord | <deech> There's also this https://github.com/nim-lang/Nim/issues/15955#issuecomment-948255187. |
19:15:15 | FromDiscord | <Yardanico> In reply to @deech "There's also this https://github.com/nim-lang/Nim/i": you'll have to do it for each nim static archive |
19:15:29 | FromDiscord | <Yardanico> well, for each except the first one |
19:15:31 | FromDiscord | <deech> Yep, it seems that way. |
19:15:42 | FromDiscord | <Yardanico> and global code won't work anyway |
19:15:58 | FromDiscord | <Yardanico> and global code is important - it's used in some modules for initialization |
19:16:02 | FromDiscord | <Yardanico> i'm talking about stdlib |
19:16:55 | FromDiscord | <Yardanico> even stuff as simple as the random module |
19:19:07 | FromDiscord | <deech> Hmmm, I think the modules I'm using to make the archive don't have any global initialization but if they do I'm pretty blocked. |
19:28:45 | FromDiscord | <deech> Is there a no stdlib option when compiling? |
19:30:33 | FromDiscord | <Yardanico> In reply to @deech "Is there a no": not really, and most stdlib modules don't use any global state :) |
19:50:11 | FromDiscord | <gdquest> In reply to @creikey "What's gdquest doing in": Learning some Nim! We're looking to use it to make some little native executables we can have everyone in the team use. |
19:50:28 | FromDiscord | <creikey> In reply to @gdquest "Learning some Nim! We're": Ah nice |
19:51:43 | FromDiscord | <creikey> In reply to @gdquest "Learning some Nim! We're": I learned godot as one of my first programming things, I remember your stuff was pretty helpful. Afterwards I've had a similar journey I think where I learned c/c++ and contributed to the engine, then rust, then got tired of the syntax and experimented with all the other native languages |
20:14:22 | FromDiscord | <π§ππ’> hey could anyone help w/ my x11 issue?β΅https://canary.discord.com/channels/371759389889003530/371759389889003532/912045814065553448 |
20:20:24 | * | dtomato quit (Quit: The Lounge - https://thelounge.chat) |
20:28:15 | * | dtomato joined #nim |
20:46:46 | PMunch | rem, struggling with reparenting? |
20:55:30 | * | dtomato quit (Quit: The Lounge - https://thelounge.chat) |
21:01:33 | FromDiscord | <π§ππ’> yeah |
21:01:48 | FromDiscord | <π§ππ’> took a break from it to work on my small language but it dies when XUnmapWindow is called |
21:01:51 | FromDiscord | <π§ππ’> which is annoying |
21:03:12 | nrds | <Prestige99> do you have an error handler set? |
21:03:20 | FromDiscord | <π§ππ’> no |
21:03:21 | nrds | <Prestige99> via XSetErrorHandler |
21:04:36 | nrds | <Prestige99> https://tronche.com/gui/x/xlib/event-handling/protocol-errors/XSetErrorHandler.html |
21:04:47 | FromDiscord | <π§ππ’> i took a break from it but ill add this later |
21:05:00 | FromDiscord | <π§ππ’> if u have any idea of why its not working tho lemme know and ill fix it later |
21:05:47 | nrds | <Prestige99> You might just need to set that handler |
21:05:50 | nrds | <Prestige99> "he action of the default handlers is to print an explanatory message and exit." |
21:05:55 | nrds | <Prestige99> The action* |
21:06:04 | FromDiscord | <π§ππ’> hmm |
21:18:57 | FromDiscord | <π§ππ’> two questions |
21:19:43 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=3FJp |
21:19:52 | FromDiscord | <π§ππ’> 2) is there a way to make it so i have to do `Token.Plus` |
21:20:01 | FromDiscord | <π§ππ’> so it doesnt clutter the namespace when i import it |
21:25:54 | * | terminalpusher quit (Remote host closed the connection) |
21:36:37 | * | PMunch quit (Quit: leaving) |
21:42:06 | FromDiscord | <dabmlfz> for point 2, I think you can use the pure pragma |
21:42:21 | FromDiscord | <dabmlfz> from the manual: "An enum type can be marked as pure. Then access of its fields always requires full qualification." |
21:46:01 | FromDiscord | <π§ππ’> ahh ok |
21:47:12 | FromDiscord | <π§ππ’> @dabmlfz doesnt work |
21:47:20 | FromDiscord | <π§ππ’> guess they removed it |
21:47:31 | FromDiscord | <Yardanico> In reply to @dabmlfz "from the manual: "An": this is no longer true, but anyway |
21:47:41 | FromDiscord | <Yardanico> @π§ππ’ you can just always use it explicitly and won't have any issues :P |
21:47:50 | FromDiscord | <π§ππ’> aaa ik but its annoying |
21:48:01 | FromDiscord | <π§ππ’> having all this clutter the namespace |
22:00:56 | * | dtomato joined #nim |
22:20:54 | * | yarrie joined #nim |
22:32:02 | * | qwr quit (Ping timeout: 240 seconds) |
22:33:50 | * | qwr joined #nim |
22:35:57 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=3FJL |
22:36:28 | FromDiscord | <Elegantbeef> Thought that's going to die away with the overridable enums |
22:39:51 | FromDiscord | <Elegantbeef> though\ |
22:46:41 | * | Colt joined #nim |
22:47:34 | * | Vladar quit (Quit: Leaving) |
22:51:35 | anddam | is nim /b zig |
22:51:41 | anddam | ok that came out odd |
22:52:25 | anddam | is nim suited for releasing small GUI executables for win/lin/mac possibly embedding a small GUI frmaework (Tk, Dear ImgUI, IUP) into a single executable bundle? |
22:52:56 | FromDiscord | <Yardanico> as long as you can do it with C, you can do it with Nim, so generally the answer is yes :) if you mean having separate binaries for different OSes |
22:53:06 | anddam | and while starting to type that I decided to switch buffer to #zig, where I roughly asked the same question |
22:53:38 | anddam | Yardanico: ok, thanks |
22:54:32 | FromDiscord | <Yardanico> zig will be suitable for that too btw |
22:56:49 | FromDiscord | <huantian> In reply to @Yardanico "this is no longer": Wait pure on enums isnβt a thing anymore? |
22:57:10 | FromDiscord | <Elegantbeef> It is but it's not enforced |
22:57:28 | FromDiscord | <huantian> Oh huh |
22:57:39 | FromDiscord | <Elegantbeef> Pure now just means "Ambiguity is allowed, if it's met throw it into a namespace" |
22:58:04 | FromDiscord | <huantian> Oh that makes sense |
22:58:31 | FromDiscord | <Elegantbeef> Though with the new overridable enums it's pointless π |
22:58:49 | FromDiscord | <Elegantbeef> Ambiguity is allowed and the type system is used to resolve it in many cases |
23:00:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/yzJ |
23:00:37 | anddam | Yardanico: I am trying to pick one of the two, I'll go through https://nim-lang.org/blog/2021/11/15/zen-of-nim.html and see |
23:00:51 | anddam | Nim seems a bit more mature, considering it's past 1.0 |
23:01:01 | anddam | at least that has been mentioned as a drawback on #zig |
23:01:29 | FromDiscord | <Elegantbeef> Correction it needs to be `var a: HorizontalAlign = HorizontalAlign.centre` apparently |
23:02:48 | FromDiscord | <Elegantbeef> In my view they're quite different languages, Zig is more of a C replacement, and Nim a modern system language. Not to say Zig isnt modern it just doesnt lean into modern concepts as much as Nim |
23:04:31 | FromDiscord | <Yardanico> another difference is that zig is very heavy on "No hidden control flow." |
23:04:36 | anddam | I think I'll need https://github.com/nimgl/imgui and I see this is a submodule of NimGL, but why isn't the former available in the registry as well? |
23:04:37 | FromDiscord | <Yardanico> some like it, some don't |
23:04:41 | FromDiscord | <Yardanico> nim is completely different in that regard |
23:04:51 | anddam | I am specifically referring to the note at https://github.com/nimgl/imgui#nimble-download |
23:05:01 | FromDiscord | <Elegantbeef> Nim has procedure overloading, generics, automatic memory management through GCs or Arc/Orc. Zig is very much a modern C it attempts to ensure the programmer can see everything |
23:05:08 | FromDiscord | <Yardanico> In reply to @anddam "I am specifically referring": because the developer didn't want to publish it i guess |
23:05:14 | FromDiscord | <Yardanico> `nimgl` already has it as one of the submodules |
23:05:26 | FromDiscord | <Yardanico> In reply to @Elegantbeef "Nim has procedure overloading,": yeah, also metaprogramming, and Zig again is "No preprocessor, no macros." |
23:05:36 | anddam | and that would possibly have duplicate contents for people installing both? |
23:05:37 | FromDiscord | <Yardanico> so nim and zig target quite different audiences regarding language features |
23:05:45 | FromDiscord | <Elegantbeef> Nah |
23:05:57 | FromDiscord | <Elegantbeef> It'll check if you have the version you need and if so not download it |
23:06:24 | FromDiscord | <Elegantbeef> If you're a diehard C programmer you'll probably like Zig |
23:06:31 | anddam | jeez hard to follow the Discord bridge from IRC |
23:07:07 | FromDiscord | <Elegantbeef> If you like niceties of the modern age, Nim will make you happy. It gives plenty of tools to make code very readable and imo very nice to write |
23:07:07 | anddam | Elegantbeef: was the C line for me? |
23:07:20 | FromDiscord | <Elegantbeef> Pretty much everything i've said in the past bit was |
23:07:21 | anddam | ok I am sold anyway |
23:07:29 | anddam | I use Python as daily driver btw |
23:07:47 | FromDiscord | <Elegantbeef> Ah then Nim will be more your style as it's not "as low level" as Zig |
23:07:54 | FromDiscord | <Yardanico> In reply to @anddam "<@145405730571288577>: was the C": just FYI, Elegantbeef is talking from Matrix :) |
23:07:54 | anddam | can do a little C but *definitely* not diehard |
23:08:12 | FromDiscord | <Yardanico> we have Matrix <-> Discord and Discord <-> IRC |
23:08:12 | anddam | ok |
23:08:21 | anddam | yeah that's the only drawback so far |
23:08:23 | FromDiscord | <Elegantbeef> Not to say you cannot do stuff at the same level as Zig, just that most of Nim is at a higher level with less concerns about memory management and the like since it handles it for you |
23:08:42 | FromDiscord | <Elegantbeef> You can always pretend Nim is a more modern C and write it as such if you ever wish |
23:08:47 | anddam | what about packing a build with static libs and make it an executable? |
23:09:03 | anddam | I mean what are my options for that? |
23:09:03 | FromDiscord | <Yardanico> as in? |
23:09:16 | FromDiscord | <Yardanico> i didn't quite understand the question |
23:09:20 | FromDiscord | <Elegantbeef> You do the same thing as you do with C mostly |
23:09:26 | FromDiscord | <Yardanico> if you mean static as in `.a` you can just link them together with the binary like in C |
23:09:29 | FromDiscord | <Elegantbeef> You make the static lib then tell the compiler to link it |
23:09:44 | FromDiscord | <Elegantbeef> I've never done it since i dont view dynamic libs as satan spawn |
23:09:54 | anddam | oh ok, what if I need additional resources, is there a bundler of sorta? |
23:10:02 | FromDiscord | <Yardanico> `nimble` is nim's package manager |
23:10:07 | FromDiscord | <Elegantbeef> Do you mean things like images/files? |
23:10:08 | FromDiscord | <Yardanico> there are others too, but it's the most popular one |
23:10:22 | FromDiscord | <Yardanico> or if you mean bundling files right into your binary, there are language-agnostic tools for that, or nim libraries too |
23:10:29 | FromDiscord | <Yardanico> like https://github.com/xmonader/nimassets |
23:10:31 | anddam | Elegantbeef, yep, I am thinking specifically about cx_freeze and py2exe |
23:10:42 | FromDiscord | <Yardanico> In reply to @anddam "<@145405730571288577>, yep, I am": you don't need those really, since nim is compiled anyway |
23:10:51 | FromDiscord | <Elegantbeef> Nim's got a VM for compile time evaluation, so you can use things like `Zippy` and load files into Zip into memory at compile time |
23:11:03 | FromDiscord | <Yardanico> those are needed for python because it's interpreted, so to have a standalone exe you need to bundle the interpreter along with your code together |
23:11:12 | FromDiscord | <Yardanico> in native languages you don't need that - they compile to a native binary anyway |
23:11:21 | anddam | Yardanico: but I use those to package resources (images and other files) as well |
23:11:35 | FromDiscord | <Yardanico> you can use nimassets that i've shown above as one option |
23:11:37 | FromDiscord | <Elegantbeef> So yes you can make a very self contained application in Nim |
23:11:47 | anddam | thank you so much |
23:12:19 | FromDiscord | <Elegantbeef> Nim has a built in procedure named `staticRead` which takes a file path and will read it at compile time, so you can load an image into the binary as simply as `const myFile = staticRead("somefile.png")` |
23:12:42 | FromDiscord | <Elegantbeef> Though that's not an overly impressive feat, all modern languages can do that π |
23:12:54 | FromDiscord | <Yardanico> but in case of bigger files it doesn't make much sense to do that bundling |
23:13:18 | FromDiscord | <Yardanico> in a lot of cases it's easy enough to just distribute an installer on Windows, appimage on Linux and normal macOS application on macOS :) |
23:13:30 | anddam | I gathered enough info, to the docs-reading mobile! |
23:14:07 | FromDiscord | <Elegantbeef> The one thing i'll say is dont expect "Python but compiled" cause Nim is very not just that |
23:18:36 | FromDiscord | <ajusa> In reply to @ajusa "How do I cross": Asked this earlier but didn't get a response, so I thought I'd ask again: β΅How do I cross compile a Windows exe with SSL support? I've added all the missing DLLs and cacert.pem to the same folder as the exe but it still complains about certificates not found. After looking into this issue more, I'm starting to realize why treeform created puppy |
23:21:22 | FromDiscord | <Elegantbeef> What OS are you on? |
23:21:22 | anddam | ajusa: why do you need a cert for having SSL support? |
23:22:39 | * | dtomato quit (Ping timeout: 250 seconds) |
23:22:49 | FromDiscord | <Yardanico> In reply to @ajusa "Asked this earlier but": eh, checking SSL certificates is actually very important |
23:22:56 | FromDiscord | <ajusa> Linux, and so I can make an HTTPS request? |
23:23:01 | FromDiscord | <ajusa> Specifically Fedor |
23:23:04 | FromDiscord | <ajusa> (edit) "Fedor" => "Fedora" |
23:23:34 | FromDiscord | <Yardanico> i'll check myself now if it works or not |
23:23:58 | FromDiscord | <ajusa> In reply to @Yardanico "i'll check myself now": Thanks, that'll help me figure out if my code is just bad (it does work on Linux without any issues) or if something else is wrong |
23:24:26 | FromDiscord | <ajusa> Fwiw I did try compiling that program on Windows itself on the same machine and that worked - so it must be an issue with how I'm distributing it or cross compiling it |
23:26:32 | FromDiscord | <Elegantbeef> I just cross compiled from linux to windows and tested with wine and it workedc |
23:26:41 | FromDiscord | <Elegantbeef> Are you sure the pem is in the right path? |
23:26:54 | FromDiscord | <ajusa> In reply to @Elegantbeef "I just cross compiled": Hm, what dlls did you include? And where am I supposed to put the pem? |
23:28:39 | FromDiscord | <Yardanico> yep it just works |
23:28:56 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3FK1 |
23:28:57 | FromDiscord | <Elegantbeef> exe is next to the `libssl-1_1-x64.dll` `libcrypto-1_1-x64.dll` and `cacert.pem` |
23:29:09 | FromDiscord | <Elegantbeef> Yep just like yards |
23:30:28 | FromDiscord | <ajusa> Huh, that's exactly the set up I had. I'm testing this again now lol |
23:31:00 | FromDiscord | <Yardanico> you can get all the DLLs from https://nim-lang.org/download/dlls.zip btw |
23:31:06 | FromDiscord | <Yardanico> or with the nim windows distribution |
23:31:32 | FromDiscord | <ajusa> I used the Nim windows distribution the first time I tested this, I'll try it with just the DLLs.zip on a real windows machine (so not Wine) |
23:32:08 | FromDiscord | <Yardanico> i do have a win7 vm which I can test that on as well :) |
23:32:28 | FromDiscord | <Elegantbeef> If it works on wine but not windows i'll just laugh at how good windows is |
23:34:05 | FromDiscord | <Yardanico> works there as well https://media.discordapp.net/attachments/371759389889003532/912123730971463760/unknown.png |
23:34:35 | FromDiscord | <Yardanico> (and don't ask why i have a win7 vm) |
23:34:41 | anddam | imgui.nim has {.push warning[HoleEnumConv]: off.} |
23:35:03 | anddam | and this yields a `/home/anddam/.nimble/pkgs/imgui-1.84.2/imgui.nim(1927, 29) Error: invalid pragma: warning[HoleEnumConv]: off` when compiling or running |
23:35:14 | FromDiscord | <Elegantbeef> You're not on 1.6 |
23:35:23 | anddam | so outdated language |
23:35:32 | FromDiscord | <Elegantbeef> How'd you get the language? |
23:35:36 | anddam | yep, 1.4.8 from Void packages |
23:35:38 | FromDiscord | <Yardanico> @anddam did you perhaps install nim from your distro's package manager? |
23:35:38 | anddam | time to update that |
23:35:42 | anddam | yes |
23:35:44 | FromDiscord | <Yardanico> yeah 1.4.8 is outdated a bit |
23:35:51 | anddam | I'll update the template |
23:35:53 | FromDiscord | <Yardanico> but i'm asking because some distros have ancient nim |
23:35:54 | FromDiscord | <Yardanico> like 0.19 |
23:35:55 | FromDiscord | <Elegantbeef> If it was through a package manager, uninstall it from there and install it using choosenim or gitnim |
23:36:20 | anddam | Elegantbeef any particular advantage over using the package manager? |
23:36:22 | FromDiscord | <Yardanico> debian 11 (which was released in october) only has 1.4.6 for example |
23:36:33 | FromDiscord | <Elegantbeef> You can easily move between version |
23:36:57 | FromDiscord | <dom96> I love how now that we've got the roadmap the people who were loudly complaining that there is no roadmap haven't given a single bit of feedback about it so far π |
23:37:03 | anddam | does the language/compiler move fast? |
23:37:32 | FromDiscord | <gibson> /aside I wish the only nim package in distros was `choosenim`... |
23:37:34 | FromDiscord | <ajusa> Eh, 1-2 major releases a year I think, not too fast I would say. The stdlib is pretty stable |
23:37:37 | FromDiscord | <Elegantbeef> A minor release in around 4-8 months is what i think is the average |
23:37:54 | FromDiscord | <Yardanico> In reply to @anddam "does the language/compiler move": 1.6 - 19 October 2021β΅1.4.0 - 16 October 2020 |
23:37:54 | FromDiscord | <Elegantbeef> 1.6 was quite a large release |
23:38:04 | FromDiscord | <Yardanico> there were 1.4.2, 1.4.4, 1.4.6, 1.4.8 meantime |
23:38:20 | FromDiscord | <Elegantbeef> I think that implies they careβ΅(@dom96) |
23:39:03 | * | src quit (Quit: Leaving) |
23:39:25 | FromDiscord | <Elegantbeef> Indeed gibson any language versioning tool is better than a specific version |
23:40:48 | FromDiscord | <dom96> In reply to @Elegantbeef "I think that implies": they sure seemed to based on how loudly they kept asking for a roadmap |
23:41:29 | FromDiscord | <gibson> @ElegantBeef even so far as I wish issuing polite takedown requests for non-choosenim packages, just to unify the UX. |
23:42:00 | FromDiscord | <dom96> In reply to @gibson "/aside I wish the": are you volunteering to package it for all the distros? π |
23:42:08 | FromDiscord | <Yardanico> In reply to @gibson "<@!145405730571288577> even so far": some people like distribution package managers over language package managers :) |
23:42:17 | FromDiscord | <Yardanico> and want languages to use them instead of their own native PMs |
23:42:37 | anddam | mm did build from source change much frmo 1.4? I see it was using separate csources, nimble and fusion tarballs |
23:42:42 | FromDiscord | <gibson> I could do a few! π |
23:42:43 | FromDiscord | <Elegantbeef> That works so well for things like llvm π |
23:42:57 | anddam | now instructions have a build.sh script and then "koch" |
23:43:09 | FromDiscord | <dom96> In reply to @gibson "I could do a": you have my full support π |
23:43:14 | anddam | Elegantbeef, those tools now seems nice |
23:43:23 | FromDiscord | <Yardanico> In reply to @anddam "mm did build from": you can still build it the old way, but build_all.sh is just easier |
23:43:24 | anddam | Elegantbeef: choosenim and gitnim |
23:43:38 | FromDiscord | <Elegantbeef> I mean they're super nice since you can easily change versions and even go to develop |
23:44:00 | FromDiscord | <Elegantbeef> But it's just `./build_all.sh` and then `./koch boot -d:danger` for that slightly faster compiler |
23:44:08 | anddam | I don't particularly like having ~/nimble, can I tweak that using choosenim or gitnim? |
23:44:24 | anddam | x/nimble/ i/./ |
23:44:47 | FromDiscord | <Elegantbeef> No clue if you can change it's install path |
23:45:33 | FromDiscord | <ajusa> In reply to @ajusa "I used the Nim": Alright, I just tried it myself on a windows machine. When compiling with Nim 1.6, no issues. When compiling with 1.4.2, it fails to find the certificates it seems. |
23:45:48 | FromDiscord | <ajusa> 1.4.2 is the latest on MX Linux, which is what one of my computers run |
23:45:52 | FromDiscord | <Elegantbeef> Ah yes 1.4.2 had an issue with that i believe |
23:46:10 | FromDiscord | <Elegantbeef> This is why languages on package managers suck |
23:46:16 | FromDiscord | <Yardanico> you should at least update to 1.4.8 which has bugfixes :) |
23:46:20 | FromDiscord | <Yardanico> 1.6. would be even better |
23:46:25 | FromDiscord | <ajusa> Yeah I'll try using choosenim on that machine instead in the future |
23:48:18 | FromDiscord | <dom96> anddam: https://github.com/nim-lang/nimble#configuration |
23:49:01 | FromDiscord | <dom96> choosenim reads this too (I hope) |
23:50:44 | anddam | thanks |
23:55:03 | FromDiscord | <gibson> Question for you smart folks: I'm looking at generated release c-code, is there any way I can make a `converter` apply at compile time if it is able? Like an enum to int converter operating on a literal, for instance. |
23:56:29 | FromDiscord | <Elegantbeef> I dont think so |
23:57:22 | FromDiscord | <gibson> Bummer. Thanks. |
23:59:38 | FromDiscord | <Elegantbeef> It's likely it gets inlined so it'll be cheap |