00:58:34 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3DVp |
01:01:47 | FromDiscord | <codic> how can I return nth element of a seq by ref? |
01:02:07 | FromDiscord | <Elegantbeef> return `var Client` |
01:02:26 | FromDiscord | <Elegantbeef> use `std/decls.byaddr` to hold onto a pointer to that |
01:02:35 | FromDiscord | <Elegantbeef> I do the same in my WM |
01:03:28 | FromDiscord | <Elegantbeef> https://github.com/beef331/goodwm/blob/6c48f78b85c29d986462211f8f022c8101ce93a7/src/goodwm/desktops.nim#L20 |
01:03:29 | FromDiscord | <Elegantbeef> If you want reference |
01:07:49 | FromDiscord | <Elegantbeef> Though if you hold onto it longer than you should it'll error |
01:08:05 | FromDiscord | <Elegantbeef> Not error but cause bugs since it'll be a dangling pointer |
01:41:31 | FromDiscord | <codic> 👍 |
01:43:20 | FromDiscord | <codic> cool nice |
01:43:24 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3DVy |
01:43:34 | FromDiscord | <Elegantbeef> That's not going to work |
01:44:02 | FromDiscord | <Elegantbeef> `Option` wrapping a `var Client` is not valid since it can outlive the life of the wm |
01:44:33 | FromDiscord | <Elegantbeef> You're either going to need views, or use a ptr here and manually manage the lifetimes |
01:50:01 | * | xet7 joined #nim |
01:59:23 | FromDiscord | <evoalg> @ElegantBeef I'm just checking ... if I never want to use nim for interfacing with C libs (or another non-nim libs), can I get away with not learning pointers & ref's, or will I be limited? (I don't know if I'm explaining myself well) |
02:00:05 | FromDiscord | <Elegantbeef> Well you'll want to learn ref semantics and the like, but you might be able to. I wouldnt be scared of them Nim makes them quite easy to use |
02:00:22 | FromDiscord | <Elegantbeef> Nim has some of the better pointer semantics imo |
02:01:04 | FromDiscord | <evoalg> what are ref's good for? ... I've seen them in the docs, but it doesn't really say what I'd need them? Sorry for the noob questions I keep asking |
02:01:06 | FromDiscord | <Elegantbeef> Pointers afterall are just integers they're not that scary |
02:02:01 | FromDiscord | <Elegantbeef> Refer to this writeup https://forum.nim-lang.org/t/8426#54529 |
02:02:09 | FromDiscord | <Elegantbeef> It probably should be expanded and added to the manual |
02:02:27 | FromDiscord | <evoalg> Hehe I guess reading people having problems with pointers in this channel was scaring me. OK I'll ready that - thank you! 🙂 |
02:03:19 | FromDiscord | <Elegantbeef> Pointers are legitmately just an address to memory, they're not that scary in Nim since we know that they're not an array or are an array thanks to the type system |
02:03:49 | FromDiscord | <Elegantbeef> In C you might have a `char` which is a ptr to a char, but you can do `yourCharPtr[3]` wheras in nim it'd be a `ptr UncheckedArray[char]` to be able to do that |
02:04:07 | FromDiscord | <Elegantbeef> A `ptr char` cannot be indexed in Nim |
02:04:13 | FromDiscord | <Elegantbeef> Many modern languages do this though |
02:05:15 | FromDiscord | <Elegantbeef> if you've ever used a `var T` parameter in a procedure you've already used pointers btw |
02:05:42 | FromDiscord | <evoalg> In reply to @Elegantbeef "if you've ever used": Oh! ok hehe |
02:06:05 | FromDiscord | <Elegantbeef> Though these pointers are special in that they're ensured they do not outlive the proc |
02:06:28 | FromDiscord | <Elegantbeef> Which is for a safety reason that you might have a pointer to the stack that becomes a dangling pointer |
02:07:05 | FromDiscord | <Elegantbeef> What language do you come from again? |
02:07:09 | FromDiscord | <evoalg> "dangling pointer" <-- see what I mean about these scary words? 😉 |
02:07:23 | FromDiscord | <evoalg> python ... but I'm not expert in python |
02:07:36 | FromDiscord | <impbox [ftsf]> a pointer to memory that's no longer valid |
02:07:40 | FromDiscord | <Elegantbeef> Well it's not that scary since nim doesnt allow you to do it unless you do it "unsafely" |
02:08:04 | FromDiscord | <impbox [ftsf]> but yeah, pointers are a lot less scary in nim |
02:08:38 | FromDiscord | <Elegantbeef> I learned pointers in Nim and yea they're nice here |
02:08:41 | FromDiscord | <Elegantbeef> You dont have ambiguity |
02:08:41 | FromDiscord | <impbox [ftsf]> you can still mess yourself up with them, but you rarely need to do unsafe things unless you're interfacing with C |
02:09:08 | FromDiscord | <Elegantbeef> Or getting around the language safety rails |
02:11:21 | FromDiscord | <codic> In reply to @Elegantbeef "`Option` wrapping a `var": oh |
02:11:24 | FromDiscord | <codic> that's sad |
02:11:26 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3DVF |
02:11:30 | FromDiscord | <Elegantbeef> Like i said codic you cannot capute `var` without views |
02:11:35 | FromDiscord | <Elegantbeef> You can make it a `ptr Client` |
02:11:45 | FromDiscord | <Elegantbeef> Assuming you know it's safe to do |
02:12:13 | FromDiscord | <Elegantbeef> To be safe `WM` will not be destroyed whilst the `Option[ptr Client]` exists |
02:12:21 | FromDiscord | <Elegantbeef> or just `ptr Client` exists |
02:13:11 | FromDiscord | <Elegantbeef> And i guess you dont resize clients whilst it's open |
02:13:16 | FromDiscord | <Elegantbeef> whilst it exists\ |
02:13:23 | FromDiscord | <codic> It won't be destroyed |
02:13:42 | FromDiscord | <codic> Yeah I'll use raw pointers |
02:13:47 | FromDiscord | <Elegantbeef> Well if you remove entries it will be throttled aswell |
02:13:53 | FromDiscord | <codic> ? |
02:14:08 | FromDiscord | <Elegantbeef> So be extra certain you do not mutate the `clients` whilst you have that ptr |
02:14:30 | FromDiscord | <codic> what if I want to mutate the clients while I have the pointer, what can I do then? |
02:14:54 | FromDiscord | <codic> what if I don't use the pointer |
02:14:55 | FromDiscord | <codic> eg |
02:15:01 | FromDiscord | <Elegantbeef> hmmm `seq[ref Client]` |
02:15:09 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3DVH |
02:15:10 | FromDiscord | <codic> is this ok for a seq[Client]? |
02:15:20 | FromDiscord | <Elegantbeef> Yea should be fine |
02:15:29 | FromDiscord | <codic> (edit) "https://play.nim-lang.org/#ix=3DVH" => "https://play.nim-lang.org/#ix=3DVI" |
02:15:31 | FromDiscord | <codic> yeah thats all I need to do as far as removing 👍 |
02:15:40 | FromDiscord | <Elegantbeef> Enabling views has the compiler handle it for you btw 😀 |
02:15:42 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3DVJ |
02:15:58 | FromDiscord | <codic> views look epic |
02:15:59 | FromDiscord | <codic> but experimental sad |
02:16:07 | FromDiscord | <Elegantbeef> Indeed |
02:16:26 | FromDiscord | <Elegantbeef> The compiler is much better at reasoning lifetimes than mere mortals sadly |
02:16:34 | FromDiscord | <Rika> I cut myself on the edge of experimental once |
02:16:44 | FromDiscord | <Elegantbeef> Damn was it bleeding? |
02:16:55 | FromDiscord | <Rika> Yeah |
02:16:58 | FromDiscord | <codic> I'll use raw pointers then when it makes it into stable I'll rewrite to use far superior lent |
02:17:09 | FromDiscord | <codic> I'm rewriting my rust wm rn because rust sucks |
02:17:21 | FromDiscord | <Rika> Why do you think so |
02:17:38 | FromDiscord | <Rika> Ah writing it sucks I guess |
02:17:55 | FromDiscord | <Rika> Otherwise it’s pretty good as long as it’s not me who’s writing it 🙂 |
02:17:56 | FromDiscord | <codic> you have to prove to compiler that stuff is safe in twisted ways |
02:18:00 | FromDiscord | <codic> lol yeah |
02:18:22 | FromDiscord | <codic> for example I can't store &'a mut Client or something so I had to store an index instead and index into the Vec every time |
02:18:39 | FromDiscord | <codic> or I couldn't return mutable reference from function while other functions in the caller function mutably borrow |
02:18:47 | FromDiscord | <codic> it's just shit to write |
02:19:00 | FromDiscord | <codic> but in some aspects its really awesome |
02:19:06 | FromDiscord | <codic> https://github.com/codic12/worm/blob/main/src/wm.rs this was the code |
02:19:10 | FromDiscord | <Rika> It’s probably a conceptual difference between how you think and what the compiler was made for or so |
02:19:55 | FromDiscord | <codic> Yeah but there are just some things Rust can't do safely that logically makes sense |
02:20:18 | FromDiscord | <codic> The ultimate task can still be achieved you just have to do it in a way that makes the borrow checker happy rather than the way that makes you happy |
02:20:31 | FromDiscord | <codic> I wanted to write this in Zig but Zig's standard library changes too much for me atm |
02:20:37 | FromDiscord | <Elegantbeef> Or you enter `unsafe` and then get flamed by the armchair programmers |
02:21:53 | FromDiscord | <codic> yes |
02:22:22 | FromDiscord | <codic> Really if Rust was `unsafe` by default and had a `safe` keyword I would consider it the best language in the world |
02:22:40 | FromDiscord | <Elegantbeef> And people wouldnt use it |
02:23:11 | FromDiscord | <codic> People would still use it |
02:23:15 | FromDiscord | <codic> People use Nim |
02:23:26 | FromDiscord | <Rika> Much less than now |
02:23:35 | FromDiscord | <Rika> Rust has a different goal from Nim’s |
02:23:45 | FromDiscord | <Rika> Rust’s point is safety |
02:24:08 | FromDiscord | <codic> sure, and I might write my rocket system in Rust |
02:24:25 | FromDiscord | <codic> although if I was writing a rocket system, I might use even safer Ada |
02:24:41 | FromDiscord | <codic> or if I was writing google's servers, I might want to use rust |
02:24:55 | FromDiscord | <Rika> I really wish the formal proving system in Nim didn’t die |
02:24:56 | FromDiscord | <codic> but if I'm just writing code to use on people's computers for fun, I don't need the focus on safety and the costs that come with it |
02:25:02 | FromDiscord | <codic> sounds cool what was that |
02:25:16 | FromDiscord | <codic> isn't there that dr nim thing which does thta |
02:25:17 | FromDiscord | <codic> (edit) "thta" => "that" |
02:25:25 | FromDiscord | <Rika> Same thing that makes Ada safe I would say |
02:25:54 | FromDiscord | <Elegantbeef> it's not dead as much as not developed 😛 |
02:26:29 | FromDiscord | <Rika> Essentially dead to me |
02:26:39 | FromDiscord | <Rika> I’m working on figuring out how to help |
02:26:47 | FromDiscord | <Elegantbeef> I want some intelligent value/type narrowing |
02:27:03 | FromDiscord | <Rika> That would be nice too |
02:28:04 | FromDiscord | <Elegantbeef> making the CT smarter will give some aspects of the prover, not a guarantee but more CT errors! |
02:48:05 | FromDiscord | <codic> nim is awesomely productive , chad |
02:59:54 | * | neurocyte0132889 quit (Ping timeout: 268 seconds) |
03:02:57 | * | krux02 quit (Remote host closed the connection) |
03:08:09 | * | rockcavera quit (Remote host closed the connection) |
03:42:25 | * | arkurious quit (Quit: Leaving) |
03:56:59 | * | CyberTailor joined #nim |
03:57:55 | CyberTailor | are there any specifications (like python PEPs) regarding nim packaging and distribution? |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:32 | * | supakeen joined #nim |
04:15:53 | FromDiscord | <huantian> there's some info in the nimble readme |
04:55:47 | FromDiscord | <creatable> hey there, i'm trying to use nimgl's imgui package but when i use the C++ target and try to distribute a compiled version of my project it depends on libgcc, and when i use the C target i have to distribute my exe with a cimgui dll included alongside it. is there any way to either statically link cimgui with nimgl/imgui, or to statically link libgcc so i can only distribute the exe? |
05:23:16 | FromDiscord | <creatable> this also occurs when i include the dll anywhere else: https://media.discordapp.net/attachments/371759389889003532/905688624425762856/unknown.png |
05:23:23 | FromDiscord | <creatable> (edit) "anywhere else:" => "on another computer:" |
05:25:02 | FromDiscord | <impbox [ftsf]> it's pretty normal to include dlls alongside your app on windows |
05:25:48 | FromDiscord | <impbox [ftsf]> you can probably build a static cimgui |
05:27:16 | FromDiscord | <impbox [ftsf]> yeah, pretty easy to make cimgui.a |
05:27:51 | FromDiscord | <impbox [ftsf]> just edit the CMakeCache.txt and set `IMGUI_STATIC:STRING=yes` then run `make` |
06:00:14 | NimEventer | New Nimble package! config - A library for working with the CFG configuration format, see https://docs.red-dove.com/cfg/index.html |
06:05:11 | NimEventer | New thread by Kobi: Survey Question: flow research, see https://forum.nim-lang.org/t/8590 |
07:28:14 | FromDiscord | <haxscramper> Not going into the "why another format", but damn they have a good docs and test↵(<@709044657232936960_=4eim=45venter=5b=49=52=43=5d>) |
07:28:53 | FromDiscord | <haxscramper> Almost impossible to find GitHub link though, I had to to go the PR to nimble package list - https://github.com/vsajip/nim-cfg-lib |
07:30:07 | FromDiscord | <haxscramper> It is find of similar to the https://dhall-lang.org/ in terms of features as I can see |
07:32:05 | FromDiscord | <Elegantbeef> The accessing environment variables is a bit off though |
07:35:18 | FromDiscord | <Rika> Well it’s implementation dependent |
07:40:18 | FromDiscord | <haxscramper> It is kind of close to the .cfg that compiler implements |
07:40:27 | FromDiscord | <haxscramper> No conditional configuration |
07:40:36 | FromDiscord | <haxscramper> But environment variables are ok |
07:40:47 | FromDiscord | <haxscramper> Though I would also prefer some special syntax for this |
07:41:02 | FromDiscord | <haxscramper> At least something like $env\:home |
08:11:56 | * | mahlon quit (Ping timeout: 268 seconds) |
08:13:19 | * | mahlon joined #nim |
08:39:00 | FromDiscord | <evoalg> wait ... there is inim interactive nim? |
08:39:35 | FromDiscord | <Elegantbeef> inim is a user made repl for Nim |
08:39:42 | FromDiscord | <Elegantbeef> There is also `nim secret` but it's using the VM |
08:40:22 | FromDiscord | <evoalg> oh I need to look up nim secret |
08:40:31 | FromDiscord | <Elegantbeef> As the name imples it's a secret |
08:40:39 | FromDiscord | <Elegantbeef> you just do `nim secret` and get a VM reepl |
08:42:21 | FromDiscord | <evoalg> why is it a secret? |
08:43:13 | * | mahlon_ joined #nim |
08:43:42 | FromDiscord | <Elegantbeef> I think it's not as developed as desired, i dont know |
08:44:02 | * | mahlon quit (Ping timeout: 260 seconds) |
08:44:36 | FromDiscord | <evoalg> ok I'll follow the first rule 😉 |
08:45:37 | FromDiscord | <Elegantbeef> This isnt fight club |
08:45:46 | FromDiscord | <Elegantbeef> It's not a hush hush thing 😛 |
08:48:56 | * | mahlon_ quit (Ping timeout: 268 seconds) |
08:59:03 | FromDiscord | <evoalg> when you want to test sometime quickly, do you use "nim --eval" ? |
08:59:35 | FromDiscord | <evoalg> something |
08:59:35 | FromDiscord | <Elegantbeef> Nope i do `nvim /tmp/some.nim` |
09:00:09 | * | Theodore[m] quit (Quit: You have been kicked for being idle) |
09:04:59 | * | mahlon_ joined #nim |
09:19:47 | * | vicecea quit (Remote host closed the connection) |
09:20:18 | * | vicecea joined #nim |
09:56:30 | FromDiscord | <Zajt> I get `(74, 1) Error: nestable statement requires indentation` here - but I don't see what's wrong indentation here https://media.discordapp.net/attachments/371759389889003532/905757390039826432/unknown.png |
10:05:20 | FromDiscord | <Rika> Probably needs more context |
10:10:38 | * | Vladar joined #nim |
10:42:27 | FromDiscord | <Zajt> What more context do you need? |
10:42:41 | FromDiscord | <Zajt> It says the line number there I think but nothing more |
10:42:46 | FromDiscord | <Zajt> (edit) "It says the line number there I think but nothing more ... " added "than what I pasted" |
10:44:08 | FromDiscord | <Rika> Above the lines and below the lines |
10:44:18 | FromDiscord | <Rika> There is still one indent level |
10:47:51 | FromDiscord | <Zajt> Here is the full function https://media.discordapp.net/attachments/371759389889003532/905770308894597180/unknown.png |
10:48:28 | FromDiscord | <Zajt> On line 77 there, a new function starts |
10:48:38 | FromDiscord | <Zajt> (edit) "starts" => "starts, but it's on line 74 it says the indendation is wrong" |
10:48:50 | FromDiscord | <Zajt> (edit) "indendation" => "indentation" |
10:51:27 | FromDiscord | <Rika> It looks correct really |
10:52:24 | FromDiscord | <Rika> Yeah I don’t see anything wrong |
11:06:43 | FromDiscord | <federico3> https://blog.sesse.net/blog/tech/2021-11-04-09-48_superopt.html |
11:08:26 | FromDiscord | <Rika> ? |
11:15:08 | FromDiscord | <demotomohiro> @evoalg I use this plugin to test a short nim code from nvim.↵https://github.com/rhysd/wandbox-vim↵So I don't need to save a code to storage and I can use a devel nim without compiling it myself.↵But I cannot use a nimble packages. |
11:15:44 | FromDiscord | <evoalg> interesting |
11:25:55 | FromDiscord | <qb> In reply to @treeform "You can use Color": Thanks. I'm trying to render that screenshot now with glfw with no success. I'm able to render your `readtime_glfw` example but not that screenshot. Do you might know whats going on? https://play.nim-lang.org/#ix=3DYe |
11:44:24 | FromDiscord | <Zajt> In reply to @Rika "It looks correct really": Yeah I even confirmed now and it's only tabs and not spaces before each line |
11:44:52 | FromDiscord | <Rika> Oh |
11:44:57 | FromDiscord | <Rika> Lol Nim doesn’t work with tabs |
11:51:09 | FromDiscord | <enthus1ast> Comment stuff out until the error is gone↵(@Zajt) |
11:51:33 | FromDiscord | <enthus1ast> Then you know what causes the issue |
11:53:43 | FromDiscord | <enthus1ast> I would start with the defer |
11:54:43 | FromDiscord | <Zajt> https://media.discordapp.net/attachments/371759389889003532/905787138497445928/unknown.png |
11:54:54 | FromDiscord | <Zajt> `out.nim(54, 1) Error: nestable statement requires indentation` |
11:55:07 | FromDiscord | <Zajt> so it says indentation is wrong on a line that is outcommented, wtf |
11:55:35 | FromDiscord | <enthus1ast> Ok that's weird |
11:56:15 | FromDiscord | <enthus1ast> Then I guess the error is at the top of your file |
11:56:46 | FromDiscord | <enthus1ast> Can you share the whole file in a nim playground? |
11:59:30 | FromDiscord | <enthus1ast> I bet there is a '\:' somewhere that causes the issue |
12:02:31 | FromDiscord | <willyboar> i believe the problem is tabs or 4 spaces |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:04 | FromDiscord | <Zajt> shouldn't you use 4 spaces if tabs are not allowed? |
12:06:13 | FromDiscord | <enthus1ast> I use 2 |
12:06:31 | * | supakeen joined #nim |
12:06:48 | FromDiscord | <enthus1ast> But the error message would be different if you mix both |
12:07:19 | FromDiscord | <enthus1ast> You can see it with vscode when you select everything |
12:07:35 | FromDiscord | <enthus1ast> Tab is -\> space is . |
12:07:48 | FromDiscord | <Zajt> I guess I'll rewrite everything in a new file and see if that works |
12:13:38 | FromDiscord | <enthus1ast> And I would also let your editor autoconvert tabs to spaces |
12:13:42 | FromDiscord | <enthus1ast> https://stackoverflow.com/questions/36814642/visual-studio-code-convert-spaces-to-tabs |
12:13:50 | FromDiscord | <enthus1ast> But I guess this is not the issue |
12:31:39 | FromDiscord | <Zajt> I rewrote it and don't have that error right now so it seemed to be fix. But I'm getting this error `out.nim(81, 9) Error: expected: ')', but got: 'status'` https://media.discordapp.net/attachments/371759389889003532/905796429610631178/unknown.png |
12:32:09 | FromDiscord | <Zajt> What's wrong here? I don't see any paranthesis missing |
12:50:04 | FromDiscord | <Zajt> I got this part of the code but get this error `out.nim(81, 9) Error: expected: ')', but got: 'status'`↵But I don't see that any paranthesis is missing there, what is wrong here? https://media.discordapp.net/attachments/371759389889003532/905801068217253928/unknown.png |
12:53:46 | FromDiscord | <enthus1ast> What is '&'? Should be addr imho |
12:54:03 | FromDiscord | <enthus1ast> Or some overload i do not know |
12:55:54 | * | rockcavera joined #nim |
12:55:55 | * | rockcavera quit (Changing host) |
12:55:55 | * | rockcavera joined #nim |
12:58:18 | FromDiscord | <Zajt> reference to a variable |
12:58:54 | FromDiscord | <Rika> & doesnt exist in nim |
12:58:57 | FromDiscord | <Rika> use addr |
12:59:13 | FromDiscord | <Rika> `addr sectionHandle` |
12:59:46 | FromDiscord | <el__maco> does NULL exist in Nim? |
13:01:50 | FromDiscord | <haxscramper> `nil` |
13:03:41 | FromDiscord | <Rika> afaik defined by winim prolly |
13:05:59 | FromDiscord | <Zajt> I removed all & and replaced with `addr` but still get that same error on that line |
13:19:41 | FromDiscord | <exelotl> In reply to @Zajt "I removed all &": it's also `or` instead of `|` |
13:21:13 | FromDiscord | <Zajt> In reply to @exelotl "it's also `or` instead": ah okay I fixed that, but still same error |
13:22:27 | FromDiscord | <Rika> more context please, upper lines |
13:22:34 | FromDiscord | <Rika> until the indent level |
13:43:42 | FromDiscord | <Zajt> https://media.discordapp.net/attachments/371759389889003532/905814563566542848/unknown.png |
13:43:55 | FromDiscord | <Zajt> and still error `out.nim(81, 9) Error: expected: ')', but got: 'status'` |
13:44:41 | FromDiscord | <Zajt> Anything there which looks like wrong syntax? |
13:59:09 | FromDiscord | <dangbinghoo> is there any way to use `concepts` in nim 1.6 ? |
14:06:43 | * | arkurious joined #nim |
14:19:04 | FromDiscord | <enthus1ast> @Zajt\: i think it will be best when you just share the code on eg https://play.nim-lang.org/ |
14:20:05 | FromDiscord | <enthus1ast> what i do spot though, is `sectionSize = { size }` propably wrong but who knows \:) |
14:20:31 | FromDiscord | <Zajt> In reply to @enthus1ast "<@290456415963709440>\: i think": https://play.nim-lang.org/#ix=3DZc here it is |
14:21:06 | FromDiscord | <Zajt> In reply to @enthus1ast "what i do spot": how can that be written? I basically wanted to translate this line from cpp to Nim `LARGE_INTEGER sectionSize = { size };` |
14:22:05 | FromDiscord | <vindaar> @dangbinghoo\: yeah, sure. Are you thinking about the old or new concepts? The latter still miss a bunch of features, as far as I know |
14:29:30 | FromDiscord | <lytedev> Quick question for y'all wizards:↵↵I'm using this library (https://nimble.directory/pkg/nimrcon) which seems to be failing to export to export the main type |
14:30:52 | FromDiscord | <enthus1ast> @Zajt\: there are so many things in your code |
14:31:03 | * | CyberTailor left #nim (Konversation terminated!) |
14:31:30 | FromDiscord | <enthus1ast> i think you should go step by step and fix them |
14:31:31 | FromDiscord | <enthus1ast> eg |
14:32:40 | FromDiscord | <enthus1ast> memcopy ( should be copyMem in nim), ↵NtCreateSection, NtCreateSection etc not defined (when theyre not in winim you must define them yourself) |
14:33:22 | FromDiscord | <enthus1ast> never seend this before\: @(str.toOpenArrayByte(0, str.high)) |
14:33:25 | FromDiscord | <enthus1ast> prolly @[] |
14:33:43 | FromDiscord | <enthus1ast> strformat not imported |
14:35:54 | FromDiscord | <Zajt> NtCreateSection are defined in another file |
14:37:01 | FromDiscord | <Zajt> In reply to @enthus1ast "prolly @[]": should it be @[(str.toOpenArrayByte(0, str.high] instead or? |
14:37:14 | FromDiscord | <lytedev> sent a code paste, see https://paste.rs/nPO |
14:37:48 | FromDiscord | <lytedev> (edit) "https://play.nim-lang.org/#ix=3DZr" => "https://play.nim-lang.org/#ix=3DZq" |
14:39:37 | FromDiscord | <enthus1ast> think you can just write\:↵↵str.toOpenArrayByte(0, str.high) |
14:40:20 | FromDiscord | <enthus1ast> should it be just a openarray or a seq that contains a openarray |
14:40:21 | FromDiscord | <enthus1ast> ? |
14:40:31 | FromDiscord | <enthus1ast> (which i think does not work) |
14:44:28 | FromDiscord | <enthus1ast> @Zajt\: sleepAndCheck not defined |
14:45:22 | FromDiscord | <enthus1ast> maybe, just maybe you should write a little not so l33t code to lean a little nim ;) |
14:46:47 | FromDiscord | <enthus1ast> what does this do in c?↵`LARGE_INTEGER sectionSize = { size };` |
14:47:20 | FromDiscord | <enthus1ast> is {} not a array constructor? |
14:48:08 | FromDiscord | <el__maco> its also a struct initializer |
14:48:19 | FromDiscord | <el__maco> LARGE_INTEGER seems to be an enum |
14:48:25 | FromDiscord | <el__maco> (edit) "enum" => "union" |
14:48:51 | FromDiscord | <el__maco> (edit) "an" => "a" |
14:49:51 | FromDiscord | <enthus1ast> then LARGE\_INTEGER should be an nim object |
14:50:12 | FromDiscord | <enthus1ast> but this i do not know for sure |
14:50:26 | FromDiscord | <enthus1ast> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/905830084114522202): maybe, just maybe you should write a little not so l33t code to learn a little nim ;) |
14:50:51 | FromDiscord | <dangbinghoo> In reply to @vindaar "<@737477820288204881>\: yeah, sure. Are": the only thing I need to do is to constaint a type has/impl a several set of procs (like interface in D or traits in rust) |
14:51:00 | FromDiscord | <el__maco> I think instead of LARGE_INTEGER you could use a regular Nim int perhaps? |
14:51:16 | FromDiscord | <enthus1ast> yeah |
14:51:21 | FromDiscord | <el__maco> it seems to me that LARGE_INTEGER is just a 64 bit integer |
14:51:36 | FromDiscord | <el__maco> and some clunky boilerplate for systems that don't support it |
14:52:11 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3DZy |
14:52:46 | FromDiscord | <enthus1ast> maybe you can use the asyncFd as a hash |
14:52:58 | FromDiscord | <el__maco> oh boy, using pointers as hash values. Wouldn't recommend |
14:54:33 | FromDiscord | <ajusa> In reply to @enthus1ast "maybe you can use": can't do that because it's a private field in Nim :/↵https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/asyncnet.nim#L113 |
14:54:56 | FromDiscord | <enthus1ast> at least for me it was working with the asyncFd as a hash, but i just wanted to store connections back then, but i think the better solution would be if you assign a generated identifier (uuid?) |
14:55:06 | FromDiscord | <Zajt> In reply to @el__maco "I think instead of": I'll try to use a regular int instead |
14:55:52 | FromDiscord | <enthus1ast> @lytedev\: fork it and make a pr |
14:56:01 | FromDiscord | <ajusa> In reply to @enthus1ast "at least for me": Well when a connection exits I wanted to be able to remove it in O(1) time rather than iterating and searching for the UUID |
14:56:06 | FromDiscord | <Zajt> But it's really weird nim doesn't tell me where the error is but instead outputs some bullshit that a paranthesis is missing |
14:56:13 | FromDiscord | <Zajt> (edit) "But it's really weird nim doesn't tell me where the error is but instead outputs some bullshit that a paranthesis is missing ... " added "which is not the case" |
14:56:18 | FromDiscord | <Zajt> (edit) "case" => "case. This makes it difficult to debug" |
14:56:28 | FromDiscord | <enthus1ast> your code is full of errors↵(@Zajt) |
14:56:28 | FromDiscord | <lytedev> That's what I'm thinking. Thank you! |
14:56:52 | FromDiscord | <Zajt> In reply to @enthus1ast "your code is full": yeah it might be, but the error message still makes no sense |
14:57:57 | FromDiscord | <enthus1ast> yes if you JUST want to store the Websocket, then i would go with hashing the asyncFd of the websocket, but i can imagine, that the Websocket is just one part of your client.↵(@ajusa) |
14:59:20 | FromDiscord | <enthus1ast> sent a long message, see https://paste.rs/evW |
14:59:58 | FromDiscord | <ajusa> In reply to @enthus1ast "so eg\: ● client": Got it. I was trying to do table[client, user data] which might be somewhat backwards. I'll try that and see how it works, thanks! |
15:00:58 | FromDiscord | <Shikata Ga Nai> Hello, I'm a noob programmer and I'm trying to go through the Nim Basics exercises... I know there can be multiple solutions or ways to go about it but are there solutions to be found anywhere? I'm stuck and would like to see another person's code as hint. |
15:01:12 | FromDiscord | <Shikata Ga Nai> https://media.discordapp.net/attachments/371759389889003532/905834064525803520/unknown.png |
15:01:42 | FromDiscord | <Shikata Ga Nai> is where I'm at https://media.discordapp.net/attachments/371759389889003532/905834190312972360/unknown.png |
15:03:34 | FromDiscord | <enthus1ast> you cannot just add to an array, for this you need a sequence. |
15:03:43 | FromDiscord | <enthus1ast> what you can do is\:↵↵a[0] = 10 |
15:03:50 | FromDiscord | <enthus1ast> a[idx] = myNum |
15:04:17 | nrds | <Prestige99> for countup can you get the value and index back? Like for (i, val) in countup(10, 100, 10) |
15:04:53 | nrds | <Prestige99> hm guess not |
15:04:59 | FromDiscord | <dom96> In reply to @enthus1ast "yes if you JUST": +1 to this, it's likely you have other data that is associated with each client |
15:07:00 | FromDiscord | <treeform> In reply to @qb "Thanks. I'm trying to": Does the `#shot.writeFile("screenshot.png")` write correct thing? |
15:07:36 | FromDiscord | <enthus1ast> imho paris SHOULD work \:) |
15:09:22 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3E07 |
15:09:50 | FromDiscord | <enthus1ast> but toSeq should not be needed here, one should open an issue |
15:17:28 | FromDiscord | <Shikata Ga Nai> yeah your workaround def works, thanks!↵should be able to complete this exercise without importing any modules... question indicates it should be able to be completed by filling an array using a for loop so idk |
15:18:08 | FromDiscord | <qb> In reply to @treeform "Does the `#shot.writeFile("screenshot.png")` write": Yea the `writeFile` saves a perfect screenshot. Boxy looks perfect for my case except that I need the mousebutton passthrough which the current glfw build supports and nimgl aswell: https://github.com/nimgl/nimgl/blob/master/src/nimgl/glfw.nim#L653 |
15:19:01 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3E0a |
15:19:03 | FromDiscord | <Rika> im not sure if i fucked something up there but |
15:19:56 | FromDiscord | <treeform> In reply to @qb "Yea the `writeFile` saves": Can you display an image that is not a screenshot, but some thing you just load? I think openGL code might have an issue then. |
15:20:19 | FromDiscord | <treeform> I never done mousebutton passthrough or transparent windows |
15:21:23 | FromDiscord | <qb> Oh I could actually use boxy with nimgl right |
15:21:47 | FromDiscord | <enthus1ast> yes Rika's solution is the best |
15:22:07 | FromDiscord | <enthus1ast> but pairs should also work \:) |
15:28:42 | FromDiscord | <Rika> pairs should work but why would you do that, it has an extra heap alloc prolly |
15:28:46 | FromDiscord | <Rika> use std/enumerate if you really want |
15:29:24 | FromDiscord | <Rika> https://nim-lang.org/docs/enumerate.html |
15:33:58 | FromDiscord | <treeform> In reply to @qb "Oh I could actually": In theory yes, I have never done so. |
15:36:58 | FromDiscord | <enthus1ast> strange that we have pairs and enumerate |
15:37:23 | FromDiscord | <Rika> enumerate came much later than pair |
15:37:24 | FromDiscord | <Rika> s |
15:56:22 | FromDiscord | <qb> In reply to @treeform "In theory yes, I": This works. Feels pretty hacky. Boxy requires `loadExtensions` by the opengl library so I can't use nimgl's opengl bindings. When exactly does boxy call `glClear`? Also could I use boxy alone to create the screenshot image? I feel like I've imported a lot of power in that code 😄 https://play.nim-lang.org/#ix=3E0q |
15:58:37 | FromDiscord | <treeform> boxy calls glClear when you `beginFrame` |
15:59:04 | FromDiscord | <treeform> boxy uses pixie, what do you mean by alone? |
15:59:28 | FromDiscord | <treeform> I don't think you need line 42 to line 48, boxy does all that |
15:59:43 | FromDiscord | <treeform> Ideally you would not need to import any opengl bindings if you use boxy |
16:00:25 | FromDiscord | <qb> I want that 0, 0 is lower left. Is that how boxy sets it up? |
16:01:00 | FromDiscord | <treeform> no boxy is 0,0 is top left |
16:01:56 | FromDiscord | <treeform> you could probably apply boxy scale and translate to get to lower left coordinate system but I think its more trouble then its worth. |
16:02:25 | FromDiscord | <qb> https://media.discordapp.net/attachments/371759389889003532/905849474243498004/Bildschirmfoto_von_2021-11-04_17-02-08.png |
16:02:26 | FromDiscord | <qb> 😄 |
16:02:57 | FromDiscord | <qb> Pretty happy with it thanks a lot |
16:04:09 | FromDiscord | <qb> Not sure why it works now without 42-48 since I've used `bxy.drawImage("shot", vec2(0, 0))` it should render from top left right? Sorry, I'm still new to all that |
16:04:52 | FromDiscord | <treeform> 0,0 is top left |
16:05:05 | FromDiscord | <treeform> and images draw in x+ y+ direction? |
16:09:07 | * | stkrdknmibalz quit (Quit: WeeChat 3.0.1) |
16:12:20 | * | tiorock joined #nim |
16:12:21 | * | tiorock quit (Changing host) |
16:12:21 | * | tiorock joined #nim |
16:12:21 | * | rockcavera quit (Killed (strontium.libera.chat (Nickname regained by services))) |
16:12:21 | * | tiorock is now known as rockcavera |
16:25:03 | FromDiscord | <qb> Well I just killed my de with it. Gonna play with it some other day. Thanks a lot again. Would be cool if it would be possible to setup a own matrix in combination with boxy. |
16:25:27 | FromDiscord | <qb> In reply to @treeform "boxy uses pixie, what": Was wondering if I still need to import pixie. But seems like boxy includes pixie |
16:28:45 | * | tiorock joined #nim |
16:28:45 | * | tiorock quit (Changing host) |
16:28:45 | * | tiorock joined #nim |
16:28:45 | * | rockcavera is now known as Guest8853 |
16:28:45 | * | Guest8853 quit (Killed (lithium.libera.chat (Nickname regained by services))) |
16:28:45 | * | tiorock is now known as rockcavera |
16:33:02 | * | tiorock joined #nim |
16:33:02 | * | tiorock quit (Changing host) |
16:33:02 | * | tiorock joined #nim |
16:33:02 | * | rockcavera is now known as Guest5232 |
16:33:02 | * | Guest5232 quit (Killed (tungsten.libera.chat (Nickname regained by services))) |
16:33:02 | * | tiorock is now known as rockcavera |
16:47:51 | FromDiscord | <Professor Actual Factual> When calling on C code that needs to be free'd, is it best to put it in a try-catch in case the program crashes?↵Do program crashes in C code cause memory leaks? |
16:48:57 | FromDiscord | <Yardanico> In reply to @Professor Actual Factual "When calling on C": try/except won't work if the C side errors crashes (with SIGSEGV or something similar) to begin with |
16:49:32 | FromDiscord | <Professor Actual Factual> In reply to @Yardanico "try/except won't work if": Whats the best way to go about this then? |
16:49:34 | FromDiscord | <Yardanico> try/except only works with Nim exceptions (and C++ exceptions when compiled with the C++ backend) |
16:49:56 | FromDiscord | <Yardanico> In reply to @Professor Actual Factual "Whats the best way": ensure that you're not calling the C code in an erroneous way? |
16:50:18 | FromDiscord | <tandy> sorry, went to bed \:) tictactoe with an AI player using the minimax algorithm |
16:50:40 | FromDiscord | <Yardanico> In reply to @Professor Actual Factual "Whats the best way": can you provide some more info about what C code are you trying to call and why is it crashing on free? |
16:52:38 | FromDiscord | <Professor Actual Factual> In reply to @Yardanico "can you provide some": just wrapping a DB implementation from C.↵Im kind of worried that if a user does CRTL+C midway through the process or run out of disk space they will get memory leak.↵Wanted to know the best way to avoid this. |
16:52:58 | Amun-Ra | use defer |
16:53:18 | FromDiscord | <Yardanico> even better - wrap your C stuff in objects and use destructors :) |
16:53:35 | FromDiscord | <Yardanico> @Professor Actual Factual also, not sure I understand - if a user does Ctrl+C midway, then the program will terminate and all the process memory will be automatically free'd anyway |
16:54:02 | FromDiscord | <Professor Actual Factual> The C code has to be free'd manually for this one. |
16:54:08 | Amun-Ra | yes, but freeing memory the proper way is good practice |
16:54:48 | FromDiscord | <Professor Actual Factual> Does C code get free'd from a CRTL-C or other errors? I thought not. |
16:55:33 | Amun-Ra | yes, OS will take care of that (you shouldn't leak mem anyway tho) |
16:56:59 | FromDiscord | <el__maco> there is an argument to be made to avoid freeing memory at the end of your program, because the OS will do that, and it will do it more efficiently than you |
16:57:14 | Amun-Ra | I finished supporting another old format for my image viewer in Nim: https://postimg.cc/vcBNDjyT |
16:57:21 | FromDiscord | <Professor Actual Factual> Ok thats good to know. Thanks everyone 🙂 |
16:57:50 | Amun-Ra | Professor: I'm using defer for those situations |
16:58:07 | FromDiscord | <Yardanico> @Amun-Ra that's fine, but IMO destructors are cleaner and better to use :) |
16:58:13 | FromDiscord | <Yardanico> they especially work amazing with ARC |
16:58:27 | FromDiscord | <Yardanico> (that said, they work with refc too) |
16:58:43 | Amun-Ra | Yardanico: right, they are; I don't use ref that much personally |
16:58:52 | FromDiscord | <Yardanico> not sure I understand |
16:58:55 | FromDiscord | <Yardanico> destructors don't need `ref` |
16:59:02 | Amun-Ra | hmm |
16:59:04 | FromDiscord | <Yardanico> You can have a normal `object` and have a destructor defined for it |
16:59:53 | Amun-Ra | I must have missed that detail, thanks |
17:00:48 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3E0U |
17:01:40 | FromDiscord | <Yardanico> and then you can also test memory leaks with `--gc:orc` (or arc if you're sure you don't have cycles) and `-d:useMalloc` |
17:01:43 | FromDiscord | <Yardanico> then valgrind will work just fine |
17:02:55 | FromDiscord | <Yardanico> see https://nim-lang.org/docs/destructors.html |
17:33:54 | FromDiscord | <Professor Actual Factual> Can you explain what cycles are via code example? Or possibly share some resources on the topic? Much appreciated |
17:39:30 | FromDiscord | <haxscramper> first points to second |
17:39:31 | FromDiscord | <haxscramper> sent a code paste, see https://paste.rs/wjR |
17:39:33 | FromDiscord | <haxscramper> second points to first |
17:43:12 | FromDiscord | <Professor Actual Factual> Ah i see, thank you 🙂 |
17:44:17 | FromDiscord | <hmmm> halooooo |
17:44:26 | FromDiscord | <hmmm> who is experienced with wnim here :3 |
17:45:37 | FromDiscord | <hmmm> this emote is cute :nimAngry: |
18:01:37 | * | mahlon_ is now known as mahlon |
18:04:08 | * | vicfred joined #nim |
18:34:03 | * | vicfred quit (Quit: Leaving) |
19:07:14 | FromDiscord | <Shikata Ga Nai> Noob's back! I completed all the previous collatz sequence exercises without issue, but struggling here. I'd like to see one of you wrinkly brains tackle this so I see where I'm going wrong. Thanks in advance https://media.discordapp.net/attachments/371759389889003532/905895981894225930/unknown.png |
19:08:43 | FromDiscord | <Shikata Ga Nai> https://media.discordapp.net/attachments/371759389889003532/905896354755264542/unknown.png |
19:32:21 | FromDiscord | <enthus1ast> a little↵(@hmmm) |
19:33:56 | FromDiscord | <hmmm> ha! my boy |
19:34:01 | FromDiscord | <hmmm> wtf is a bitlist |
19:34:26 | FromDiscord | <enthus1ast> mh which context? |
19:34:37 | FromDiscord | <demotomohiro> If you have a procedure or function that calculate a length of collatz sequence, it should not be so hard to find max length. |
19:34:48 | FromDiscord | <enthus1ast> or'ed flags maybe ? @hmmm |
19:35:16 | * | krux02 joined #nim |
19:35:20 | FromDiscord | <hmmm> and to put into context we are talking about the setitem proc of this: https://khchen.github.io/wNim/wListCtrl.html |
19:35:24 | * | anjovi quit (Ping timeout: 276 seconds) |
19:36:08 | FromDiscord | <hmmm> setitem works correctly, if I call it and set a status it will set, what it's not working is the getstate proc, that will always return 3 lol |
19:36:26 | FromDiscord | <hmmm> so I thought it has to do with the fact that I have no idea what a bitlist is |
19:36:58 | * | anjovi joined #nim |
19:37:12 | FromDiscord | <enthus1ast> ah yes, these are just or'd flags |
19:37:17 | FromDiscord | <enthus1ast> really common in winapi |
19:37:24 | FromDiscord | <hmmm> wtf is an ord flag D: |
19:37:38 | Amun-Ra | or'd as in bitwise-OR |
19:37:40 | FromDiscord | <enthus1ast> basically its just an integer, but you can store multiple "flags" in the integer |
19:37:43 | FromDiscord | <hmmm> and why it returns 3 😩 |
19:38:03 | FromDiscord | <tandy> is it possible to find an instance of an object in a seq? i used find when looking for a `(int, int)` but now that I am looking for an instance of a OOLib class it won't ever find it.. |
19:38:12 | FromDiscord | <enthus1ast> maybe the default flags of the item is 3 |
19:38:29 | FromDiscord | <enthus1ast> what do you want to achive? |
19:38:34 | FromDiscord | <hmmm> all the item return 3 and an item I've just changed a flag of will return 3 |
19:38:37 | FromDiscord | <hmmm> 3 is the answer |
19:39:00 | FromDiscord | <hmmm> I'm trying to make an item turn bright |
19:39:27 | FromDiscord | <hmmm> there is the flag wListStateDropHighlighted that does just that |
19:40:02 | FromDiscord | <enthus1ast> then i think the way to go is to get the current state and `or` it with wListStateDropHighlighted |
19:40:05 | FromDiscord | <hmmm> but after turning it bright I want to turn it normal, and I need to check the state first and to do that getstate has to work and not just spit 3 lol |
19:41:00 | FromDiscord | <garuse> In reply to @Shikata Ga Nai "Noob's back! I completed": https://play.nim-lang.org/#ix=3E1X |
19:43:24 | Amun-Ra | tandy: traverse a seq and compare it with 'of' |
19:44:39 | FromDiscord | <enthus1ast> @hmmm\: the winapi flag is actually called `LVIS_DROPHILITED` |
19:44:45 | FromDiscord | <enthus1ast> maybe you can find more information |
19:44:58 | FromDiscord | <hmmm> I'm dropping the hmmm here |
19:45:02 | FromDiscord | <hmmm> hmmmm |
19:45:17 | FromDiscord | <enthus1ast> it could be that its only valid with certain combinations of other flags |
19:45:47 | FromDiscord | <enthus1ast> eg\: https://forums.codeguru.com/showthread.php?435322-How-to-get-the-LVIS_DROPHILITED-state-of-item |
19:45:57 | FromDiscord | <enthus1ast> `1. If you're running with version 6 or higher of comctl32.dll, you can use the LVS_EX_DOUBLEBUFFER style. ` |
19:49:56 | FromDiscord | <hmmm> also related to wnim in general: control have styles, sometimes I want to have a control in two styles at the same time but it never works. Something like x=TextCtrl(panel, style=wTeMultiLine and wTeReadOnly) but it never works for me. I've seen people using or but that doesn't work for me too |
19:50:42 | FromDiscord | <hmmm> I'm confus :nimAngry: |
19:52:06 | FromDiscord | <enthus1ast> https://blog.podkalicki.com/bit-level-operations-bit-flags-and-bit-masks/ |
19:52:23 | FromDiscord | <enthus1ast> `To set a flag, we use bitwise OR equals operator (|=). It allows turning individual bits on.` |
19:52:38 | FromDiscord | <enthus1ast> so they must be `or` ed instead of and |
19:53:10 | FromDiscord | <hmmm> wow this article is golden |
19:53:14 | FromDiscord | <enthus1ast> so this might work\:↵`x=TextCtrl(panel, style=wTeMultiLine orwTeReadOnly)` |
19:54:17 | FromDiscord | <hmmm> why would people ever use something that arcane when I could just call a flag is beyond me |
19:54:21 | FromDiscord | <enthus1ast> if you figure out the autolayout dsl let me know \:D |
19:54:28 | FromDiscord | <hmmm> lol no way |
19:55:12 | FromDiscord | <enthus1ast> it might be very smart and clever, unfortunately too clever for me |
19:56:10 | FromDiscord | <hmmm> I'm prodigiously clever when I sleep, when I wake I lose my superpowers :< |
20:06:33 | FromDiscord | <Rika> so, you never sleep then |
20:37:11 | NimEventer | New Nimble package! odsreader - OpenDocument Spreadhseet reader, see https://github.com/dariolah/odsreader |
20:40:33 | * | MightyJoe is now known as cyraxjoe |
21:05:30 | * | Vladar quit (Quit: Leaving) |
21:37:15 | NimEventer | New Nimble package! gene - Gene - a general purpose language, see https://github.com/gcao/gene-new |
21:43:34 | FromDiscord | <Rika> huh |
22:32:10 | FromDiscord | <tandy> huh↵(<@709044657232936960_=41mun-=52a=5b=49=52=43=5d>) |
22:32:16 | FromDiscord | <tandy> how do you mean of |
22:32:28 | FromDiscord | <tandy> i wrote this |
22:32:31 | FromDiscord | <tandy> sent a code paste, see https://play.nim-lang.org/#ix=3E2R |
22:32:37 | FromDiscord | <tandy> but it doesnt work |
22:33:47 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3E2U |
22:33:54 | FromDiscord | <codic> But after the "finished dispatching" the program just doesn't go to get the next event |
22:33:56 | FromDiscord | <codic> weird |
22:34:35 | FromDiscord | <Elegantbeef> You dont need to enumerator positions 😀 |
22:35:00 | FromDiscord | <Elegantbeef> there's a built in `seq.find` |
22:35:13 | FromDiscord | <tandy> yee i used this, but it didnt work |
22:35:23 | FromDiscord | <tandy> I'm comparing instances of OOlib classes |
22:35:35 | FromDiscord | <tandy> Position is a class |
22:35:40 | FromDiscord | <Elegantbeef> Ah then you want `Position of B` |
22:35:43 | FromDiscord | <Elegantbeef> No it's not a class! |
22:35:48 | FromDiscord | <Elegantbeef> I'll hunt you down for saying that! 😛 |
22:36:00 | FromDiscord | <tandy> lol |
22:36:03 | FromDiscord | <tandy> whats B? |
22:36:25 | FromDiscord | <Elegantbeef> Whatever type you want to see if it's type of |
22:36:32 | FromDiscord | <tandy> i dont want to see if its a type |
22:36:33 | FromDiscord | <Elegantbeef> So you have your `instance of Type` |
22:36:44 | FromDiscord | <tandy> i want to see whether the two instances have hte same values |
22:36:57 | FromDiscord | <codic> In reply to @codic "I am runniing into": This might be like a nim compiler bug because only thing I can think of is XGrabPointer is called even if ev.subwindow == None and the early return doesnt work |
22:37:01 | FromDiscord | <Elegantbeef> Can you make your own `==` proc |
22:37:21 | FromDiscord | <tandy> hmm good idea |
22:39:05 | FromDiscord | <Elegantbeef> Codic it's highly unlikely to be a nim compiler bug |
22:39:14 | FromDiscord | <Elegantbeef> It's vastly more likely to be an xlib api issue |
22:39:44 | FromDiscord | <tandy> sent a code paste, see https://play.nim-lang.org/#ix=3E2X |
22:39:46 | FromDiscord | <tandy> is this how it should look |
22:39:59 | FromDiscord | <Elegantbeef> What event type do you get? |
22:40:15 | FromDiscord | <Elegantbeef> No it's not how it should look |
22:40:26 | FromDiscord | <tandy> damn ok il look at the nim src then |
22:40:31 | FromDiscord | <codic> For some reason I don't get any MotionNotify or ButtonPress events after the proc early returns |
22:40:35 | FromDiscord | <Elegantbeef> That's how it should look 😀 |
22:40:35 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3E2Y |
22:40:45 | FromDiscord | <codic> But that makes no sense |
22:40:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/Xmp |
22:40:59 | FromDiscord | <tandy> lmao thank u |
22:41:04 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3E30 |
22:41:45 | FromDiscord | <codic> I updated it to just check if it's a client; aka the exact same thing, but still same issue |
22:41:52 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3E31 |
22:43:03 | FromDiscord | <Elegantbeef> You really like making code hard to follow dont you 😛 |
22:43:59 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3E32 |
22:44:39 | FromDiscord | <codic> What's hard to follow about that? |
22:44:53 | FromDiscord | <Elegantbeef> You do early returns which hides intent |
22:44:54 | FromDiscord | <codic> I think early break/continue is easier to follow personally |
22:45:10 | FromDiscord | <Elegantbeef> You dont care that it's not success you care that it is success |
22:46:14 | FromDiscord | <codic> I care that it's not success because if it's not success then I should not handle whatever garbage is in self.currEv |
22:46:26 | FromDiscord | <codic> Or I care if it's success because if it is I can execute what I want to |
22:46:30 | FromDiscord | <codic> You can argue either way really |
22:46:45 | FromDiscord | <Elegantbeef> I mean you care that it's successful |
22:46:52 | FromDiscord | <Elegantbeef> You're only running code when it's successful |
22:47:00 | FromDiscord | <codic> yea |
22:47:14 | FromDiscord | <codic> anyways I don't understand anything which could possibly cause this |
22:47:17 | FromDiscord | <Elegantbeef> Isnt it e.window not e.subwindow? |
22:47:51 | FromDiscord | <Elegantbeef> Actually i guess you're framing |
22:47:54 | FromDiscord | <codic> but I'm pretty sure it's x11 not nim because the wm handles other events just not motionnotify / buttonpress |
22:47:57 | FromDiscord | <codic> yeah ,tho that doesn't matter |
22:48:02 | FromDiscord | <codic> because any way it would early return |
22:48:10 | FromDiscord | <codic> (edit) "return" => "return, problem is after that it doesn't work" |
22:48:21 | FromDiscord | <codic> `if ev.subwindow == None` this case is hit when it should be hit |
22:48:28 | FromDiscord | <Elegantbeef> Sounds like you're forgetting to set some listen flags maybe |
22:50:03 | FromDiscord | <Elegantbeef> Also you're not using all events |
22:50:07 | FromDiscord | <codic> Oh I think I figured it out 1 sec |
22:50:08 | FromDiscord | <codic> wdym? |
22:50:23 | FromDiscord | <Elegantbeef> you should have something like https://github.com/beef331/goodwm/blob/master/src/goodwm.nim#L70-L71 |
22:50:36 | FromDiscord | <codic> nvm didn't figure it out |
22:50:40 | FromDiscord | <Elegantbeef> Where you iterate through all queued events |
22:50:46 | FromDiscord | <codic> hmm |
22:51:05 | FromDiscord | <Elegantbeef> Though that loop is different |
22:51:32 | FromDiscord | <codic> no change |
22:51:36 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3E34 |
22:51:37 | FromDiscord | <Elegantbeef> It runs indefinitely like yours except it uses a blocking selector to stop the loop inbetween processing |
22:51:53 | FromDiscord | <Elegantbeef> Yea didnt expect it to cahnge |
22:51:56 | FromDiscord | <codic> https://www.toptal.com/developers/hastebin/ukujakadod.swift here's the full code to put it in context |
22:51:56 | FromDiscord | <codic> ah |
22:52:03 | FromDiscord | <codic> lol hastebin thinks nim = swift |
22:53:02 | FromDiscord | <Elegantbeef> Debugging x isnt fun 😀 |
22:54:31 | FromDiscord | <codic> I agree |
22:54:57 | FromDiscord | <Elegantbeef> You dont create a screen |
22:55:05 | FromDiscord | <Elegantbeef> That might be an issue? |
22:55:13 | FromDiscord | <Elegantbeef> I'm just comparing to my WM at this point |
22:55:49 | FromDiscord | <codic> nah shouldnt be an issue |
22:55:57 | FromDiscord | <codic> What I see is happening is I get a ButtonPress but not a ButtonRelease |
22:56:04 | FromDiscord | <codic> Which is what causes the sisue |
22:56:21 | FromDiscord | <codic> but why??? |
22:56:35 | FromDiscord | <Elegantbeef> Cause you grab the pointer |
22:56:37 | FromDiscord | <Elegantbeef> I think |
22:56:51 | FromDiscord | <Elegantbeef> line 79 |
22:57:36 | FromDiscord | <codic> Pointer should be ungrabbed in ButtonRelease, that wouldn't stop me from getting the event |
22:57:37 | FromDiscord | <Elegantbeef> I dont know what's correct but my root window is the onlything that grabs the pointer |
22:57:43 | FromDiscord | <codic> But also if subwindow == None then I don't grab the pointer |
22:57:51 | FromDiscord | <codic> so no, that cant be related |
22:58:00 | FromDiscord | <codic> yeah thats for moving/resizing |
22:58:32 | FromDiscord | <Elegantbeef> [tandy](https://matrix.to/#/@tandy1000:matrix.org)\: so did the `==` work? |
22:58:41 | FromDiscord | <tandy> no \:( |
22:58:49 | FromDiscord | <Elegantbeef> What is Position? |
22:58:58 | FromDiscord | <Elegantbeef> A ref object or a normal object? |
22:59:10 | FromDiscord | <tandy> im using OOlib |
22:59:14 | FromDiscord | <Elegantbeef> Ok that doesnt help |
22:59:16 | FromDiscord | <tandy> sent a code paste, see https://play.nim-lang.org/#ix=3E36 |
22:59:19 | FromDiscord | <tandy> il have a look at the src |
22:59:23 | FromDiscord | <Elegantbeef> Is it a reference object or a normal object 😀 |
22:59:32 | FromDiscord | <Elegantbeef> I'm guessing a reference |
23:00:55 | FromDiscord | <tandy> i think ref yeah |
23:01:04 | FromDiscord | <tandy> source is a lil hard to understand but i only see ref objects being defined |
23:01:05 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3E39 |
23:01:31 | FromDiscord | <Elegantbeef> You can always just do `assert A is ref object` |
23:01:43 | FromDiscord | <tandy> oh smart |
23:01:51 | FromDiscord | <Elegantbeef> But i assume it is |
23:02:03 | FromDiscord | <Elegantbeef> What's the issue now? |
23:02:35 | FromDiscord | <Elegantbeef> Yea sorry codic I cannot help much, aside from looking at mine or prestiges WM and going "You dont do X like us" 😀 |
23:04:39 | FromDiscord | <codic> lol |
23:04:50 | FromDiscord | <codic> meh im too lazy im just gonna use my old rust version |
23:04:57 | FromDiscord | <codic> ill try to fix it later |
23:05:41 | FromDiscord | <Elegantbeef> Uh oh we lost tandy! |
23:05:55 | FromDiscord | <treeform> how to check if --threads:on or not was passed? |
23:06:13 | FromDiscord | <tandy> oh sorry beef, im hunting a bug, will test very soon \:) |
23:07:08 | FromDiscord | <amadan> sent a code paste, see https://paste.rs/S1y |
23:07:25 | FromDiscord | <Elegantbeef> You can also do `const threadsOn {.booldefine.} = false` afaik |
23:07:35 | FromDiscord | <Elegantbeef> that should be `threads` |
23:07:58 | FromDiscord | <amadan> Oh neat |
23:08:18 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-compileminustime-define-pragmas |
23:08:22 | FromDiscord | <Elegantbeef> Works for int, bool and str |
23:08:55 | FromDiscord | <Elegantbeef> Actually that might not work |
23:08:59 | FromDiscord | <tandy> it works \:))) thank u |
23:09:03 | FromDiscord | <Elegantbeef> SInce threads isnt a define |
23:09:15 | FromDiscord | <treeform> sent a code paste, see https://paste.rs/6Bd |
23:10:07 | FromDiscord | <Elegantbeef> Yep i was right in that it wouldnt work |
23:12:05 | FromDiscord | <treeform> I am trying to test my lib with both threads on and off: |
23:12:06 | FromDiscord | <treeform> https://media.discordapp.net/attachments/371759389889003532/905957607028695102/unknown.png |
23:12:12 | FromDiscord | <treeform> the compiler flag works for that |
23:44:40 | FromDiscord | <Goat> sent a long message, see http://ix.io/3E3j |
23:44:55 | FromDiscord | <Goat> (edit) "http://ix.io/3E3j" => "https://paste.rs/kdp" |
23:45:52 | FromDiscord | <Elegantbeef> What's the interesting library? |
23:49:59 | FromDiscord | <Goat> At the moment it's nimib and LiteStore |
23:50:31 | FromDiscord | <Goat> I want to make a web version of the Alone Against The Flames adventure for Call of Cthulhu |
23:51:37 | FromDiscord | <Goat> And I want to test out LiteStore as a db for stuff |