| 00:10:34 | FromDiscord | <Aceroph> i love that theres even an angry version, ill use that now↵(@nasuray) |
| 00:11:19 | * | Skippy8 quit (Ping timeout: 276 seconds) |
| 00:13:45 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
| 00:16:21 | FromDiscord | <11clock> sent a code paste, see https://play.nim-lang.org/#pasty=mEZMvULH |
| 00:21:43 | FromDiscord | <DetermiedNim1> well, its not an object oriented programming language 🤷♂️ |
| 00:21:56 | FromDiscord | <Aceroph> make a macro 😆 |
| 00:22:02 | FromDiscord | <DetermiedNim1> lol yeah |
| 00:22:20 | FromDiscord | <DetermiedNim1> also this is reminding me of one of ruby's metaprogramming features |
| 00:23:15 | FromDiscord | <Aceroph> im making a de/serialization macro for OOP, its so powerful |
| 00:26:31 | * | Lord_Nightmare joined #nim |
| 00:28:34 | FromDiscord | <11clock> In reply to @Aceroph "make a macro 😆": It is a macro I am working on. The issue is that nim doesn't let you apply the export asterisk syntax because it complains about an incomplete expressiob |
| 00:28:52 | FromDiscord | <11clock> (edit) "expressiob" => "expression" |
| 00:29:31 | FromDiscord | <11clock> I did not see a way to make my macro compatible with the asterisk. |
| 00:30:17 | FromDiscord | <11clock> sent a code paste, see https://play.nim-lang.org/#pasty=tlShERps |
| 00:31:59 | FromDiscord | <11clock> It works, just don't like that it differs from nim's syntax. |
| 00:32:42 | FromDiscord | <timbuktu_guy> there are a lot of issues like that where u cant make macro syntax exactly like u want it |
| 00:32:53 | FromDiscord | <11clock> I threw in this error as a bonus at least https://media.discordapp.net/attachments/371759389889003532/1522037309732819024/image.png?ex=6a470334&is=6a45b1b4&hm=93fbac196c73b2c10a580045dfa2819ffe3e30458adf97c56281ebc718a12ee1& |
| 00:32:54 | FromDiscord | <timbuktu_guy> even untyped macros have to be parsed |
| 00:33:44 | FromDiscord | <11clock> Honestly it feels so satisfying to make my own class system after years of complaining about Java and C# lol |
| 00:34:03 | FromDiscord | <11clock> "Here is how it SHOULD work. Mwahahaha" |
| 00:36:49 | FromDiscord | <11clock> And for the most part it looks like normal nim. I made sure to avoid any parlor tricks. |
| 00:39:54 | FromDiscord | <DetermiedNim1> In reply to @11clock "I threw in this": what about smth like c++ for the access modifiers? |
| 00:40:13 | FromDiscord | <DetermiedNim1> sent a code paste, see https://play.nim-lang.org/#pasty=tQvGKcOF |
| 00:40:57 | FromDiscord | <11clock> I wanted to keep the asterisk syntax where I could, since it's already really concise and convenient. |
| 00:41:13 | FromDiscord | <11clock> Not a huge fan of keyword ceremony |
| 00:42:02 | FromDiscord | <DetermiedNim1> ig |
| 00:42:22 | FromDiscord | <DetermiedNim1> is it possible to detect whether something is marked as exported using macros |
| 00:42:27 | FromDiscord | <pevici> sent a long message, see https://pasty.ee/xtIdOGuC |
| 00:42:38 | FromDiscord | <DetermiedNim1> wth |
| 00:42:45 | FromDiscord | <DetermiedNim1> anyways... |
| 00:42:55 | FromDiscord | <11clock> In reply to @determiedmech1 "is it possible to": Yes. Otherwise that error I made wouldn't work. |
| 00:43:06 | FromDiscord | <11clock> If you try to use asterisks in an unexported class it will complain |
| 00:43:21 | FromDiscord | <DetermiedNim1> are you doing a one-class-per-file thing? |
| 00:43:47 | FromDiscord | <Aceroph> you cant?? i swear i saw something like such↵(@11clock) |
| 00:43:51 | FromDiscord | <DetermiedNim1> what if you don't want to export the class but you want other classes in the same file to be able to access public fields and members |
| 00:44:46 | FromDiscord | <11clock> In reply to @determiedmech1 "what if you don't": Unexported members are available throughout the whole file as per normal nim rules. |
| 00:45:09 | FromDiscord | <Aceroph> https://nim-by-example.github.io/macros/↵(@11clock) |
| 00:45:23 | FromDiscord | <DetermiedNim1> sent a code paste, see https://play.nim-lang.org/#pasty=fPvsixFL |
| 00:45:46 | FromDiscord | <11clock> In reply to @Aceroph "https://nim-by-example.github.io/macros/ (<@2140554": That only works because the example requires specifying inheritance. |
| 00:45:56 | FromDiscord | <DetermiedNim1> (edit) "https://play.nim-lang.org/#pasty=gTxMWtTz" => "https://play.nim-lang.org/#pasty=LSMHPblQ" |
| 00:46:07 | FromDiscord | <11clock> "class Person of RootObj:" is valid syntax |
| 00:46:21 | FromDiscord | <11clock> "class Person:" is not |
| 00:46:55 | FromDiscord | <DetermiedNim1> sent a code paste, see https://play.nim-lang.org/#pasty=fjhpjqLe |
| 00:47:05 | FromDiscord | <DetermiedNim1> how are you implementing the classes? |
| 00:47:47 | FromDiscord | <11clock> Untyped macro. |
| 00:47:59 | FromDiscord | <11clock> sent a code paste, see https://play.nim-lang.org/#pasty=RSVJucIj |
| 00:48:04 | FromDiscord | <11clock> That won't work |
| 00:48:07 | FromDiscord | <DetermiedNim1> well like |
| 00:48:16 | FromDiscord | <DetermiedNim1> what does the macro convert it to |
| 00:48:37 | FromDiscord | <11clock> It doesn't reach the macro because nim complains about a syntax error. |
| 00:49:31 | FromDiscord | <DetermiedNim1> ah yeah you're right |
| 00:49:55 | FromDiscord | <DetermiedNim1> oh wait why dont you just have pragmas for public, private, and protected |
| 00:50:01 | FromDiscord | <Aceroph> nim's simplicity allows it |
| 00:50:06 | FromDiscord | <DetermiedNim1> one of them could be default |
| 00:50:20 | FromDiscord | <DetermiedNim1> or you could do something like in ruby |
| 00:50:31 | FromDiscord | <11clock> In reply to @Aceroph "nim's simplicity allows it": Hmm? The above code snippet actually compiles for you? |
| 00:50:44 | FromDiscord | <DetermiedNim1> fields: private↵methods: public |
| 00:50:51 | FromDiscord | <DetermiedNim1> (edit) "private↵methods:" => "private by default↵methods:" | "private by default↵methods:public ... " added "by default" |
| 00:51:58 | FromDiscord | <11clock> https://media.discordapp.net/attachments/371759389889003532/1522042110738567168/image.png?ex=6a4707ad&is=6a45b62d&hm=d3fa8fe03f25a026e528e726d5ee392ca9345d0b7fc84f357bb54e9c8122c8d7& |
| 00:52:19 | FromDiscord | <11clock> Is there a way to somehow bypass this that I am unaware of? |
| 00:52:37 | FromDiscord | <11clock> Because nim just thinks I am trying to multiply Player by something and refuses to go into the macro |
| 00:52:51 | FromDiscord | <11clock> (edit) "Because nim just thinks I am trying to multiply Player by something ... and" added "undefined" |
| 00:52:52 | FromDiscord | <Aceroph> nim's simplicity allows it, and thats why i love it |
| 00:56:08 | FromDiscord | <11clock> Anyways "pubclass" I think should work alright for now. Inconsistent but still just an extra 2 characters. |
| 00:56:37 | FromDiscord | <11clock> In reply to @determiedmech1 "oh wait why dont": I considered this too, but uhh |
| 00:57:27 | FromDiscord | <11clock> https://media.discordapp.net/attachments/371759389889003532/1522043491188871279/668825d07482779bca0fa964e1f8a695.png?ex=6a4708f6&is=6a45b776&hm=558d86ac1e3aed2f34e057e5601e1f044b2dcf7512fa7061a60e49e32e1c6e2e& |
| 00:57:37 | FromDiscord | <11clock> Yeah invalid syntax here as well |
| 00:57:53 | FromDiscord | <11clock> But I haven't really looked into where nim allows pragmas yet |
| 00:57:53 | FromDiscord | <DetermiedNim1> weird |
| 00:58:11 | FromDiscord | <DetermiedNim1> What about before a field or methid |
| 00:58:15 | FromDiscord | <DetermiedNim1> (edit) "methid" => "method" |
| 00:59:07 | FromDiscord | <11clock> Doesn't work anywhere in the class header. I know that it works on method signatures though |
| 01:01:35 | FromDiscord | <DetermiedNim1> sent a code paste, see https://play.nim-lang.org/#pasty=WYTGIRTX |
| 01:03:03 | FromDiscord | <11clock> It almost works |
| 01:03:06 | FromDiscord | <11clock> https://media.discordapp.net/attachments/371759389889003532/1522044915243024455/6d78ce1c46c0e2f344b3140b8efa1841.png?ex=6a470a4a&is=6a45b8ca&hm=dc1ddb275f754f2a040f09140b51c6f4282054eecb3e29fd5879640df7c71edf& |
| 01:03:32 | FromDiscord | <11clock> But ehh, at that point I'd rather just use "pubclass" |
| 01:04:07 | FromDiscord | <Aceroph> yes, this example does, but then doesnt use it https://nim-by-example.github.io/macros/↵(@DetermiedNim1) |
| 01:04:50 | FromDiscord | <Aceroph> it checks if the nnkIdent \ is present |
| 01:05:38 | FromDiscord | <11clock> I explained why the example works earlier. |
| 01:06:03 | FromDiscord | <11clock> Because it enforces specifying the inheritance, which makes the header valid syntax |
| 01:06:11 | FromDiscord | <11clock> Because "" has a target |
| 01:06:53 | FromDiscord | <DetermiedNim1> In reply to @11clock "But ehh, at that": Imo id rather have more reusability through the pragma but its your pro}ect 🤷♂️ |
| 01:09:04 | FromDiscord | <11clock> It depends on if I run into this problem elsewhere. |
| 01:09:11 | FromDiscord | <11clock> I do know that this works: |
| 01:09:33 | FromDiscord | <11clock> https://media.discordapp.net/attachments/371759389889003532/1522046538770153562/d4af9b6dfbd881c40543fa640f2807c7.png?ex=6a470bcd&is=6a45ba4d&hm=6d001d2aaa461cef7cf0b7ea674b7c6dcfa187723f2e7bc50c20a87ce047d1ae& |
| 01:10:25 | FromDiscord | <11clock> Oh yeah another neat thing about my class macro is that it handles ordering |
| 01:10:41 | FromDiscord | <11clock> It actually generates proc signatures before the actual procs 😄 |
| 01:11:08 | FromDiscord | <11clock> So you don't have to worry about ordering anything in a class definition |
| 01:11:31 | FromDiscord | <11clock> And I have a "context" macro that expands this to multiple classes, for bidirectional dependencies. |
| 01:13:30 | FromDiscord | <Aceroph> have you tried to replicate what dumpTree tells you?↵(@11clock) |
| 01:13:34 | FromDiscord | <Aceroph> did u check the logs? |
| 01:13:46 | FromDiscord | <unclechu> sent a code paste, see https://play.nim-lang.org/#pasty=nHZahBKc |
| 01:15:04 | FromDiscord | <unclechu> Yes, there is this\:↵> ... SIGSEGV\: Illegal storage access. (Attempt to read from nil?)\\n' |
| 01:15:11 | FromDiscord | <11clock> In reply to @Aceroph "have you tried to": It doesn't tell me anything because it doesn't compile |
| 01:16:55 | FromDiscord | <11clock> It's a compiler error that says that it expects an expression after the asterisk |
| 01:30:39 | FromDiscord | <unclechu> sent a code paste, see https://play.nim-lang.org/#pasty=NnVUPDeG |
| 01:31:09 | FromDiscord | <11clock> This is how my oop module does getters/setters https://media.discordapp.net/attachments/371759389889003532/1522051974818697246/image.png?ex=6a4710dd&is=6a45bf5d&hm=813efdfd5dcf378bd95acfa265fdc6c603880868c86090e71564c58abafdf535& |
| 01:31:28 | FromDiscord | <11clock> Probably the most ergonomic I could make them while abiding by nim's syntax |
| 01:31:38 | FromDiscord | <11clock> (edit) "Probably the most ergonomic I could make them while abiding by nim's syntax ... " added "and not doing weird hacks." |
| 01:33:57 | FromDiscord | <DetermiedNim1> is it returning field |
| 01:34:02 | FromDiscord | <11clock> yep |
| 01:34:12 | FromDiscord | <DetermiedNim1> you can't use name? |
| 01:34:30 | FromDiscord | <11clock> That would cause recursion |
| 01:34:34 | FromDiscord | <DetermiedNim1> ah |
| 01:34:38 | FromDiscord | <11clock> (edit) "That would cause ... recursion" added "infinite" |
| 01:50:49 | * | termer quit (Remote host closed the connection) |
| 01:53:37 | * | termer joined #nim |
| 02:02:27 | * | Vyrnexis5 joined #nim |
| 02:04:25 | * | Vyrnexis quit (Ping timeout: 248 seconds) |
| 02:04:26 | * | Vyrnexis5 is now known as Vyrnexis |
| 02:06:40 | * | alexdaguy joined #nim |
| 02:25:03 | FromDiscord | <11clock> Added a subtle new feature. Wonder if you can notice it. It was stupid simple but I missed it from Ruby and Yuescript. https://media.discordapp.net/attachments/371759389889003532/1522065534437425213/image.png?ex=6a471d7e&is=6a45cbfe&hm=f10b8d46da8b7e086997d6cd90a9a4d5fd238a90a1d57c7824950ad845da3363& |
| 02:25:25 | FromDiscord | <11clock> It's a small shortcut for something 😄 |
| 02:26:40 | FromDiscord | <11clock> ok I know that nim had a pragma for this, but I wanted it to be slightly more explicit. |
| 02:26:49 | FromDiscord | <11clock> (edit) "had" => "has" |
| 02:29:44 | FromDiscord | <DetermiedNim1> hmm |
| 02:29:51 | FromDiscord | <DetermiedNim1> i |
| 02:29:56 | FromDiscord | <DetermiedNim1> have no idea 😭 |
| 02:33:26 | FromDiscord | <DetermiedNim1> hmm |
| 02:35:40 | FromDiscord | <DetermiedNim1> is there any way to model a tuple of multiple different types using generics |
| 02:36:18 | FromDiscord | <DetermiedNim1> ideally i want to be able to sa↵seq[ListOfPossibleTypes] |
| 02:36:22 | FromDiscord | <DetermiedNim1> (edit) "sa↵seq[ListOfPossibleTypes]" => "say↵seq[ListOfPossibleTypes]" |
| 02:36:25 | FromDiscord | <DetermiedNim1> i just had an idea |
| 02:38:14 | FromDiscord | <DetermiedNim1> where you could model fields and procs as smth like↵↵(MemberType, AccessType, MemberValue) |
| 02:38:45 | FromDiscord | <DetermiedNim1> but i dont think it would work in nim's type system |
| 02:41:47 | FromDiscord | <Aceroph> sent a code paste, see https://play.nim-lang.org/#pasty=sOAEpgyN |
| 02:42:32 | FromDiscord | <11clock> In reply to @determiedmech1 "have no idea 😭": It's the tilde. It's a tiny macro that replaces it with `self.` |
| 02:42:53 | FromDiscord | <DetermiedNim1> ohhh nice |
| 02:43:17 | FromDiscord | <DetermiedNim1> whoa cachy-update also manages flatpaks |
| 02:43:33 | FromDiscord | <11clock> sent a code paste, see https://play.nim-lang.org/#pasty=DsBbbDnY |
| 02:44:05 | FromDiscord | <DetermiedNim1> do you have a github or smth for the oop stuff? |
| 02:44:19 | FromDiscord | <11clock> not yet, may share it. |
| 02:44:28 | FromDiscord | <DetermiedNim1> 🙏 |
| 02:44:36 | FromDiscord | <11clock> I am am super happy with it, so it may prove useful for others |
| 02:44:43 | FromDiscord | <11clock> (edit) removed "am" |
| 02:45:00 | FromDiscord | <11clock> Sure a couple of slight annoyances but it's overall pretty much what I want out of class syntax. |
| 02:45:19 | FromDiscord | <Aceroph> the tilde? |
| 02:45:49 | FromDiscord | <11clock> The oop stuff I have made so far. It's only missing two more important features |
| 02:46:01 | FromDiscord | <11clock> Value objects and inheritance. |
| 02:46:09 | FromDiscord | <11clock> Then it should have pretty much everything |
| 02:46:25 | FromDiscord | <11clock> Then I can add stuff later like auto constructors and whatnot |
| 02:46:53 | FromDiscord | <11clock> Honestly I should make auto constructor higher priority because built in types already do that so it seems like a regression lol |
| 03:00:36 | * | Vyrnexis9 joined #nim |
| 03:02:23 | * | Vyrnexis quit (Ping timeout: 265 seconds) |
| 03:02:24 | * | Vyrnexis9 is now known as Vyrnexis |
| 03:12:52 | FromDiscord | <Aceroph> example?↵(@DetermiedNim1) |
| 03:18:05 | FromDiscord | <DetermiedNim1> sent a code paste, see https://play.nim-lang.org/#pasty=IWhYcRmR |
| 03:18:13 | FromDiscord | <DetermiedNim1> (edit) "https://play.nim-lang.org/#pasty=aRcxcZnU" => "https://play.nim-lang.org/#pasty=fIMiARao" |
| 03:19:20 | FromDiscord | <DetermiedNim1> then there would be procs or macros (wtv necessary) for adding fields and methods to a class, as well as accessing them (in the implementatiom, hidden by some user-facing macro) |
| 03:19:38 | FromDiscord | <DetermiedNim1> basically just a big LUT of stuff |
| 03:20:09 | FromDiscord | <DetermiedNim1> i guess it might not be the most optimal idea |
| 03:23:39 | FromDiscord | <Aceroph> not rlly 😅 |
| 03:23:40 | FromDiscord | <Aceroph> why store it in a data structure |
| 03:23:44 | FromDiscord | <Aceroph> the fields/methods |
| 03:23:53 | FromDiscord | <DetermiedNim1> first thing i thought of 🤷♂️ |
| 03:24:40 | FromDiscord | <DetermiedNim1> like i said, i have zero doubt in my mind theres a better way to be doing this, but i don't quite have the macro knowledge to do some of the more complex macro stuff |
| 03:27:50 | FromDiscord | <Aceroph> i forgot, what are we trying to accomplish here? |
| 03:30:34 | FromDiscord | <DetermiedNim1> classes in nim |
| 03:31:39 | * | rockcavera quit (Remote host closed the connection) |
| 03:37:49 | FromDiscord | <Aceroph> can probably achieve c++ style classes pretty easily, and maybe even c# getter/setters |
| 03:39:41 | FromDiscord | <11clock> It's still crazy to me how much nim feels like a scripting language despite not being one. |
| 03:45:01 | FromDiscord | <DetermiedNim1> real |
| 03:45:29 | FromDiscord | <DetermiedNim1> I think a lot of it is the general lack of the kind of boilerplate you see in other system/compiled languages |
| 03:45:52 | FromDiscord | <DetermiedNim1> also the python-y style kind of exudes a sense of scripting lang |
| 03:59:28 | * | zero`_ joined #nim |
| 04:02:43 | * | zero` quit (Ping timeout: 276 seconds) |
| 04:05:03 | * | zero` joined #nim |
| 04:09:02 | * | zero`_ quit (Ping timeout: 271 seconds) |
| 04:40:18 | * | Vyrnexis quit (Quit: Ping timeout (120 seconds)) |
| 04:40:39 | * | Vyrnexis joined #nim |
| 04:40:48 | * | redj joined #nim |
| 04:50:59 | FromDiscord | <11clock> While I am making a macro for OOP, I don't think I will be needing much other macros. The language looks ergonomic enough already. |
| 04:51:13 | FromDiscord | <11clock> (edit) "much" => "many" |
| 04:51:30 | FromDiscord | <11clock> Maybe some small stuff here and there. |
| 04:52:01 | FromDiscord | <zumi.dxy> insert something about "no braces" |
| 05:00:36 | * | xet7 joined #nim |
| 05:20:35 | * | Skippy8 joined #nim |
| 05:45:49 | FromDiscord | <unclechu> I need a simple subprocess scenario. Open stdin and stdout streams, write to stdin and read from stdout, but forward stderr to the main process. Can I do this with `std/osproc.startProcess`? |
| 06:45:24 | * | Skippy8 quit (Ping timeout: 243 seconds) |
| 07:49:19 | * | mal`` quit (Ping timeout: 272 seconds) |
| 07:55:30 | * | mal`` joined #nim |
| 08:08:36 | * | Vyrnexis quit (Quit: The Lounge - https://thelounge.chat) |
| 09:38:11 | * | beholders_eye joined #nim |
| 09:54:48 | * | computerquip quit (Ping timeout: 252 seconds) |
| 09:57:52 | * | computerquip joined #nim |
| 12:29:18 | FromDiscord | <nervecenter> In reply to @Aceroph "can probably achieve c++": Explore functional land a bit and the need for classes will fade away. Try building some stuff in Clojure, then come back and apply those lessons to Nim. |
| 12:30:07 | FromDiscord | <nervecenter> Again, you can easily emulate classes by just having ref/var objects and procs/funcs that take them as first parameter and statefully modify them. |
| 12:30:21 | FromDiscord | <nervecenter> (edit) "Again, you can easily emulate classes by just having ref/var objects and procs/funcs that take them as first parameter ... and" added "for UFCS dot syntax" |
| 12:48:16 | FromDiscord | <Aceroph> yeah no im not making classes, objects and procs are fine, thats one of the few things i loved about rust, the traits↵(@nervecenter) |
| 12:53:09 | FromDiscord | <nervecenter> I forget who it is who's trying 🤷♂️ |
| 13:35:26 | FromDiscord | <11clock> I am trying to learn about concepts, but there doesn't appear to be much documentation on them, and they are listed as an experimental feature. |
| 13:38:31 | FromDiscord | <planetis_m> In reply to @11clock "I am trying to": This is the concept redesign https://github.com/nim-lang/RFCs/issues/168 the rest is legacy: https://nim-lang.org/docs/manual_experimental.html#concepts |
| 13:41:53 | FromDiscord | <11clock> Hmm, I'd rather not use an experimental feature, but eventually I may need to find an alternative to interfaces. |
| 13:43:20 | FromDiscord | <planetis_m> Concept is not an alternative to interface. Its type-checked generics. |
| 13:44:16 | FromDiscord | <11clock> Well, not the same thing, but they seem to be able to solve similar problems. |
| 13:47:26 | FromDiscord | <11clock> Like, say you have Player with a takeDamage proc and a Rock with a takeDamage proc. For all objects in a collection you want to call takeDamage for all objects that have a takeDamage proc, or well in nim's case a proc called takeDamage that accepts an object as a parameter. |
| 13:47:57 | FromDiscord | <11clock> (edit) removed "all objects in" | "a collection ... you" added "of objects" |
| 13:49:35 | FromDiscord | <planetis_m> In reply to @11clock "Like, say you have": Sorry that's not a case you can apply concepts to. Its a common misconception, but you cant have a var objs: seq[TakesDamage] = @[] with Player and Rock objects |
| 13:50:12 | FromDiscord | <11clock> I see. |
| 13:50:34 | FromDiscord | <11clock> I wonder if it's even possible to do something like that in nim |
| 13:51:19 | FromDiscord | <planetis_m> It is either with object variants or object hierarchies. |
| 13:52:03 | FromDiscord | <planetis_m> You have methods as well dont forget, you dont have to use proc |
| 13:58:57 | * | Skippy8 joined #nim |
| 14:05:19 | * | Skippy8 quit (Ping timeout: 245 seconds) |
| 14:10:38 | FromDiscord | <_timurski> In reply to @11clock "I wonder if it's": you can also always just implement your own runtime inheritance |
| 14:29:01 | * | alexdaguy quit (Quit: w) |
| 14:31:04 | FromDiscord | <11clock> Hierarchies can be rigid due to single inheritance only. I was contemplating the idea of mixins but I don't think that you can teach Nim to use mixins in its genetic collections. |
| 14:32:06 | FromDiscord | <11clock> But my workflow in other languages didn't use inheritance much anyways so I'll probably be fine. My main concern is just avoiding cyclic dependencies. |
| 14:32:59 | FromDiscord | <11clock> My macros can largely remove ordering and cyclic concerns but they only work within a single module due to nim's restrictions. |
| 14:33:40 | FromDiscord | <11clock> I have noticed that nim supports unions so I can probably do something with that |
| 15:04:14 | FromDiscord | <planetis_m> In reply to @11clock "I have noticed that": unions are for C compatibility use object variants instead |
| 15:04:39 | FromDiscord | <planetis_m> well for mixins something that works is a simple ECS like mine: https://github.com/planetis-m/pirata |
| 15:05:01 | FromDiscord | <11clock> Ultimately though I don't want to do something hacky. So far my OOP macros are merely shortcuts for stuff nim already supports, and don't try to bend the rules. |
| 15:05:27 | FromDiscord | <11clock> In reply to @planetis_m "well for mixins something": Yes I was considering this kind of style. |
| 15:06:05 | FromDiscord | <11clock> The Ruby version of my game engine introduced components, although largely as a means to mitigate risks of inheritance collisions. |
| 15:07:53 | FromDiscord | <planetis_m> honestly I would just use methods, but something like that is a common pattern: https://github.com/planetis-m/protocoled#the-protocol-macro |
| 15:09:00 | FromDiscord | <planetis_m> but yeah single inheritance is a limitation with designing game engines. |
| 15:09:07 | FromDiscord | <planetis_m> (edit) "with " => "when" |
| 15:10:26 | FromDiscord | <11clock> My game engine was made in C#, so trying to figure out how to adapt it to other languages has been an interesting challenge. |
| 15:11:28 | FromDiscord | <11clock> Ruby was very close. Super ergonomic language and I almost kept it, but I ran into technical issues with the backend I was using, and I disliked how much I was being concerned with performance. |
| 15:15:20 | FromDiscord | <planetis_m> I can see how that lineage could make the Nim port harder. |
| 15:17:05 | FromDiscord | <planetis_m> clearly for MI this is more fitting: https://github.com/andreaferretti/interfaced since it introduces indirection of the proc tables and you have toInterface procs |
| 15:18:47 | * | Skippy8 joined #nim |
| 15:52:59 | FromDiscord | <planetis_m> In reply to @11clock "Ruby was very close.": This could work just fine: https://gist.github.com/planetis-m/449bc45ea8befa1f64c668ee358aacc5 |
| 16:01:51 | FromDiscord | <gesee37> In reply to @11clock "Ruby was very close.": If you need interface use the magical combo 🙂 |
| 16:02:00 | FromDiscord | <gesee37> MD + concepts |
| 16:02:09 | FromDiscord | <gesee37> Multiple dispatch + concepts |
| 16:02:24 | * | beholders_eye quit (Ping timeout: 246 seconds) |
| 16:02:25 | FromDiscord | <gesee37> Fair and square 😄 |
| 16:04:23 | * | beholders_eye joined #nim |
| 16:05:06 | FromDiscord | <gesee37> sent a code paste, see https://play.nim-lang.org/#pasty=kYXHhccp |
| 16:06:05 | FromDiscord | <gesee37> It doens't introduce any performances cost and is kinda easy to extend |
| 16:06:18 | FromDiscord | <gesee37> (edit) "It doens't introduce any ... performances" added "runtime" |
| 16:06:48 | FromDiscord | <gesee37> (edit) "https://play.nim-lang.org/#pasty=CeUREuME" => "https://play.nim-lang.org/#pasty=UlaTEvBe" |
| 16:11:21 | FromDiscord | <11clock> Hmm, still can't use it in collections though I assume? |
| 16:11:34 | FromDiscord | <11clock> seq[MyInterface] |
| 16:12:51 | FromDiscord | <11clock> (edit) "Hmm, still can't use it in collections ... though" added "and as a type in parameters and variables" |
| 16:22:11 | FromDiscord | <gesee37> In reply to @11clock "Hmm, still can't use": You can use it as constraint for parametric types in functions but not as parameter itself↵And yeah you can't use those on seq (as it would form a collection of heterogeneous types)↵So either have to use vtables if you really need things to be in the same collection |
| 16:27:21 | FromDiscord | <_timurski> remember that object variants are more performant than vtables as well |
| 16:27:41 | FromDiscord | <_timurski> and oftentimes make it easier to reason about your program |
| 16:29:18 | FromDiscord | <_timurski> oh i didn't even know about this |
| 16:29:24 | FromDiscord | <_timurski> https://nim-lang.org/docs/manual.html#methods |
| 16:30:10 | FromDiscord | <_timurski> @11clock i think this is what you're looking for? unless you've already come across this then i'm sorry i missed it in the conversation |
| 16:30:15 | FromDiscord | <_timurski> `method` allows for dynamic dispatch |
| 16:32:12 | FromDiscord | <DetermiedNim1> sent a code paste, see https://play.nim-lang.org/#pasty=XxPxStga |
| 16:32:24 | FromDiscord | <DetermiedNim1> is that `and` stuff an actual syntax thing |
| 16:32:52 | FromDiscord | <_timurski> ? |
| 16:33:09 | FromDiscord | <gesee37> In reply to @_timurski "remember that object variants": Welp they are hell to refactor especially when you have a bunch of different types |
| 16:33:11 | FromDiscord | <11clock> I am aware of methods and inheritance. Was just wondering about the fact that inheritance isn't multi inheritance (for good reason though). In other languages that give you interfaces.↵↵Ultimately though I think I just need to shift my ideology. If I am feeling that an object needs to represent multiple interfaces, types, etc., I am probably breaking single responsibility principle. |
| 16:33:27 | FromDiscord | <11clock> (edit) "that" => "they" |
| 16:33:56 | FromDiscord | <gesee37> In reply to @11clock "I am aware of": Welp just make multiple storage |
| 16:34:05 | FromDiscord | <gesee37> It could also work out |
| 16:34:44 | FromDiscord | <_timurski> sent a code paste, see https://play.nim-lang.org/#pasty=lOsSmpps |
| 16:34:49 | FromDiscord | <_timurski> this works^ |
| 16:36:02 | FromDiscord | <_timurski> In reply to @gesee37 "Welp they are hell": i'm not sure what you mean here, just dealing with the extra cases? |