<< 21-11-2021 >>

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