00:05:22 | FromDiscord | <gogolxdong> In reply to @Elegantbeef "https://www.jasonbeetham.com/snake/nicoscripter.htm": I didn't see any repository |
00:05:36 | FromDiscord | <Elegantbeef> I do not have one setup |
00:10:14 | FromDiscord | <gogolxdong> haha 😆 |
00:10:42 | FromDiscord | <Elegantbeef> It's just nimscripter + nico + emscripten |
00:42:18 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4ssc |
00:44:19 | FromDiscord | <Ayy Lmao> I think you can cast the first element's address if I'm not mistaken. |
00:45:09 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Ayy Lmao "I think you can": cast the pointer to UncheckedArray? |
00:45:26 | FromDiscord | <Ayy Lmao> `cast[UncheckedArray[byte]](tex[0].addr)` I think |
00:46:59 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Ayy Lmao "`cast[UncheckedArray[byte]](tex[0].addr)` I think": https://media.discordapp.net/attachments/371759389889003532/1091886458308137080/image.png |
00:47:46 | FromDiscord | <Ayy Lmao> `cast[UncheckedArray[ptr byte]](tex[0].addr)` maybe? or `cast[ptr UncheckedArray[byte]](tex[0].addr)`? |
00:47:55 | FromDiscord | <Ayy Lmao> I always get confused on unchecked arrays |
00:48:31 | FromDiscord | <System64 ~ Flandre Scarlet> It works, thanks |
00:48:37 | FromDiscord | <Ayy Lmao> No problem |
00:49:17 | FromDiscord | <Elegantbeef> `ptr Unchecked[byte]` only makes sense |
00:49:36 | FromDiscord | <Elegantbeef> `UncheckedArray[byte]` would mean it's a contiguous array, it only makes sense really on manually managed objects |
00:50:08 | FromDiscord | <Ayy Lmao> I had no idea Unchecked was a thing |
00:50:26 | FromDiscord | <Ayy Lmao> I was running into an issue a while ago with UncheckedArray and that is probably my solution. |
00:51:57 | FromDiscord | <Elegantbeef> `UncheckedArray`\ |
00:53:04 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/C5S |
00:55:33 | FromDiscord | <Elegantbeef> It's the equivlent of a `[]` in C |
00:56:37 | FromDiscord | <Ayy Lmao> I haven't seen `toOpenArray` before |
00:56:55 | FromDiscord | <Elegantbeef> Stay awhile and listen |
00:57:11 | FromDiscord | <Ayy Lmao> Not even sure what it does because I thought you could only have them in function arguments |
00:57:22 | FromDiscord | <Elegantbeef> Exactly |
00:57:49 | FromDiscord | <Elegantbeef> It converts a `ptr UncheckedArray[...]` to `openArray[...]` which nim supports |
00:58:47 | FromDiscord | <Ayy Lmao> Is an openArray just something you can index but bounds checked? |
01:03:22 | FromDiscord | <Ayy Lmao> Also unrelated question, is there any serious downside to implementing runtime polymorphism by storing a function pointer inside an object as opposed to using a method? |
01:06:22 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4ssf |
01:06:27 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4ssg |
01:07:50 | FromDiscord | <Elegantbeef> Sokam stop using a generic and just use a procedure |
01:08:34 | FromDiscord | <sOkam!> that means having a procedure for every type used in the material |
01:08:52 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ssi |
01:08:54 | FromDiscord | <Elegantbeef> Yes....? |
01:09:17 | FromDiscord | <Elegantbeef> You already are doing the same thing |
01:09:48 | * | ltriant joined #nim |
01:11:20 | FromDiscord | <sOkam!> i guess ill take the hit and keep the when cases |
01:11:51 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4ssj |
01:12:49 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4ssk |
01:12:50 | FromDiscord | <Ayy Lmao> sent a code paste, see https://paste.rs/gGr |
01:14:29 | FromDiscord | <sOkam!> learnopengl is confusing for starting, do not recommend. its only good when you are already decent at it↵Cannot recommend this series enough. He actually explains the basics in an understandable way↵https://www.youtube.com/watch?v=6dtqg0r28Yc&list=PLA0dXqQjCx0S04ntJKUftl6OaOgsiwHjA&index=4 |
01:14:52 | * | ltriant quit (Ping timeout: 276 seconds) |
01:15:28 | FromDiscord | <sOkam!> when you reach the specular/diffuse chapter, then learnopengl becomes valuable again. but for starting from no knowledge... learnopengl skims over crucial stuff that you actually need for everything you do later on |
01:17:06 | FromDiscord | <sOkam!> learnopengl = this is what you do↵ogldev = this is why you do things, how to do it explained in human words, and then what to do with code to achieve those |
01:18:39 | FromDiscord | <Ayy Lmao> Asking this again: Is there any serious downside to implementing runtime polymorphism by storing a function pointer inside an object as opposed to using a method? |
01:20:21 | FromDiscord | <Ayy Lmao> The only cost is having to store a pointer for each function you use right? |
01:20:58 | FromDiscord | <sOkam!> In reply to @Ayy Lmao "Asking this again: Is": i believe there is a nimble package/library for doing polymorphism in nim. might be worth checking |
01:21:02 | FromDiscord | <Yardanico> In reply to @Ayy Lmao "Asking this again: Is": I think that's normal, even Nim's own streams use that |
01:21:18 | FromDiscord | <Yardanico> In reply to @sOkam! "i believe there is": yeah https://github.com/yglukhov/iface basically does that but with all macro magic |
01:21:52 | FromDiscord | <Ayy Lmao> Interesting, I'll check it out, thanks! |
01:22:39 | FromDiscord | <Yardanico> <https://nim-lang.org/docs/streams.html#StreamObj> |
01:22:46 | FromDiscord | <Yardanico> you can see that it's just an object with procs |
01:23:02 | FromDiscord | <Yardanico> and then actual implementations like FileStream assign their own implementations |
01:23:21 | FromDiscord | <Yardanico> Also see <https://github.com/def-/nimes/commit/baefb72c290471f5b487910e1545614b9a3d24b3> for showing how to do methods -> procs |
01:23:28 | FromDiscord | <Yardanico> this PR was because methods were slow with ARC back then :) |
01:23:41 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @sOkam! "learnopengl is confusing for": Might be useful↵Btw↵``glBindVertexArray(VAO);`` What is VAO? |
01:28:10 | * | ltriant joined #nim |
01:33:16 | FromDiscord | <sOkam!> sent a long message, see http://ix.io/4ssm |
01:33:46 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright |
01:34:06 | * | ltriant quit (Ping timeout: 255 seconds) |
01:35:56 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4ssn |
01:36:20 | FromDiscord | <sOkam!> you are drawing only once on init, and then clearing the screen every frame |
01:37:02 | FromDiscord | <sOkam!> also missing the part where you upload the vertex data to opengl. the buffers are created, but they are currently empty |
02:00:26 | NimEventer | New thread by alexeypetrushin: Why auto doesn't work with void?, see https://forum.nim-lang.org/t/10061 |
02:19:03 | * | ltriant joined #nim |
02:23:28 | * | ltriant quit (Ping timeout: 248 seconds) |
02:37:03 | * | ltriant joined #nim |
02:37:11 | termer | Is it possible to create macros and use them as pragmas for type defs? |
02:38:01 | termer | I'm trying to make a macro called "implements" that ensures a type implements a specific conept |
02:38:03 | termer | *concept |
02:39:15 | termer | oh, looks like I had a syntax error |
02:39:18 | termer | lol |
02:39:21 | termer | It works |
02:39:22 | FromDiscord | <Elegantbeef> Type section macros can only generate type section code |
02:40:54 | termer | it should be all right |
02:41:32 | FromDiscord | <Elegantbeef> Depending on the concept it's generally just easier for a `MyType.implements(MyConcept` |
02:41:45 | FromDiscord | <Elegantbeef> Atleast that's what i learned with traitor |
02:42:41 | termer | is that already a macro or is that something I need |
02:42:44 | termer | also is traitor a library |
02:42:50 | termer | would rather use that and not reinvent the wheel |
02:42:53 | * | ltriant quit (Ping timeout: 268 seconds) |
02:42:55 | termer | if it does what I need |
02:42:58 | FromDiscord | <Elegantbeef> It's something i suggest instead of typesection macros |
02:43:09 | FromDiscord | <Elegantbeef> https://github.com/beef331/traitor#what-does-it-do |
02:43:27 | FromDiscord | <Elegantbeef> I have a rewrite that changes it drastically and is much cleaner but yea it's rust Trait-ish |
02:44:06 | FromDiscord | <Elegantbeef> The rewrite looks like https://github.com/beef331/traitor/blob/traitor1/traitor.nim#L282-L345 |
02:46:01 | termer | Looks interesting but something I'll have to check out later |
02:46:21 | termer | a bit more complicated than I need for what I'm working on |
02:46:28 | FromDiscord | <Elegantbeef> I do not know exactly what you're checking for |
02:46:32 | FromDiscord | <System64 ~ Flandre Scarlet> How to block segfaults :↵1 : Import ``std/segfaults``↵2 : Try Except statements↵3 : No segfault anymore |
02:47:16 | FromDiscord | <Elegantbeef> I'd just write a `template implements(T, Y: typedesc): untyped = static: assert T is Y` |
02:47:25 | termer | Pretty much a clean way of writing |
02:47:25 | termer | when thing isnot ConceptThing: {.fatal: "Nope".} |
02:47:28 | FromDiscord | <Elegantbeef> That's not how you fix segfaulting |
02:47:43 | termer | hahaha |
02:48:28 | FromDiscord | <Elegantbeef> You can use a type section macro of course, but you still need a method for if you have a type that matches the concept but not at the declaration |
02:48:37 | FromDiscord | <Elegantbeef> So i'd just go with the template and call it a day |
02:48:46 | termer | fair enough |
02:48:53 | termer | I thought I'd be fancy but it looks like you're right lol |
02:49:31 | FromDiscord | <Elegantbeef> Yea pretty much any type or concept that needs implementations defined fall apart there |
02:49:37 | FromDiscord | <Elegantbeef> 😄 |
02:50:31 | FromDiscord | <Elegantbeef> It would be nice if the compiler had some sort of `{.enforce: MyConcept.}` which is ensured to be implemented |
02:50:53 | termer | Yeah I'd appreciate that a lot since it's very annoying right now |
02:51:05 | termer | I need some sort of compile time assurance that my types comform to the concepts I want them to |
02:51:07 | FromDiscord | <Elegantbeef> But Nim has too many experimental features 😄 |
02:51:27 | termer | Of many of the experimental features, concepts should be solidified |
02:51:31 | termer | cause it's incredibly useful |
02:51:38 | FromDiscord | <Elegantbeef> Well i find the old style work fine |
02:51:54 | termer | I don't like the thing with proc pointers at all |
02:52:00 | termer | also you have to store more data (the pointers themselves) |
02:52:00 | FromDiscord | <Elegantbeef> People try to do too fancy things with them and they fall apart, but you have to learn your way around their 'features' |
02:52:27 | termer | also, sometimes people don't implement all the features on the type so you get a null deref when you try calling one of them |
02:52:30 | FromDiscord | <Elegantbeef> Well the proc pointers in traitor was just cause I could |
02:52:40 | termer | this is the case in at least one stdlib module |
02:52:59 | FromDiscord | <Elegantbeef> You should never get a runtime error for something not implementing a procedure |
02:52:59 | termer | I think in osproc it was, if you try peeking a process stream it segfaults |
02:53:08 | termer | Araq didn't seem to think this was a problem |
02:53:25 | termer | it's because the impl proc pointer was a null pointer |
02:53:25 | FromDiscord | <Elegantbeef> Well i disagree with him a lot so... |
02:53:28 | termer | it just wasn't implemented |
02:53:43 | termer | No documentation on this fact either |
02:53:44 | FromDiscord | <Elegantbeef> Sure but the streams API doesnt need to be a runtime typed |
02:54:00 | termer | I'm currently working on a streams library cause the async streams in the stdlib are so bad lol |
02:54:15 | termer | I don't think the people who wrote asyncstreams ever worked with async streams |
02:54:39 | termer | Sure, it's an "unstable" API |
02:55:08 | termer | but you'd expect something so fundamental (and used in other parts of the stdlib) to not have fundamental flaws that make them useless for real-world application |
02:55:29 | FromDiscord | <Elegantbeef> i do not write real world applications or use async 😄 |
02:55:47 | termer | and that's why Nim never gets talked about seriously |
02:56:10 | termer | My current project is bringing httpx up to a production-ready level |
02:56:25 | termer | and it was from that point I learned that httpbeast is basically a tech demo |
02:56:44 | termer | and subsequently that most things people write in Nim are tech demos and toys |
02:57:28 | termer | sometimes I think that Status is the only group using Nim for anything *but* toys lol |
03:03:27 | termer | I am determined to write production code in Nim |
03:03:39 | termer | all these silly libraries and bugs will never stop me! |
03:04:22 | FromDiscord | <Elegantbeef> Well when it comes to compiler bugs on the type system I'm here to help 😛 |
03:27:29 | FromDiscord | <gogolxdong> One more thing is system async modules conflict with status async libraries which focus on blockchain development. |
03:29:57 | * | ltriant joined #nim |
03:34:24 | * | ltriant quit (Ping timeout: 248 seconds) |
03:57:29 | FromDiscord | <Dudugz> Does Nim v2 fix traceback for async errors? |
04:00:57 | * | Guest74 joined #nim |
04:01:28 | * | Guest74 quit (Client Quit) |
04:01:44 | * | Guest74 joined #nim |
04:02:01 | * | ltriant joined #nim |
04:13:38 | * | Guest74 quit (Ping timeout: 260 seconds) |
04:17:52 | termer | Elegantbeef How do you define procs for a concept |
04:20:44 | FromDiscord | <Elegantbeef> just call it inside the concept body |
04:20:50 | FromDiscord | <user2m> random question why do we have to import tables to use tables, but don't have to import anything to use arrays and sequences ? |
04:21:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ssH |
04:21:26 | FromDiscord | <Elegantbeef> Cause `seq` and `array` are first class data types |
04:21:40 | termer | I was doing |
04:21:41 | termer | type Thing = concept x |
04:21:41 | termer | proc doStuff(this: x) |
04:21:53 | FromDiscord | <Elegantbeef> Only new style concepts work with that |
04:21:53 | termer | is that not something you can do? |
04:22:01 | termer | what are new style concepts exactly |
04:22:02 | FromDiscord | <Elegantbeef> it'd be `proc doStuff(this: Self)` |
04:22:25 | FromDiscord | <ringabout> And there is no varaible after concept |
04:22:31 | FromDiscord | <ringabout> (edit) "varaible" => "varible" |
04:22:36 | FromDiscord | <ringabout> (edit) "varible" => "variable" |
04:23:02 | FromDiscord | <Elegantbeef> New style concepts use the procedure definition instead of just arbitrary expressions |
04:23:14 | termer | It seems to not work on 1.6.12 |
04:23:19 | termer | It doesn't enforce it |
04:23:50 | termer | the issue is that the calling syntax makes it very hard to do method-style procs |
04:23:53 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ssI |
04:24:14 | termer | oh wait |
04:24:21 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ssJ |
04:24:25 | termer | you can just use x as the argument |
04:24:26 | termer | I'm retarded |
04:24:50 | termer | though, calling other things, you need some sort of implementation |
04:25:08 | termer | when you say new style, what are you referring to exactly |
04:25:12 | termer | what supports the new style? |
04:27:01 | termer | https://play.nim-lang.org/#ix=4ssK |
04:27:11 | FromDiscord | <ringabout> In reply to @termer "when you say new": It means https://github.com/nim-lang/RFCs/issues/168 |
04:27:38 | FromDiscord | <ringabout> Which is partly implemented by https://github.com/nim-lang/Nim/pull/15251 |
04:27:59 | FromDiscord | <ringabout> Though it still lacks some kind of documentation https://github.com/nim-lang/Nim/issues/20225 |
04:28:17 | termer | Is this present in devel |
04:28:27 | termer | I'm assuming it's not present in stable |
04:28:49 | FromDiscord | <ringabout> It is present in the stable. |
04:29:36 | FromDiscord | <ringabout> Here is a spec => https://github.com/nim-lang/Nim/blob/devel/tests/concepts/tspec.nim |
04:32:03 | termer | Ok this makes more sense |
04:33:32 | * | om3ga quit (Ping timeout: 250 seconds) |
04:34:55 | termer | New-style concepts are much better |
04:35:12 | termer | The old one is interesting but much harder to use in practice |
04:36:21 | termer | Can you not use doc comments in a new-style concept? |
04:36:36 | termer | unexpected construct in the new-styled concept: ## Concept to be implemented by async read streams. |
04:36:54 | termer | This might be a bug, because I'm sure you would want to document them |
04:37:00 | FromDiscord | <ringabout> Nope, it is ignored on the devel afaik |
04:37:46 | FromDiscord | <ringabout> In reply to @termer "This might be a": Yeah, it was fixed by https://github.com/nim-lang/Nim/pull/20752 |
04:38:40 | termer | Ok, I suppose that will be present in a future release |
04:39:01 | termer | Is it possible to describe properties of an object in a new-styled concept? |
04:40:10 | FromDiscord | <ringabout> Nope I think. |
04:40:46 | termer | That's not a big deal |
04:41:08 | termer | In the old-style, I was able to make descriptions that were ambiguous, like |
04:41:16 | termer | x.isFinished is bool |
04:41:20 | termer | which could be either a proc or a property |
04:41:25 | termer | but that's not really desirable in the real world |
04:41:44 | termer | Also harder to document |
04:42:53 | termer | Is there a way to explicitly inherit from another concept, ringabout? |
04:43:05 | termer | for example, in the old style you could do |
04:43:06 | termer | x is AsyncWriteStream[T] |
04:43:38 | FromDiscord | <Elegantbeef> Break each part into it's own concept |
04:44:11 | termer | I was thinking that was what I'd do, but I wanted to see if it was possible to do inheritence first |
04:44:26 | FromDiscord | <Elegantbeef> Nah do not do that it causes recursive look ups |
04:44:34 | FromDiscord | <Elegantbeef> Also the field syntax is exactly what one wants |
04:44:39 | termer | Perhaps |
04:44:44 | FromDiscord | <Elegantbeef> It is what gives the code such great power |
04:44:57 | termer | Field syntax is great for virtual properties basically |
04:45:09 | termer | inline func that returns a value |
04:45:24 | termer | or proc with undocumented side-effects if you're evil |
04:46:26 | FromDiscord | <Elegantbeef> The beauty is it doesnt matter to you |
04:46:58 | termer | I'm pretty conservative with features I use |
04:47:05 | termer | and would prefer things to be more explicit at times |
04:47:13 | termer | which is ironic given the fact that I'm using Nim |
04:47:43 | FromDiscord | <Elegantbeef> Sure but whether a generic has a field or a proc doesnt matter as long as it's typed properly |
04:48:24 | termer | It does matter if it has side-effects |
04:48:33 | termer | which is why it's best if those virtual properties are func |
04:49:00 | FromDiscord | <Elegantbeef> Macros do work inside concepts |
04:49:14 | FromDiscord | <Elegantbeef> So if you want to ensure it's a field or a func you can make a macro that does the check for you |
04:49:24 | termer | or I declare them as func lol |
04:49:27 | termer | which is what I'm doing right now |
04:49:35 | termer | func queueMaxLen(): int |
04:49:35 | termer | ## The queue's max length |
04:49:50 | FromDiscord | <Elegantbeef> I mean inside the concept you can do `isFunc(a.doThing())` |
04:50:01 | termer | oh right, well I'm using new-styled concept now |
04:50:06 | FromDiscord | <Elegantbeef> where `isFunc` is a macro that ensures your `doThing` is a func |
04:50:13 | termer | good to know |
04:50:14 | FromDiscord | <Elegantbeef> Yea they work |
04:50:19 | FromDiscord | <Elegantbeef> Though i find them less useful |
04:50:35 | termer | I really just need to do an OOP-style interface so it works fine for this purpose |
04:50:54 | termer | The original style of concept is brilliant |
04:51:08 | termer | but in practice can be hard to use for traditional tasks like defining a set of methods |
04:52:09 | termer | oh yeah also, for a virtual setter, you do |
04:52:10 | termer | `=queueMaxLen`(this: Self, newMaxLen: int) |
04:52:11 | termer | right? |
04:55:41 | * | azimut quit (Ping timeout: 255 seconds) |
04:57:00 | termer | Uh oh |
04:57:11 | termer | cannot instantiate: 'Option[T]'; Maybe generic arguments are missing? |
04:57:38 | termer | This happens when I define a proc that returns an Option |
04:58:51 | termer | https://play.nim-lang.org/#ix=4ssP |
04:59:42 | termer | perhaps this feature isn't ready yet |
05:03:48 | * | ltriant quit (Ping timeout: 255 seconds) |
05:15:28 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4ssR |
05:16:03 | FromDiscord | <Elegantbeef> `{...}` is an array syntax so you'd need to use a macro |
05:16:07 | FromDiscord | <Elegantbeef> Then an object variant |
05:16:25 | termer | where's the {} |
05:16:49 | FromDiscord | <user2m> In reply to @Elegantbeef "`{...}` is an array": I thought {...} was set syntax? |
05:17:05 | termer | oh you're talking to someone else |
05:17:05 | FromDiscord | <Elegantbeef> `{a: b}` is table constr |
05:17:06 | FromDiscord | <Elegantbeef> `{a, b, c}` is set |
05:17:10 | termer | my bad |
05:17:35 | FromDiscord | <Elegantbeef> table constructor is sugar to `[(a, b)]` |
05:18:00 | FromDiscord | <Elegantbeef> But you could also just make a `Table[string, YourVariant]` |
05:19:29 | termer | Nim's template errors are incredibly unhelpful lol |
05:19:40 | termer | the error compile in my thing was a lack of a generic specified somewhere completely different |
05:20:53 | FromDiscord | <user2m> Ok I guess what I'm asking is how would I go about creating a table with multiple key, value types in it? like a key or value could be of type int or string ? |
05:22:40 | FromDiscord | <Elegantbeef> Object variants |
05:24:22 | FromDiscord | <user2m> In reply to @Elegantbeef "Object variants": Thank you I'll look into it!! |
05:54:08 | termer | https://play.nim-lang.org/#ix=4ssU |
05:54:16 | termer | Ok, here's my latest conundrum |
05:54:25 | termer | The assertion fails here |
05:54:33 | termer | as far as I can tell, it should match |
05:54:54 | FromDiscord | <Elegantbeef> `SimpleImpl` is a typeclass |
05:55:19 | termer | what's the significance of that |
05:56:04 | * | arkurious quit (Quit: Leaving) |
05:56:31 | FromDiscord | <Elegantbeef> Ah the bigger issue is you have no way to reason T |
05:57:18 | termer | Not sure how I could |
05:57:23 | FromDiscord | <Elegantbeef> Though it doesnt seem to resolve it |
05:57:45 | termer | I think generics are pretty much broken in new-styled concepts |
05:57:55 | termer | because as far as I can tell, I can't get it to understand this |
05:58:19 | FromDiscord | <Elegantbeef> Well `Simple[T]` without anything to reason `T` makes no sense |
05:58:47 | termer | the original thing I was doing was DummyStream[T] |
05:58:54 | termer | so you could create a stream of anything |
05:59:10 | FromDiscord | <Elegantbeef> You still need to bind the T |
05:59:32 | termer | how can I bind it to something if I don't know what that thing is on the proc |
05:59:48 | termer | if you're talking about at the assertion, I already tried it with [string] |
05:59:58 | FromDiscord | <Elegantbeef> No i mean in the concept |
06:00:07 | termer | are you saying Self[T]? |
06:00:15 | termer | or wait a minute |
06:00:17 | FromDiscord | <Elegantbeef> No |
06:00:32 | termer | so waht do you mean |
06:01:22 | FromDiscord | <Elegantbeef> Inside the concept there is no way of reasoning what type the T is |
06:01:37 | FromDiscord | <Elegantbeef> It has no associated type it's just a generic parameter |
06:02:00 | FromDiscord | <Elegantbeef> It seems it does not cause issues, but it should |
06:02:22 | termer | I mean, I'm not sure what other way I could use to implement a generic object like that |
06:02:45 | FromDiscord | <Elegantbeef> It seems it doesnt matter here and just take the generic parameter of the type |
06:02:49 | FromDiscord | <Elegantbeef> Which is wrong |
06:03:30 | * | derpydoo joined #nim |
06:03:49 | termer | Any version of SimpleImpl that uses a concrete type has no issues |
06:04:00 | termer | or rather, with no type param at all |
06:04:04 | FromDiscord | <Elegantbeef> Concepts seem buggy |
06:04:06 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4ssX |
06:04:11 | FromDiscord | <Elegantbeef> Well new concepts |
06:04:45 | termer | ok so what this tells me is that concepts are barely usable if you have generics going on |
06:05:00 | FromDiscord | <Elegantbeef> New style are not |
06:05:01 | FromDiscord | <Elegantbeef> Old style make sense and work |
06:05:16 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4ssZ |
06:05:20 | termer | Except you have to have some way of instantiating certain things |
06:05:20 | FromDiscord | <Elegantbeef> Works fine |
06:05:31 | termer | like you have to have some way of representing another type |
06:05:31 | FromDiscord | <Elegantbeef> What? |
06:05:38 | termer | let me give you an example |
06:05:40 | FromDiscord | <Elegantbeef> What? |
06:05:50 | termer | I'm writing an example |
06:09:51 | termer | https://play.nim-lang.org/#ix=4st3 |
06:10:04 | termer | I have no idea how to represent an argument of type WriteStream here |
06:10:13 | termer | because WriteStream is also a concept |
06:10:41 | termer | wait I'm retarded hold on |
06:10:57 | termer | https://play.nim-lang.org/#ix=4st5 |
06:11:00 | termer | fixed example |
06:11:58 | FromDiscord | <Elegantbeef> Right i see the issue |
06:14:08 | termer | The issue is how to represent generic types and concepts as arguments |
06:14:39 | termer | now, it's possible to get around this with macros, MAYBE |
06:14:49 | termer | but at that point, the amount of hackery going on is ridiculous |
06:15:03 | FromDiscord | <Elegantbeef> Well there is no issue representing them as arguments |
06:15:22 | termer | I just demonstrated how there is an issue representing them as arguments |
06:15:52 | FromDiscord | <Elegantbeef> No you didnt |
06:15:52 | FromDiscord | <Elegantbeef> Like what requirements does `WriteStream` need? |
06:16:23 | termer | there's a proc called pipeTo whose second argument is of type WriteStream[T] |
06:16:51 | termer | I don't know what WriteStream needs, because it's a concept |
06:16:59 | termer | it's going to be implemented by something else beyond my control |
06:17:07 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4st7 |
06:17:31 | termer | what a mindfuck |
06:17:46 | termer | so effectively I need to include all possible non-concrete types that will be referenced as generics |
06:17:55 | termer | Still not sure how I can represent that as an argument though |
06:17:59 | FromDiscord | <Elegantbeef> There are other methods that might work |
06:19:14 | FromDiscord | <Elegantbeef> i'm looking at alternatives now |
06:19:37 | termer | So far I'm stuck on the second argument and how effectively represent an instance of that generic concept lol |
06:27:17 | FromDiscord | <Elegantbeef> Hmph i do not think there is a way to constrain it to a concept |
06:27:27 | FromDiscord | <Elegantbeef> Aside from the generic parameter approach |
06:28:05 | termer | the generic parameter approach, the issue is that you can't represent it as an argument |
06:28:22 | termer | like are you supposed to do x.pipeTo(Y()) |
06:28:27 | termer | because that only works on non-ref objects |
06:28:30 | FromDiscord | <Elegantbeef> You can just do `Y` |
06:28:34 | FromDiscord | <Elegantbeef> or do `var y: Y` |
06:28:40 | termer | oh shit you're right |
06:28:46 | termer | man this is all kinds of fucked up |
06:29:17 | termer | of course, newer compiler versions that inevitably require you to initialize the variable before using it will break that |
06:29:33 | FromDiscord | <Elegantbeef> Nah concept code |
06:29:42 | termer | concept code is based on compiles() |
06:30:07 | termer | so if the compiler requires you to initialize vars (which I've read musing about), the var thing: Y concept will break |
06:30:17 | FromDiscord | <Elegantbeef> Correct, but i mean "Within the concept body, types can appear in positions where ordinary values and parameters are expected. " |
06:30:24 | FromDiscord | <Elegantbeef> Concepts do have specialised logic |
06:30:36 | termer | I see what you're saying |
06:30:46 | termer | Does seem incredibly volatile though |
06:31:08 | FromDiscord | <Elegantbeef> You can do `default(Y)` if you're really concerned |
06:31:16 | termer | oh yeah |
06:31:21 | termer | there are so many features I forget them |
06:34:00 | termer | ok so here's my attempt using default() and making additional types into their own generic params |
06:34:09 | termer | https://play.nim-lang.org/#ix=4stc |
06:34:23 | termer | No luck |
06:34:40 | termer | I legitimately think this is impossible |
06:34:52 | FromDiscord | <Elegantbeef> One second |
06:39:05 | termer | as far as generics go, it seems to have problems with applying generic params to other types with generic params |
06:45:59 | termer | Ok yeah, they just don't work no matter what I do |
06:46:14 | termer | I removed the WriteStream proc and it simply doesn't work with generics |
06:46:18 | termer | I think it's pretty busted |
06:46:41 | termer | Tried new and old style |
06:49:55 | termer | ElegantBeef Thanks for the massive help on this |
06:50:03 | termer | Ultimately though, I think it's simply unusable |
06:50:21 | termer | A shame cause it could have been very useful |
06:50:51 | FromDiscord | <Elegantbeef> Well parts of it can be used |
06:51:20 | termer | I couldn't get any of my real-world use-case working |
06:51:32 | FromDiscord | <Elegantbeef> Like `pipeTo` doesnt really need constrained if you call it inside a procedure that limits to `ReadStream, WriteStream` |
06:51:43 | termer | yeah, I removed that and it still didn't work |
06:52:09 | FromDiscord | <Elegantbeef> Well `assert TypeClass is Concept` will never work |
06:52:16 | termer | ey? |
06:52:20 | termer | it does work for other things |
06:52:32 | termer | It works for typeclasses |
06:52:34 | FromDiscord | <Elegantbeef> What does it work for? |
06:52:43 | termer | you can do it if it understands the procs |
06:52:58 | FromDiscord | <Elegantbeef> I mean i showed it works as a parameter |
06:53:13 | termer | https://github.com/termermc/nim-asyncstream-core |
06:53:27 | termer | https://github.com/termermc/nim-asyncstream-core/blob/master/src/asyncstream_core.nim |
06:53:29 | termer | https://github.com/termermc/nim-asyncstream-core/blob/master/src/asyncstream_core/dummy.nim |
06:53:50 | termer | I removed the pipeTo bit from the main file and it didn't work |
06:54:25 | termer | You'll notice all the Future and Option uses |
06:54:29 | termer | it really trips up on those |
06:56:07 | termer | lol unarchived it to push the removal of the pipeTo bits |
06:56:11 | termer | but you'll see what I mean |
07:22:13 | * | Notxor joined #nim |
08:34:24 | * | ltriant joined #nim |
08:38:54 | * | ltriant quit (Ping timeout: 255 seconds) |
08:59:19 | * | ltriant joined #nim |
09:15:55 | FromDiscord | <demotomohiro> I found a small mistake in example code of `proc add[T](x: var seq[T]; y: openArray[T]) {.noSideEffect.}`, so I'm going to fix it.↵But `nim doc system.nim` result in compile error:↵Nim/lib/system/compilation.nim(18, 52) Error: type mismatch: got 'None' for 'false' but expected 'bool'↵https://github.com/nim-lang/Nim/blob/63b4b3c5b8c930ffc271c5e4e1a446e8616b2571/lib/system/compilation.nim#L18 |
09:17:59 | FromDiscord | <demotomohiro> This example code is calling `proc add[T](x: var seq[T]; y: sink T)`, not `proc add[T](x: var seq[T]; y: openArray[T])`↵https://nim-lang.org/docs/system.html#add%2Cseq%5BT%5D%2CopenArray%5BT%5D |
09:34:28 | * | ltriant quit (Ping timeout: 252 seconds) |
10:08:02 | * | ltriant joined #nim |
10:12:50 | * | ltriant quit (Ping timeout: 250 seconds) |
10:28:26 | * | Notxor quit (Remote host closed the connection) |
10:31:55 | FromDiscord | <jmgomez> Is there a way to tell a function that an object should be pass as copy? I know you can specify it in the type def but that will be applied everywhere |
10:32:28 | FromDiscord | <Andreas> git clone https://github.com/bytecodealliance/wasmtime.git/crates/c-api |
10:35:10 | FromDiscord | <ringabout> Nope, but it is a good feature, which could be implemented in the future. |
10:39:37 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4su7 |
10:40:33 | FromDiscord | <jmgomez> The quick fix is to add bycopy in the type itself |
10:43:34 | FromDiscord | <ringabout> Yeah, I cannot think of other solutions. |
10:45:02 | * | ltriant joined #nim |
10:50:45 | * | ltriant quit (Ping timeout: 255 seconds) |
11:15:04 | * | ltriant joined #nim |
11:19:33 | * | ltriant quit (Ping timeout: 255 seconds) |
11:34:48 | * | Notxor joined #nim |
11:34:48 | * | ltriant joined #nim |
11:42:35 | * | ltriant quit (Ping timeout: 248 seconds) |
13:04:32 | FromDiscord | <demotomohiro> In reply to @demotomohiro "I found a small": I sent PR: https://github.com/nim-lang/Nim/pull/21607 |
13:13:22 | * | beholders_eye joined #nim |
13:19:36 | * | PMunch joined #nim |
13:22:04 | * | ltriant joined #nim |
13:26:54 | * | ltriant quit (Ping timeout: 265 seconds) |
13:30:23 | FromDiscord | <@@prestosilver> sent a code paste, see https://play.nim-lang.org/#ix=4suL |
13:31:42 | FromDiscord | <@@prestosilver> Not the exact same behaviour, pretty close tho |
13:32:51 | * | kenran joined #nim |
13:44:19 | PMunch | Hmm, I have a `proc to[T: object](someObj: SomeObject, t: typedesc[T]): T =` definition, which works fine, but I want to pass the object symbol on to a macro to generate the body of the proc |
13:44:43 | PMunch | When I pass T to the macro as a typed argument I jut get `sym T` though with a nil impl.. |
13:45:16 | * | beholders_eye quit (Ping timeout: 252 seconds) |
13:46:43 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/yrJ |
13:48:11 | FromDiscord | <Rika> countup proc? |
13:48:35 | * | kenran quit (Remote host closed the connection) |
13:51:15 | * | nanxiao joined #nim |
13:53:05 | FromDiscord | <System64 ~ Flandre Scarlet> Thanks! |
14:06:44 | * | kenran joined #nim |
14:08:56 | * | ltriant joined #nim |
14:13:42 | * | ltriant quit (Ping timeout: 255 seconds) |
14:31:01 | * | beholders_eye joined #nim |
14:33:58 | PMunch | ElegantBeef, I think you need to do some SEO work on fungus :P I tried to google it and Google wanted to correct it to "bum fungus".. |
14:34:22 | * | derpydoo quit (Ping timeout: 276 seconds) |
14:37:00 | * | nanxiao quit (Quit: Client closed) |
14:37:41 | * | nanxiao joined #nim |
14:38:20 | PMunch | Uhm, say what now: Error: redefinition of 'settings'; previous declaration here: /home/peter/.choosenim/toolchains/nim-#version-2-0/lib/std/genasts.nim(89, 13) |
14:38:38 | * | azimut joined #nim |
14:43:02 | * | kenran quit (Remote host closed the connection) |
14:43:53 | * | nanxiao quit (Quit: Client closed) |
15:08:06 | FromDiscord | <Marcus> hmm, I wonder why nim-setup-action is so extremely slow on macos. |
15:09:07 | FromDiscord | <Marcus> seeing 3-5 seconds on linux, 40-5 seconds on windows and 5-8 minutes on macos 🧩 |
15:13:19 | NimEventer | New thread by nimian: Anyone tried GPT-4 for Nim?, see https://forum.nim-lang.org/t/10062 |
15:27:38 | * | ltriant joined #nim |
15:27:59 | FromDiscord | <michaelb.eth> In reply to @Marcus "seeing 3-5 seconds on": Do you have a link for nim-setup-action?↵↵I’m guessing that the Nim compiler and tools are being compiled for macOS but are prebuilt downloads for Linux and Windows |
15:32:27 | * | ltriant quit (Ping timeout: 248 seconds) |
15:34:26 | FromDiscord | <Marcus> https://github.com/jiro4989/setup-nim-action↵(@michaelb.eth) |
15:34:51 | FromDiscord | <michaelb.eth> found it, was looking it over |
15:35:07 | FromDiscord | <Marcus> it uses choosenim on all platform afaict |
15:35:59 | FromDiscord | <michaelb.eth> I still use a hand-rolled choosenim setup in GHA so wasn’t aware of that action but looks promising |
15:36:26 | FromDiscord | <michaelb.eth> What version/a of Nim are you specifying? |
15:36:41 | FromDiscord | <michaelb.eth> (edit) "version/a" => "version/s" |
15:37:18 | FromDiscord | <Marcus> https://github.com/marcusramberg/promexplorer/actions/runs/4588428969/jobs/8102634046↵(@michaelb.eth) |
15:37:21 | FromDiscord | <Marcus> I really can't tell why it's so slow, seems like it just downloads it. |
15:37:28 | FromDiscord | <Marcus> Maybe it's a problem with github mac ci |
15:39:27 | FromDiscord | <michaelb.eth> By analogy, in my setup I spec version-1-2, version-1-6, version-2-0 (those are branch names), so the compiler and tools are built from scratch for Linux, Mac, and Windows. To speed up the builds I use caching. The 4-5 minute time seems to match my experience when I have a cache miss. |
15:44:49 | FromDiscord | <michaelb.eth> In reply to @Marcus "https://github.com/marcusramberg/promexplorer/actio": Yep, looking at the output for the setup step, on macOS it’s building from sources whereas for Linux and Windows it’s not. |
15:46:02 | FromDiscord | <Marcus> I actually saw now that I have cache in place to solve this in my test runner build job that runs in every commit 🤦♂️ Was wondering why it didn't have the same problem. |
15:51:28 | * | beholders_eye quit (Quit: WeeChat 3.6) |
15:53:01 | FromDiscord | <HitBlast> Is there a way to put pragmas in an object much like how we can put decorators inside a Python object and use them inside the object only? |
16:00:47 | * | arkurious joined #nim |
16:03:40 | * | Jjp137 quit (Ping timeout: 260 seconds) |
17:00:08 | * | Jjp137 joined #nim |
17:32:09 | FromDiscord | <miragearhitect> sent a code paste, see https://play.nim-lang.org/#ix=4sw0 |
17:32:36 | FromDiscord | <miragearhitect> cant figure it out |
17:37:43 | FromDiscord | <Hourglass [She/Her]> I'm surprised I'm actually saying this but, is there a library that kinda does what the DOM does? |
17:37:56 | FromDiscord | <Hourglass [She/Her]> For a TUI |
17:38:48 | FromDiscord | <Hourglass [She/Her]> So I'd have panels/elements on screen that are just simple containers, then I can use text elements with some basic formatting (aligning it horizontally, vertically, to the top, left... Etc) and then having IDs for them? |
17:39:05 | FromDiscord | <Hourglass [She/Her]> C or C++ is fine too, since I can just write bindings for them in Nim |
17:44:32 | FromDiscord | <guttural666> any tips on how to trouble shoot the nimlsp in vim? I recently updated my nim verison and the nimlsp through nimble and the COC nimlsp package with PlugUpdate, now the language server doesn't give me anything in my file anymore (errors, autocomplete etc.) |
17:54:49 | FromDiscord | <michaelb.eth> In reply to @guttural666 "any tips on how": have you tried nimlangserver as alternative to nimlsp? |
17:55:37 | FromDiscord | <guttural666> I always just used nimlsp by Peter and COC |
18:00:41 | FromDiscord | <Marcus> Wasn't aware that there's two different ones!↵(@michaelb.eth) |
18:01:45 | FromDiscord | <Marcus> I think only pmunch's is packaged in nix |
18:01:47 | FromDiscord | <guttural666> nimlsp comes with the full guide to integrate it into Vim, which was quite painless in the past, don't really want to spend a lot of time on vim config, let alone neovim, which I just tried and also didn't work (treesitter also has no nim support, which sucks) |
18:02:30 | FromDiscord | <guttural666> thinking about just nuking the whole system and starting with a clean slate from scratch right now |
18:02:42 | FromDiscord | <michaelb.eth> sent a long message, see http://ix.io/4sw7 |
18:03:40 | FromDiscord | <michaelb.eth> if you're unaware of Notcurses, make sure to take a look at its repo, demo videos, etc. – it makes possible some pretty amazing stuff for TUIs and CLIs |
18:03:55 | FromDiscord | <Hourglass [She/Her]> Thanks! I'll take a look! |
18:12:39 | FromDiscord | <Marcus> guttural6\: You can use `{ "alaviss/nim.nvim" }` to get syntax highlighting in nvim. |
18:13:49 | FromDiscord | <Marcus> I just used illwill for promexplorer and I found it quite easy to work with. it doesn't work the way Horizon describes (like the DOM) tho.↵(@michaelb.eth) |
18:16:36 | FromDiscord | <michaelb.eth> sure, working like the DOM is a pretty tall order |
18:16:52 | FromDiscord | <michaelb.eth> so my suggestions were more general, for sure |
18:17:32 | FromDiscord | <michaelb.eth> for Go, there's the charms thing, looks pretty cool, allows styling by CSS, crazy stuff |
18:17:57 | FromDiscord | <Marcus> agree, charms is pretty shiny \:) |
18:18:35 | FromDiscord | <Marcus> https://github.com/marcusramberg/promexplorer/blob/main/promexplorer.gif?raw=true I found making a ui like this with panels and navigation fairly easy tho. |
18:18:37 | FromDiscord | <michaelb.eth> (edit) "by CSS," => "with CSS-like," |
18:19:32 | FromDiscord | <michaelb.eth> once I'm a bit farther along with nim-notcurses, I'm going to try to re-impl some illwill based TUIs with it, just to see how it goes |
18:20:07 | FromDiscord | <Marcus> I've only seen the notcurses demos, they are pretty cool tho \:) |
18:20:16 | FromDiscord | <michaelb.eth> one of my goals is for the high-level wrapper to be powerful yet easy to work with |
18:21:40 | FromDiscord | <guttural666> In reply to @Marcus "guttural6\: You can use": okay thanks, maybe I will come back to nvim one day, sticking to vim for now I think |
18:22:03 | FromDiscord | <Marcus> Lazyvim \<3 |
18:23:31 | FromDiscord | <guttural666> In reply to @Marcus "Lazyvim \<3": is that a thing? sticking to vim because I'm too lazy to learn lua? haha |
18:23:56 | FromDiscord | <Marcus> no I meant the neovim distribution \:D https://www.lazyvim.org/ |
18:24:33 | FromDiscord | <Marcus> Writing vimscript instead of lua isn't lazy, that's masochist. |
18:25:52 | FromDiscord | <guttural666> I just tried it with the kickstart.nvim https://github.com/nvim-lua/kickstart.nvim |
18:26:21 | FromDiscord | <Marcus> I see he links to lazyvim as well \:) |
18:26:58 | FromDiscord | <guttural666> installing nimlsp with Mason worked great, but still no lsp support active and I am just too lazy to get into their lua file and figure things out for the moment 😄 |
18:28:00 | FromDiscord | <guttural666> one click solutions first, then I can get into the details at my own pace, but if something like this doesn't work first try, I hate that |
18:28:03 | FromDiscord | <Hourglass [She/Her]> Now I'm continuing to try and work on my MC server software... |
18:28:29 | FromDiscord | <Marcus> Sure - https://github.com/marcusramberg/nix-config/blob/main/config/nvim/lua/plugins/languages.lua#L38 |
18:28:36 | FromDiscord | <Marcus> this is how I activated it |
18:28:44 | FromDiscord | <Marcus> for if you decided to go back later \:) |
18:29:54 | FromDiscord | <guttural666> thanks mate |
18:30:44 | FromDiscord | <Marcus> image.png https://media.discordapp.net/attachments/371759389889003532/1092154163967836220/image.png |
18:36:45 | FromDiscord | <Hourglass [She/Her]> I have no idea why my code is segfaulting and gdb is absolutely useless here |
18:36:48 | FromDiscord | <Hourglass [She/Her]> Very fun |
18:42:47 | * | deadmarshal_ quit (Ping timeout: 246 seconds) |
18:45:51 | FromDiscord | <guttural666> In reply to @Marcus "image.png": this is what I want to see 😄 |
18:46:33 | * | kenran joined #nim |
18:47:26 | FromDiscord | <guttural666> god, Vim and Neovim are just so good |
18:53:15 | FromDiscord | <michaelb.eth> fwiw, Emacs and nimlangserver work very nicely together (via `lsp-mode` for Emacs), but I know most people are hesitant to embrace the strange side of The Force |
18:53:32 | FromDiscord | <michaelb.eth> (edit) "embrace" => "embracing" |
18:53:57 | FromDiscord | <Hourglass [She/Her]> Okay i genuinely can't tell why or where I'm segfaulting, it's so odd and confusing... |
18:54:56 | FromDiscord | <Hourglass [She/Her]> All my echo statements run, and it consistently segfaults after the second time i close the socket, but code after closing the socket still runs |
18:56:10 | * | casaca joined #nim |
19:00:10 | FromDiscord | <michaelb.eth> In reply to @Hourglass, When the Hour Strikes "All my echo statements": do you have some code to share or a simplified example that reproduces the problem? |
19:02:59 | FromDiscord | <Hourglass [She/Her]> I can't make a simplified example but I can give my current code, it's spread across a few repos though... 😓 |
19:03:17 | FromDiscord | <Hourglass [She/Her]> I could probably make a small zip with the code but doubt anyone would actually be interested |
19:03:50 | FromDiscord | <michaelb.eth> so, let's come at it a different way |
19:03:59 | FromDiscord | <michaelb.eth> are you worrking with async? |
19:04:15 | FromDiscord | <michaelb.eth> and how about threads? |
19:04:19 | FromDiscord | <Hourglass [She/Her]> Yep, async as well as shared libraries with the orc gc |
19:04:29 | FromDiscord | <Hourglass [She/Her]> Async across shared libraries, in fact aha |
19:05:09 | FromDiscord | <Hourglass [She/Her]> Doesn't explain why it suddenly segfaults since it doesn't seem to have an obvious relation to the shared library |
19:05:24 | FromDiscord | <Hourglass [She/Her]> Unless it's the dispatcher that segfaults for some reason? |
19:06:09 | FromDiscord | <Hourglass [She/Her]> Since, with async and shared libraries, you have to set the dispatcher across the boundary (so the shared library is sharing a dispatcher with the core app) |
19:06:16 | * | deadmarshal joined #nim |
19:07:05 | FromDiscord | <michaelb.eth> by shared libs in this context you mean some Nim codebases that have been compiled to shared libs (`.so`, `.dylib`, `.dll`)? |
19:07:26 | FromDiscord | <Hourglass [She/Her]> Yep |
19:08:09 | FromDiscord | <michaelb.eth> are you sure everything is using orc, i.e. is it possible that one of them might be using refc? |
19:08:23 | FromDiscord | <michaelb.eth> weird question, maybe, but I'm trying to think what's going wrong |
19:08:26 | FromDiscord | <Hourglass [She/Her]> No, that's not possible, every single one is definitely using orc |
19:08:44 | FromDiscord | <Hourglass [She/Her]> In reply to @michaelb.eth "weird question, maybe, but": Yeah I understand, I've been sitting on this for weeks now so I'm taking any help i can get |
19:08:50 | FromDiscord | <turbo> What's the current best way to deep compare objects (something like lodash's `Equals`). In my case objects may contain sequences of variant types, other objects and options, but no cycles, procs or other non-scalar things. |
19:14:47 | FromDiscord | <Hourglass [She/Her]> The only thing I can get from gdb is `0x(2 byte hex) in unregisterCyclesystem_2921` |
19:19:49 | FromDiscord | <miragearhitect> sent a code paste, see https://play.nim-lang.org/#ix=4sws |
19:23:31 | FromDiscord | <Hourglass [She/Her]> I am so lost... |
19:25:33 | FromDiscord | <michaelb.eth> In reply to @miragearhitect ".": what is the output of `echo format("hello")`? |
19:27:13 | FromDiscord | <michaelb.eth> In reply to @Hourglass, When the Hour Strikes "I am so lost...": I don't think I can be of much more help atm, but consider creating small modules/libs that have the same relationships as the ones in your codebase; try to add the minimal code to them necessary recreate the crash, e.g. you mentioned a socket and closing it is involved |
19:27:22 | FromDiscord | <michaelb.eth> you could be hitting a bug in ORC, who knows |
19:29:44 | * | ltriant joined #nim |
19:30:02 | FromDiscord | <Hourglass [She/Her]> In reply to @michaelb.eth "I don't think I": I can try but I don't know if I'll be able to encounter it again, since the codebase is fairly complex |
19:30:14 | FromDiscord | <miragearhitect> In reply to @michaelb.eth "what is the output": <strong>hello</strong> |
19:30:19 | FromDiscord | <Hourglass [She/Her]> I could try the arc GC instead and see if that fixes it |
19:30:35 | FromDiscord | <michaelb.eth> In reply to @Hourglass, When the Hour Strikes "I *could* try the": worth a shot, for sure |
19:31:09 | FromDiscord | <michaelb.eth> if it doesn't crash, that would suggest something going wrong with orc, hopefully you'll be able to turn the experience into a bug report 🙂 |
19:31:17 | FromDiscord | <michaelb.eth> (edit) "if it doesn't crash, that would suggest something going wrong with orc, ... hopefullyyou'd" added "and" | "you'll" => "you'd" |
19:31:24 | FromDiscord | <Hourglass [She/Her]> Ah, it's not reproducible with arc at all |
19:31:26 | FromDiscord | <Hourglass [She/Her]> Hm... |
19:32:47 | FromDiscord | <michaelb.eth> In reply to @miragearhitect "<strong>hello</strong>": any chance there's trailing whitespace? maybe try strip? |
19:34:26 | * | ltriant quit (Ping timeout: 250 seconds) |
19:36:25 | * | sagax joined #nim |
19:37:14 | FromDiscord | <Hourglass [She/Her]> In reply to @michaelb.eth "if it doesn't crash,": It'll be quite hard without a minimal reproducible example aha... Not sure how to recreate that |
19:38:01 | FromDiscord | <Hourglass [She/Her]> Anyway, anyone know if arc plays nicely with async? Iirc i saw some posts about arc eventually crashing from memory use because of async |
19:39:03 | FromDiscord | <michaelb.eth> no, because async (and nim-chronos too) involves cyclical references |
19:39:17 | FromDiscord | <michaelb.eth> so you'll eventually leak memory with arc |
19:39:36 | FromDiscord | <michaelb.eth> (edit) "no, because ... async" added "std" |
19:39:45 | FromDiscord | <Elegantbeef> chronos isnt supposed to have cycles |
19:39:48 | FromDiscord | <Elegantbeef> That's one of the things that it touts |
19:39:58 | FromDiscord | <michaelb.eth> oh, I thought I'd read the opposite |
19:40:03 | FromDiscord | <michaelb.eth> will revisit the readme, etc. |
19:40:36 | FromDiscord | <tsoj> sent a code paste, see https://play.nim-lang.org/#ix=4swE |
19:45:18 | FromDiscord | <michaelb.eth> In reply to @michaelb.eth "will revisit the readme,": looking at some closed PRs/issues, yeah, maybe it will work with arc now, but I'm not 100% certain |
19:46:19 | * | junaid_ joined #nim |
19:48:34 | PMunch | @guttural666, yeah there are some issues with NimLSP on recent versions |
20:23:16 | FromDiscord | <Marcus> I used doom emacs for a couple of years but I couldn't deal with the slow. neovim is so snappy in comparison↵(@michaelb.eth) |
20:27:11 | * | sagax quit (Remote host closed the connection) |
20:28:35 | FromDiscord | <Hourglass [She/Her]> In reply to @michaelb.eth "so you'll eventually leak": Ah |
20:30:49 | FromDiscord | <wiga> anyone knows how to use the RSA_public_encrypt and RSA\_private\_decrypt functions from openssl ? |
20:31:33 | * | kenran quit (Remote host closed the connection) |
20:33:04 | FromDiscord | <dlesnoff> In reply to @wiga "anyone knows how to": Maybe ask in #security ? |
20:33:20 | FromDiscord | <wiga> maybe |
20:33:45 | PMunch | The people who've made languageserver basically introduced some breaking changes (and outright bugs) to nimsuggest which doesn't show up in their project but which breaks NimLSP.. |
20:33:55 | PMunch | @wiga, define "how to use" |
20:34:21 | FromDiscord | <wiga> an example |
20:34:31 | FromDiscord | <wiga> like, how to encrypt and decrypt a string |
20:35:16 | PMunch | Ah, for that I'd look at C examples, they should be 1:1 portable |
20:35:24 | FromDiscord | <guttural666> In reply to @PMunch "<@375727321958580228>, yeah there are": any way to fix them on your side or what can I do in Vim? |
20:35:51 | PMunch | Anyone know if there is some pragma or something you can put around a call to make asserts throw a catchable error? |
20:36:08 | FromDiscord | <wiga> In reply to @PMunch "Ah, for that I'd": I do not C |
20:36:08 | PMunch | @guttural666, yeah they basically have to be fixed in NimLSP/nimsuggest |
20:36:25 | PMunch | I've looked into it but I haven't had time to fix them properly. Nimsuggest is a hairy beast |
20:36:49 | PMunch | @wiga, well there's always time to learn |
20:37:04 | FromDiscord | <wiga> I don't have much time thats the problem |
20:37:11 | PMunch | What are you encrypting/decrypting? |
20:37:13 | FromDiscord | <guttural666> In reply to @PMunch "<@375727321958580228>, yeah they basically": damn, that sucks, basically flying blind rn in vim, is that something you can tackle in nimlsp or is that strictly on nimsuggest? |
20:37:20 | FromDiscord | <wiga> In reply to @PMunch "What are you encrypting/decrypting?": json |
20:37:23 | FromDiscord | <wiga> strings |
20:37:29 | FromDiscord | <wiga> for server communications |
20:37:52 | PMunch | In general crypto is something which is tricky to get right, so unless you have time to learn it properly then it might not be worth it at all |
20:38:00 | FromDiscord | <wiga> or maybe if there's other asymetric encryption algorithm |
20:38:01 | PMunch | False sense of security and all that |
20:38:30 | PMunch | I've used RSA public/private crypto in Nim before with OpenSSL, so it's certainly possible |
20:38:42 | PMunch | I remember it being quite simple even |
20:38:47 | FromDiscord | <wiga> can u give me an example? |
20:39:47 | PMunch | @guttural666, I believe it should be possible to fix in NimLSP |
20:40:38 | FromDiscord | <guttural666> In reply to @PMunch "<@375727321958580228>, I believe it": you must encounter these probs as well, I'v seen you use vim on YT |
20:40:49 | PMunch | At least if you use a version where this fix is present: https://github.com/nim-lang/Nim/pull/21555 |
20:41:11 | PMunch | Yeah I use Vim, but I've also used Nim long enough that I don't really notice when NimLSP stops working.. |
20:41:34 | FromDiscord | <guttural666> In reply to @PMunch "Yeah I use Vim,": yeah 😄 |
20:41:34 | PMunch | I do have some error messages and stuff in my Vim at the moment, not 100% sure where they come from though |
20:42:25 | PMunch | @wiga, I'm doing something else at the moment, but it's pretty much a copy/paste of the C solutions you find on Stackoverflow I'd imagine |
20:43:36 | FromDiscord | <wiga> ah |
20:43:40 | FromDiscord | <wiga> ty |
21:06:19 | FromDiscord | <corey> Hey nim friends, I am trying to upgrade to 2.0.0 rc2 |
21:07:00 | FromDiscord | <corey> I checkout version 2.0, then importantly I _pull_, and then I run `sh build_all.sh` |
21:07:18 | FromDiscord | <corey> After this completes however, if I type `nim --version` I get back `1.9.3` |
21:07:32 | FromDiscord | <corey> What am I doing wrong? Do I need to fiddle with my paths or something? |
21:12:47 | * | Notxor quit (Quit: Leaving) |
21:15:21 | FromDiscord | <Elegantbeef> That's right |
21:15:45 | FromDiscord | <Yardanico> In reply to @corey "What am I doing": unstable nim versions are always odd |
21:15:46 | FromDiscord | <Elegantbeef> Version 2.0's rc is 1.9.3 presently |
21:15:55 | FromDiscord | <Yardanico> when nim 2.x becomes stable it'll be 2.x :) |
21:16:28 | FromDiscord | <corey> So even though I'm on 2.0 rc2 it will still say 1.9.3? |
21:16:39 | PMunch | Correct |
21:16:48 | FromDiscord | <corey> Alrighty |
21:16:53 | * | PMunch quit (Quit: leaving) |
21:17:02 | FromDiscord | <corey> Thanks! |
21:28:52 | * | ltriant joined #nim |
21:33:37 | * | ltriant quit (Ping timeout: 265 seconds) |
21:40:42 | FromDiscord | <BoomBang> Do you guys know how to check if 2 `case` objects are equal? |
21:42:47 | FromDiscord | <Elegantbeef> You have to implement your own `==` operator |
21:46:15 | FromDiscord | <BoomBang> oh |
21:46:17 | FromDiscord | <BoomBang> ok |
21:47:04 | FromDiscord | <Elegantbeef> If your data type only uses stack allocated memory you could import C's equalMem or whatever it's called |
21:47:14 | FromDiscord | <Elegantbeef> You also could use one of the many macro libraries for object variants |
21:53:13 | * | TakinOver joined #nim |
22:00:50 | FromDiscord | <turbo> How can I create a json array with `%` as the root object, instead of an object? |
22:01:24 | * | junaid_ quit (Remote host closed the connection) |
22:01:28 | FromDiscord | <turbo> nvm got it |
22:18:53 | * | ltriant joined #nim |
22:34:48 | * | ltriant quit (Read error: Connection reset by peer) |
22:35:17 | * | ltriant joined #nim |
23:32:44 | FromDiscord | <sOkam!> is there any stdlib function for replacing text in a file? |
23:39:15 | * | ltriant quit (Ping timeout: 250 seconds) |
23:41:15 | * | ltriant joined #nim |
23:55:24 | FromDiscord | <auxym> strutils... |
23:55:49 | FromDiscord | <sOkam!> im searching there. but i don't know if there is any of them specifically made to replace in a file |
23:56:15 | FromDiscord | <sOkam!> im currently opening the file into a string, and writing the entire file again with a `replace` call, but it feels cheaty |
23:56:41 | FromDiscord | <auxym> read to a string, replace, write. If the file fits in memory. |
23:57:05 | FromDiscord | <auxym> if it doesn't fit in memory, you'll have to roll your own sed-like thing ig |
23:58:09 | FromDiscord | <Yardanico> In reply to @sOkam! "im currently opening the": i mean if the file is small enough, it really won't be noticeable in real-world usage :) |
23:58:18 | FromDiscord | <Yardanico> but if it's multiple MBs, then maybe you need a better solution |
23:58:44 | FromDiscord | <sOkam!> kk |