<< 02-07-2026 >>

00:10:34FromDiscord<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:21FromDiscord<11clock> sent a code paste, see https://play.nim-lang.org/#pasty=mEZMvULH
00:21:43FromDiscord<DetermiedNim1> well, its not an object oriented programming language 🤷‍♂️
00:21:56FromDiscord<Aceroph> make a macro 😆
00:22:02FromDiscord<DetermiedNim1> lol yeah
00:22:20FromDiscord<DetermiedNim1> also this is reminding me of one of ruby's metaprogramming features
00:23:15FromDiscord<Aceroph> im making a de/serialization macro for OOP, its so powerful
00:26:31*Lord_Nightmare joined #nim
00:28:34FromDiscord<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:52FromDiscord<11clock> (edit) "expressiob" => "expression"
00:29:31FromDiscord<11clock> I did not see a way to make my macro compatible with the asterisk.
00:30:17FromDiscord<11clock> sent a code paste, see https://play.nim-lang.org/#pasty=tlShERps
00:31:59FromDiscord<11clock> It works, just don't like that it differs from nim's syntax.
00:32:42FromDiscord<timbuktu_guy> there are a lot of issues like that where u cant make macro syntax exactly like u want it
00:32:53FromDiscord<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:54FromDiscord<timbuktu_guy> even untyped macros have to be parsed
00:33:44FromDiscord<11clock> Honestly it feels so satisfying to make my own class system after years of complaining about Java and C# lol
00:34:03FromDiscord<11clock> "Here is how it SHOULD work. Mwahahaha"
00:36:49FromDiscord<11clock> And for the most part it looks like normal nim. I made sure to avoid any parlor tricks.
00:39:54FromDiscord<DetermiedNim1> In reply to @11clock "I threw in this": what about smth like c++ for the access modifiers?
00:40:13FromDiscord<DetermiedNim1> sent a code paste, see https://play.nim-lang.org/#pasty=tQvGKcOF
00:40:57FromDiscord<11clock> I wanted to keep the asterisk syntax where I could, since it's already really concise and convenient.
00:41:13FromDiscord<11clock> Not a huge fan of keyword ceremony
00:42:02FromDiscord<DetermiedNim1> ig
00:42:22FromDiscord<DetermiedNim1> is it possible to detect whether something is marked as exported using macros
00:42:27FromDiscord<pevici> sent a long message, see https://pasty.ee/xtIdOGuC
00:42:38FromDiscord<DetermiedNim1> wth
00:42:45FromDiscord<DetermiedNim1> anyways...
00:42:55FromDiscord<11clock> In reply to @determiedmech1 "is it possible to": Yes. Otherwise that error I made wouldn't work.
00:43:06FromDiscord<11clock> If you try to use asterisks in an unexported class it will complain
00:43:21FromDiscord<DetermiedNim1> are you doing a one-class-per-file thing?
00:43:47FromDiscord<Aceroph> you cant?? i swear i saw something like such↵(@11clock)
00:43:51FromDiscord<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:46FromDiscord<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:09FromDiscord<Aceroph> https://nim-by-example.github.io/macros/↵(@11clock)
00:45:23FromDiscord<DetermiedNim1> sent a code paste, see https://play.nim-lang.org/#pasty=fPvsixFL
00:45:46FromDiscord<11clock> In reply to @Aceroph "https://nim-by-example.github.io/macros/ (<@2140554": That only works because the example requires specifying inheritance.
00:45:56FromDiscord<DetermiedNim1> (edit) "https://play.nim-lang.org/#pasty=gTxMWtTz" => "https://play.nim-lang.org/#pasty=LSMHPblQ"
00:46:07FromDiscord<11clock> "class Person of RootObj:" is valid syntax
00:46:21FromDiscord<11clock> "class Person:" is not
00:46:55FromDiscord<DetermiedNim1> sent a code paste, see https://play.nim-lang.org/#pasty=fjhpjqLe
00:47:05FromDiscord<DetermiedNim1> how are you implementing the classes?
00:47:47FromDiscord<11clock> Untyped macro.
00:47:59FromDiscord<11clock> sent a code paste, see https://play.nim-lang.org/#pasty=RSVJucIj
00:48:04FromDiscord<11clock> That won't work
00:48:07FromDiscord<DetermiedNim1> well like
00:48:16FromDiscord<DetermiedNim1> what does the macro convert it to
00:48:37FromDiscord<11clock> It doesn't reach the macro because nim complains about a syntax error.
00:49:31FromDiscord<DetermiedNim1> ah yeah you're right
00:49:55FromDiscord<DetermiedNim1> oh wait why dont you just have pragmas for public, private, and protected
00:50:01FromDiscord<Aceroph> nim's simplicity allows it
00:50:06FromDiscord<DetermiedNim1> one of them could be default
00:50:20FromDiscord<DetermiedNim1> or you could do something like in ruby
00:50:31FromDiscord<11clock> In reply to @Aceroph "nim's simplicity allows it": Hmm? The above code snippet actually compiles for you?
00:50:44FromDiscord<DetermiedNim1> fields: private↵methods: public
00:50:51FromDiscord<DetermiedNim1> (edit) "private↵methods:" => "private by default↵methods:" | "private by default↵methods:public ... " added "by default"
00:51:58FromDiscord<11clock> https://media.discordapp.net/attachments/371759389889003532/1522042110738567168/image.png?ex=6a4707ad&is=6a45b62d&hm=d3fa8fe03f25a026e528e726d5ee392ca9345d0b7fc84f357bb54e9c8122c8d7&
00:52:19FromDiscord<11clock> Is there a way to somehow bypass this that I am unaware of?
00:52:37FromDiscord<11clock> Because nim just thinks I am trying to multiply Player by something and refuses to go into the macro
00:52:51FromDiscord<11clock> (edit) "Because nim just thinks I am trying to multiply Player by something ... and" added "undefined"
00:52:52FromDiscord<Aceroph> nim's simplicity allows it, and thats why i love it
00:56:08FromDiscord<11clock> Anyways "pubclass" I think should work alright for now. Inconsistent but still just an extra 2 characters.
00:56:37FromDiscord<11clock> In reply to @determiedmech1 "oh wait why dont": I considered this too, but uhh
00:57:27FromDiscord<11clock> https://media.discordapp.net/attachments/371759389889003532/1522043491188871279/668825d07482779bca0fa964e1f8a695.png?ex=6a4708f6&is=6a45b776&hm=558d86ac1e3aed2f34e057e5601e1f044b2dcf7512fa7061a60e49e32e1c6e2e&
00:57:37FromDiscord<11clock> Yeah invalid syntax here as well
00:57:53FromDiscord<11clock> But I haven't really looked into where nim allows pragmas yet
00:57:53FromDiscord<DetermiedNim1> weird
00:58:11FromDiscord<DetermiedNim1> What about before a field or methid
00:58:15FromDiscord<DetermiedNim1> (edit) "methid" => "method"
00:59:07FromDiscord<11clock> Doesn't work anywhere in the class header. I know that it works on method signatures though
01:01:35FromDiscord<DetermiedNim1> sent a code paste, see https://play.nim-lang.org/#pasty=WYTGIRTX
01:03:03FromDiscord<11clock> It almost works
01:03:06FromDiscord<11clock> https://media.discordapp.net/attachments/371759389889003532/1522044915243024455/6d78ce1c46c0e2f344b3140b8efa1841.png?ex=6a470a4a&is=6a45b8ca&hm=dc1ddb275f754f2a040f09140b51c6f4282054eecb3e29fd5879640df7c71edf&
01:03:32FromDiscord<11clock> But ehh, at that point I'd rather just use "pubclass"
01:04:07FromDiscord<Aceroph> yes, this example does, but then doesnt use it https://nim-by-example.github.io/macros/↵(@DetermiedNim1)
01:04:50FromDiscord<Aceroph> it checks if the nnkIdent \ is present
01:05:38FromDiscord<11clock> I explained why the example works earlier.
01:06:03FromDiscord<11clock> Because it enforces specifying the inheritance, which makes the header valid syntax
01:06:11FromDiscord<11clock> Because "" has a target
01:06:53FromDiscord<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:04FromDiscord<11clock> It depends on if I run into this problem elsewhere.
01:09:11FromDiscord<11clock> I do know that this works:
01:09:33FromDiscord<11clock> https://media.discordapp.net/attachments/371759389889003532/1522046538770153562/d4af9b6dfbd881c40543fa640f2807c7.png?ex=6a470bcd&is=6a45ba4d&hm=6d001d2aaa461cef7cf0b7ea674b7c6dcfa187723f2e7bc50c20a87ce047d1ae&
01:10:25FromDiscord<11clock> Oh yeah another neat thing about my class macro is that it handles ordering
01:10:41FromDiscord<11clock> It actually generates proc signatures before the actual procs 😄
01:11:08FromDiscord<11clock> So you don't have to worry about ordering anything in a class definition
01:11:31FromDiscord<11clock> And I have a "context" macro that expands this to multiple classes, for bidirectional dependencies.
01:13:30FromDiscord<Aceroph> have you tried to replicate what dumpTree tells you?↵(@11clock)
01:13:34FromDiscord<Aceroph> did u check the logs?
01:13:46FromDiscord<unclechu> sent a code paste, see https://play.nim-lang.org/#pasty=nHZahBKc
01:15:04FromDiscord<unclechu> Yes, there is this\:↵> ... SIGSEGV\: Illegal storage access. (Attempt to read from nil?)\\n'
01:15:11FromDiscord<11clock> In reply to @Aceroph "have you tried to": It doesn't tell me anything because it doesn't compile
01:16:55FromDiscord<11clock> It's a compiler error that says that it expects an expression after the asterisk
01:30:39FromDiscord<unclechu> sent a code paste, see https://play.nim-lang.org/#pasty=NnVUPDeG
01:31:09FromDiscord<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:28FromDiscord<11clock> Probably the most ergonomic I could make them while abiding by nim's syntax
01:31:38FromDiscord<11clock> (edit) "Probably the most ergonomic I could make them while abiding by nim's syntax ... " added "and not doing weird hacks."
01:33:57FromDiscord<DetermiedNim1> is it returning field
01:34:02FromDiscord<11clock> yep
01:34:12FromDiscord<DetermiedNim1> you can't use name?
01:34:30FromDiscord<11clock> That would cause recursion
01:34:34FromDiscord<DetermiedNim1> ah
01:34:38FromDiscord<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:03FromDiscord<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:25FromDiscord<11clock> It's a small shortcut for something 😄
02:26:40FromDiscord<11clock> ok I know that nim had a pragma for this, but I wanted it to be slightly more explicit.
02:26:49FromDiscord<11clock> (edit) "had" => "has"
02:29:44FromDiscord<DetermiedNim1> hmm
02:29:51FromDiscord<DetermiedNim1> i
02:29:56FromDiscord<DetermiedNim1> have no idea 😭
02:33:26FromDiscord<DetermiedNim1> hmm
02:35:40FromDiscord<DetermiedNim1> is there any way to model a tuple of multiple different types using generics
02:36:18FromDiscord<DetermiedNim1> ideally i want to be able to sa↵seq[ListOfPossibleTypes]
02:36:22FromDiscord<DetermiedNim1> (edit) "sa↵seq[ListOfPossibleTypes]" => "say↵seq[ListOfPossibleTypes]"
02:36:25FromDiscord<DetermiedNim1> i just had an idea
02:38:14FromDiscord<DetermiedNim1> where you could model fields and procs as smth like↵↵(MemberType, AccessType, MemberValue)
02:38:45FromDiscord<DetermiedNim1> but i dont think it would work in nim's type system
02:41:47FromDiscord<Aceroph> sent a code paste, see https://play.nim-lang.org/#pasty=sOAEpgyN
02:42:32FromDiscord<11clock> In reply to @determiedmech1 "have no idea 😭": It's the tilde. It's a tiny macro that replaces it with `self.`
02:42:53FromDiscord<DetermiedNim1> ohhh nice
02:43:17FromDiscord<DetermiedNim1> whoa cachy-update also manages flatpaks
02:43:33FromDiscord<11clock> sent a code paste, see https://play.nim-lang.org/#pasty=DsBbbDnY
02:44:05FromDiscord<DetermiedNim1> do you have a github or smth for the oop stuff?
02:44:19FromDiscord<11clock> not yet, may share it.
02:44:28FromDiscord<DetermiedNim1> 🙏
02:44:36FromDiscord<11clock> I am am super happy with it, so it may prove useful for others
02:44:43FromDiscord<11clock> (edit) removed "am"
02:45:00FromDiscord<11clock> Sure a couple of slight annoyances but it's overall pretty much what I want out of class syntax.
02:45:19FromDiscord<Aceroph> the tilde?
02:45:49FromDiscord<11clock> The oop stuff I have made so far. It's only missing two more important features
02:46:01FromDiscord<11clock> Value objects and inheritance.
02:46:09FromDiscord<11clock> Then it should have pretty much everything
02:46:25FromDiscord<11clock> Then I can add stuff later like auto constructors and whatnot
02:46:53FromDiscord<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:52FromDiscord<Aceroph> example?↵(@DetermiedNim1)
03:18:05FromDiscord<DetermiedNim1> sent a code paste, see https://play.nim-lang.org/#pasty=IWhYcRmR
03:18:13FromDiscord<DetermiedNim1> (edit) "https://play.nim-lang.org/#pasty=aRcxcZnU" => "https://play.nim-lang.org/#pasty=fIMiARao"
03:19:20FromDiscord<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:38FromDiscord<DetermiedNim1> basically just a big LUT of stuff
03:20:09FromDiscord<DetermiedNim1> i guess it might not be the most optimal idea
03:23:39FromDiscord<Aceroph> not rlly 😅
03:23:40FromDiscord<Aceroph> why store it in a data structure
03:23:44FromDiscord<Aceroph> the fields/methods
03:23:53FromDiscord<DetermiedNim1> first thing i thought of 🤷‍♂️
03:24:40FromDiscord<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:50FromDiscord<Aceroph> i forgot, what are we trying to accomplish here?
03:30:34FromDiscord<DetermiedNim1> classes in nim
03:31:39*rockcavera quit (Remote host closed the connection)
03:37:49FromDiscord<Aceroph> can probably achieve c++ style classes pretty easily, and maybe even c# getter/setters
03:39:41FromDiscord<11clock> It's still crazy to me how much nim feels like a scripting language despite not being one.
03:45:01FromDiscord<DetermiedNim1> real
03:45:29FromDiscord<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:52FromDiscord<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:59FromDiscord<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:13FromDiscord<11clock> (edit) "much" => "many"
04:51:30FromDiscord<11clock> Maybe some small stuff here and there.
04:52:01FromDiscord<zumi.dxy> insert something about "no braces"
05:00:36*xet7 joined #nim
05:20:35*Skippy8 joined #nim
05:45:49FromDiscord<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:18FromDiscord<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:07FromDiscord<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:21FromDiscord<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:16FromDiscord<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:09FromDiscord<nervecenter> I forget who it is who's trying 🤷‍♂️
13:35:26FromDiscord<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:31FromDiscord<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:53FromDiscord<11clock> Hmm, I'd rather not use an experimental feature, but eventually I may need to find an alternative to interfaces.
13:43:20FromDiscord<planetis_m> Concept is not an alternative to interface. Its type-checked generics.
13:44:16FromDiscord<11clock> Well, not the same thing, but they seem to be able to solve similar problems.
13:47:26FromDiscord<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:57FromDiscord<11clock> (edit) removed "all objects in" | "a collection ... you" added "of objects"
13:49:35FromDiscord<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:12FromDiscord<11clock> I see.
13:50:34FromDiscord<11clock> I wonder if it's even possible to do something like that in nim
13:51:19FromDiscord<planetis_m> It is either with object variants or object hierarchies.
13:52:03FromDiscord<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:38FromDiscord<_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:04FromDiscord<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:06FromDiscord<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:59FromDiscord<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:40FromDiscord<11clock> I have noticed that nim supports unions so I can probably do something with that
15:04:14FromDiscord<planetis_m> In reply to @11clock "I have noticed that": unions are for C compatibility use object variants instead
15:04:39FromDiscord<planetis_m> well for mixins something that works is a simple ECS like mine: https://github.com/planetis-m/pirata
15:05:01FromDiscord<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:27FromDiscord<11clock> In reply to @planetis_m "well for mixins something": Yes I was considering this kind of style.
15:06:05FromDiscord<11clock> The Ruby version of my game engine introduced components, although largely as a means to mitigate risks of inheritance collisions.
15:07:53FromDiscord<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:00FromDiscord<planetis_m> but yeah single inheritance is a limitation with designing game engines.
15:09:07FromDiscord<planetis_m> (edit) "with " => "when"
15:10:26FromDiscord<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:28FromDiscord<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:20FromDiscord<planetis_m> I can see how that lineage could make the Nim port harder.
15:17:05FromDiscord<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:59FromDiscord<planetis_m> In reply to @11clock "Ruby was very close.": This could work just fine: https://gist.github.com/planetis-m/449bc45ea8befa1f64c668ee358aacc5
16:01:51FromDiscord<gesee37> In reply to @11clock "Ruby was very close.": If you need interface use the magical combo 🙂
16:02:00FromDiscord<gesee37> MD + concepts
16:02:09FromDiscord<gesee37> Multiple dispatch + concepts
16:02:24*beholders_eye quit (Ping timeout: 246 seconds)
16:02:25FromDiscord<gesee37> Fair and square 😄
16:04:23*beholders_eye joined #nim
16:05:06FromDiscord<gesee37> sent a code paste, see https://play.nim-lang.org/#pasty=kYXHhccp
16:06:05FromDiscord<gesee37> It doens't introduce any performances cost and is kinda easy to extend
16:06:18FromDiscord<gesee37> (edit) "It doens't introduce any ... performances" added "runtime"
16:06:48FromDiscord<gesee37> (edit) "https://play.nim-lang.org/#pasty=CeUREuME" => "https://play.nim-lang.org/#pasty=UlaTEvBe"
16:11:21FromDiscord<11clock> Hmm, still can't use it in collections though I assume?
16:11:34FromDiscord<11clock> seq[MyInterface]
16:12:51FromDiscord<11clock> (edit) "Hmm, still can't use it in collections ... though" added "and as a type in parameters and variables"
16:22:11FromDiscord<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:21FromDiscord<_timurski> remember that object variants are more performant than vtables as well
16:27:41FromDiscord<_timurski> and oftentimes make it easier to reason about your program
16:29:18FromDiscord<_timurski> oh i didn't even know about this
16:29:24FromDiscord<_timurski> https://nim-lang.org/docs/manual.html#methods
16:30:10FromDiscord<_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:15FromDiscord<_timurski> `method` allows for dynamic dispatch
16:32:12FromDiscord<DetermiedNim1> sent a code paste, see https://play.nim-lang.org/#pasty=XxPxStga
16:32:24FromDiscord<DetermiedNim1> is that `and` stuff an actual syntax thing
16:32:52FromDiscord<_timurski> ?
16:33:09FromDiscord<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:11FromDiscord<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:27FromDiscord<11clock> (edit) "that" => "they"
16:33:56FromDiscord<gesee37> In reply to @11clock "I am aware of": Welp just make multiple storage
16:34:05FromDiscord<gesee37> It could also work out
16:34:44FromDiscord<_timurski> sent a code paste, see https://play.nim-lang.org/#pasty=lOsSmpps
16:34:49FromDiscord<_timurski> this works^
16:36:02FromDiscord<_timurski> In reply to @gesee37 "Welp they are hell": i'm not sure what you mean here, just dealing with the extra cases?
16:39:10FromDiscord<gesee37> sent a code paste, see https://play.nim-lang.org/#pasty=WkgTvLPB
16:39:38FromDiscord<gesee37> (edit) "https://play.nim-lang.org/#pasty=wkaGdOYB" => "https://play.nim-lang.org/#pasty=UAkVkgbw"
16:39:48FromDiscord<_timurski> yeah i think runtime polymorphism is really rarely necessary
16:39:53FromDiscord<_timurski> it sometimes looks simpler
16:39:58*Skippy8 quit (Read error: Connection reset by peer)
16:40:11FromDiscord<_timurski> but static typing is so incredibly useful for understanding your program
16:40:13*Skippy8 joined #nim
16:40:32FromDiscord<_timurski> In reply to @_timurski "yeah i think runtime": it's only strictly necessary if you don't know all your inheritors at comptime
16:40:35FromDiscord<_timurski> like in Java
16:40:48FromDiscord<_timurski> but i feel like that's quite a rare circumstance to be in
16:40:55FromDiscord<_timurski> (edit) "but i feel like that's quite a rare circumstance to be in ... " added "languages like Nim"
16:41:35FromDiscord<gesee37> In reply to @_timurski "i'm not sure what": If you had 10 place in your code where you were doing pattern matching on cas object, adding one more case require you to update all of them, and someone can't extend it without modifying the source code
16:42:07FromDiscord<gesee37> (edit) "cas" => "case"
16:42:27FromDiscord<_timurski> that's true, though i think in a way that can't be counted as a disadvantage because it shows the mechanism working: you must consider how the object will impact the rest of the program if you add another case
16:42:43FromDiscord<_timurski> but i can definitely see how it can be a hassle
16:43:30FromDiscord<toitle3554> In reply to @11clock "I am aware of": You can create interfaces via struct-of-closures https://forum.nim-lang.org/t/13217
16:43:52FromDiscord<_timurski> also yeah ^
16:44:39FromDiscord<toitle3554> closures are a little fussy though, I've found 2 or 3 memory corruption errors related to them
16:48:10FromDiscord<toitle3554> another method is to define a `PublicFields` and different `PrivateFields` structs, and then create an `InterfaceObject` type that uses a discriminator field (like `kind`) to access private fields.
16:48:49FromDiscord<toitle3554> gets very verbose tho, hopefully some of Nim 3's QoL features for sum types/pattern matching help with it
17:23:16FromDiscord<Aceroph> what↵(@DetermiedNim1)
17:42:56FromDiscord<planetis_m> @11clock out of curiosity I created a benchmark https://gist.github.com/planetis-m/8200623edee5459271322b7071a4bf83
17:46:21FromDiscord<DetermiedNim1> sent a code paste, see https://play.nim-lang.org/#pasty=CYDRmGqE
17:46:31FromDiscord<planetis_m> Simple composition wins. ihmo its not worth bothering with neither MI or ECS. Although I dont know how appropriate AoS is for a game engine.
17:47:40FromDiscord<tvoyglaza> How do I transform Nim pure code (that doesn't intereact with the system and is basically standalone) into C/C++ pure libraries?↵For example, the Nim standard libraries `math` and `strutils` do not interact with the system, since those ones only execute pure codes. So if I want to convert a code that uses only pure (really pure) libraries, how do I do?
17:48:37FromDiscord<tvoyglaza> I believe that it would be nice if it was possible to create C/C++ pure libraries using the Nim language
17:51:13FromDiscord<tvoyglaza> On this way, even Arduino enthusiasts could write the heavy logic in a friendly way (by using Nim)
17:54:20FromDiscord<demotomohiro> In reply to @tvoyglaza "How do I transform": Nim has `exportc` and `exportcpp` that exports Nim types, variables or procedures to C/C++:↵https://nim-lang.org/docs/manual.html#foreign-function-interface-exportc-pragma
18:01:51FromDiscord<gesee37> In reply to @planetis_m "<@214055489057587211> out of curiosity": I would rather say the bench is biased as the ECS is extremely naive, the MI-AoS case induce multiple logic's duplication (and reduce composition as each object is just a monolith)↵And that test case with some optimized ECS, i would win the bench
18:03:23FromDiscord<planetis_m> In reply to @gesee37 "I would rather say": Isnt that same ECS that beat your framework? I think, we have been over this already.
18:03:53*beholders_eye quit (Ping timeout: 252 seconds)
18:04:40FromDiscord<gesee37> In reply to @planetis_m "Isnt that same ECS": I don't remember any framework beating it yet 🙂↵We have been through the breakout benchmark and it was 2 time faster (and now I optimized it way further so...)
18:05:41FromDiscord<planetis_m> The breakout systems were inefficient indeed, but optimizing the transform system doesnt prove your framework is faster
18:07:47FromDiscord<gesee37> In reply to @planetis_m "The breakout systems were": Well then what proves it ?
18:08:27FromDiscord<planetis_m> Sometimes we need to look at the numbers with cold reason and figure that the ECS pattern is not winning any benchmarks so far, in general. It markets itself as a better organization pattern than OOP. That's it.
18:10:16FromDiscord<gesee37> In reply to @planetis_m "Sometimes we need to": Well it DO wins benchmarks. An now I was even going to make a paper about it being a proper primitive able to model OOP and other model↵Basically OtherThings include in ECS
18:10:23FromDiscord<gesee37> (edit) "include" => "included"
18:11:44FromDiscord<tvoyglaza> In reply to @demotomohiro "Nim has `exportc` and": But, if I want a C/C++ code/library that works in any (available) system, any (available) architeture and can be imported easily by any recent C/C++ code? I was trying to do this, but I didn't found enough info in the Nim documentation.
18:12:30FromDiscord<gesee37> In reply to @planetis_m "Sometimes we need to": I think the reason why you think this way is because you haven't interested yourself into the internal of a really optimized ECS, you would see that comparing it in term of performances to other paradigm (except specific case) doesn't even make sense
18:12:54FromDiscord<gesee37> ECS would win everytime
18:16:55FromDiscord<demotomohiro> In reply to @tvoyglaza "But, if I want": Nim can generates C/C++ code but it is not portable C/C++ code.↵I don't think Nim supports such a feature.↵You probably need to manually translate Nim code to portable C/C++ or create a such tool yourself.
18:19:37FromDiscord<tvoyglaza> In reply to @demotomohiro "Nim can generates C/C++": Bro, It isn't a bad idea. So I only need to ensure that all the types used in Nim are ctypes?
18:20:22FromDiscord<tvoyglaza> If I want a easy way to achieve there
18:20:46FromDiscord<tvoyglaza> (edit) "achieve" => "get"
18:27:15FromDiscord<planetis_m> In reply to @gesee37 "Well it DO wins": Good luck, honestly. Isn't saying "ECS wins every time" a bit of an absolute statement? What makes you think that? Are there any unbiased numbers that support it, or is it more of a feeling?
18:27:54FromDiscord<planetis_m> And what is there to optimize, that cant be equally be transfered to the other methods,
18:30:51FromDiscord<gesee37> In reply to @planetis_m "Good luck, honestly. Isn't": The fact that it optimize for contiguity, fast iteration, use advanced structure to make iterating faster (hibitset, archetypes, querying, etc)↵I organize data in a way that system can be homogenous and do their works in one pass without duplication (which is not the case in the other approach)↵It doesn't iterate every entities like you do, it build archetypes graphs, query cache
18:31:45FromDiscord<gesee37> In reply to @planetis_m "And what is there": Relational queries, dynamic queries, dumping archetypes (for faster removes), composition through bitset, efficient scheduling for parallelism, and way more
18:32:34FromDiscord<planetis_m> In reply to @gesee37 "Relational queries, dynamic queries,": To be clear what's your target entity count that you expect that ECS wins other approaches? In what bullpark area? in thousands or millions?
18:33:50FromDiscord<gesee37> In reply to @planetis_m "To be clear what's": It all depends on what you do, but most of the time it will win even for hundreds (or be at the same level as bare metal solutions)
18:35:03FromDiscord<planetis_m> And to be clear, I think it's great that you spend time thinking about these things. I just don't think it's fair to assume that because I don't consider this issue worth spending much time on, I'm a simpleton. Everyone has different priorities, and that's okay.
18:36:42FromDiscord<planetis_m> From the benchmarks I've run, which are on the order of tens of thousands of cases, I just haven't seen evidence that ECS consistently wins, whether the storage is dense or sparse. That's simply what I've observed. I know this might come across as adversarial, but I'm just sharing what my measurements have shown.
18:38:05FromDiscord<gesee37> In reply to @planetis_m "From the benchmarks I've": I you haven't wondered why it's only your measurement that drawn those conclusions ?
18:38:12FromDiscord<gesee37> (edit) "I" => "and"
18:38:40FromDiscord<gesee37> And no one else ?
18:56:45FromDiscord<planetis_m> Not really. For me, it comes down to two things. First, I trust the results I've observed myself. Second, it's not just my perspective. I recently discussed this with the creator of Flecs, who said, "People seem to have forgotten that ECS wasn't invented for performance, but to get around hard-to-evolve object hierarchies."
18:56:56FromDiscord<11clock> Currently learning the wonderful world of making your own operators with macros
18:57:11FromDiscord<11clock> Although I should probably hurry up and make something already.
18:57:15FromDiscord<timbuktu_guy> thank god
18:57:15FromDiscord<timbuktu_guy> https://discord.com/channels/371759389889003530/456469304838455348/1522311183179186378
18:57:18FromDiscord<timbuktu_guy> the 67 goat has arrived
18:57:27FromDiscord<timbuktu_guy> he is currently in a Fortnite 1v1 it appears
18:57:31FromDiscord<timbuktu_guy> but shortly we will be graced
18:57:57FromDiscord<timbuktu_guy> https://media.discordapp.net/attachments/371759389889003532/1522315407711535104/image.png?ex=6a480634&is=6a46b4b4&hm=dde654b833ba7854ac2825ecd809f8950789070075cd3a447bc11c9fb8039875&
18:57:58FromDiscord<timbuktu_guy> i'm sorry
18:58:24FromDiscord<_timurski> In reply to @11clock "Currently learning the wonderful": be careful not to overuse it, it can become quite hellish
19:01:32FromDiscord<gesee37> In reply to @planetis_m "Not really. For me,": Yes but you stated earlier that it didn't benefits over OOP ?↵Also not sure the author of flecs is the best example you could take, Sander is a performances freak (in the good way)
19:04:09FromDiscord<planetis_m> In reply to @gesee37 "Yes but you stated": That's sounds amazing good luck.
19:06:13FromDiscord<gesee37> In reply to @planetis_m "That's sounds amazing good": You could also just check an actual ECS source code, or read their documentation and you would understand 🙂.↵Or even try yourself to build an ECS, Sander have made multiple articles about it, you can just read them (he is probably the first result when you google "how to make an ECS" 😂)
19:06:49FromDiscord<planetis_m> In reply to @gesee37 "You could also just": No thank you. I wasted enough time on that and it seems it's turning into a cult than actual science
19:07:08FromDiscord<gesee37> In reply to @planetis_m "No thank you. I": When you will see the backdoor, you will understand why people like it (I'm not a fan of ECS myself but I recognize it's benefits)
19:07:21FromDiscord<planetis_m> okay
19:10:31FromDiscord<gesee37> In reply to @planetis_m "No thank you. I": oh I didn't even actually saw this. What made you think it's a cult. It's like Rust you know, you can think what you want about it but if tons of person goes to it, tons of persons dedicated years (Like sander or skypjack) to make build some, it's probably because of shallow marketing
19:10:39FromDiscord<gesee37> We are engineers after all
19:11:14FromDiscord<gesee37> (edit) "In reply to @planetis_m "No thank you. I": oh I didn't even actually saw this. What made you think it's a cult. It's like Rust you know, you can think what you want about it but if tons of person goes to it, tons of persons dedicated years (Like sander or skypjack) to make build some, it's probably ... because" added "not"
19:11:35FromDiscord<gesee37> (edit) removed "make"
19:12:15FromDiscord<planetis_m> Are we allowed to have opinions these days? What's my sin here that I trust what I see?
19:12:47FromDiscord<_timurski> In reply to @planetis_m "Are we allowed to": geese just asked you why you think it's a cult, perfectly fine to ask to justify your opinion
19:13:00FromDiscord<_timurski> unjustified opinions are thought terminators
19:13:18FromDiscord<_timurski> if you don't wanna keep engaging just say that but being questioned about your stance is perfectly valid
19:14:18FromDiscord<tempestro> why do `var` and `let` blocks not require a colon, but `static` blocks do?
19:16:07FromDiscord<_timurski> In reply to @tempestro "why do `var` and": static can have arbitrary code in it while var and let just allow more similar statements to be made compactly
19:16:48FromDiscord<_timurski> you can pass a `untyped` code body into a macro (a statement list) but that's not how var and let declarations are structured
19:17:03FromDiscord<_timurski> so they're fundamentally different things while looking similar at times
19:18:21FromDiscord<tempestro> I'm planning on making a thing with ECS myself.↵My understanding is that it lets you modify what data an "object" carries with it at runtime. Using UCS, you can make getters and setters that actually get the data from some global `Table[Entity, Data]`
19:18:41FromDiscord<planetis_m> In reply to @_timurski "if you don't wanna": That you're all parrot the same opinions you read in the orange site but dont have any proof to back it up? Just skewed benchmarks. Did I do well?
19:19:07FromDiscord<_timurski> In reply to @planetis_m "That you're all parrot": you're being quite rude
19:19:17FromDiscord<planetis_m> Thanks
19:19:18FromDiscord<_timurski> I've never even used an ECS
19:19:40FromDiscord<_timurski> you're just getting way angrier than everyone else it seems
19:20:43FromDiscord<tempestro> also, considering a hashMap is internally an array with fancy access semantics, running a piece of code against all entities that have a given component is really performant
19:23:19FromDiscord<planetis_m> In reply to @_timurski "you're being quite rude": But I am not rude, I made an effort to be receptive to Geese opinions as you can read in my previous responses. So that's not fair to call me rude. I did not insist in pinging him even when the other person is clearly showing that he doesnt want to continue the conversation. Okay?
19:24:48FromDiscord<tempestro> (what I think is trickier is running code against entities with a given set of components. I think you need to keep a separate set for each component what entities have it, specifically a set optimised for union operations)
19:36:38FromDiscord<gesee37> sent a long message, see https://pasty.ee/QuGNxZqS
19:44:26FromDiscord<tempestro> In reply to @gesee37 "Well since we are": not at all↵Science is the application of the scientific method to two ends: to find how things really work, and to make use of this knowledge to our benefit
19:45:23FromDiscord<gesee37> In reply to @tempestro "not at all Science": To find how things works you make hypothesis, right ?↵Then they are peer reviewed
19:45:31FromDiscord<tempestro> no, you fuck about and find out
19:45:35FromDiscord<tempestro> that's literally it
19:46:36FromDiscord<tempestro> Peer review is a sorting mechanism. A scientist can work entirely on his lonesome, can't he?
19:47:18FromDiscord<gesee37> Just that it's how we get better... you propose some idea, people with different perspective can see things you missed and tell you what are the problems.
19:48:00FromDiscord<gesee37> I you can fix them then your idea get solid
19:48:06FromDiscord<gesee37> else it has a flaw
19:48:48FromDiscord<tempestro> no
19:49:00FromDiscord<tempestro> You stand on the shoulders of giants, but you work on your own
19:51:17FromDiscord<gesee37> In reply to @tempestro "You stand on the": Then you make your works public, people review it and tell you if something is wrong
19:56:21FromDiscord<_timurski> In reply to @tempestro "You stand on the": to be fair an extremely small part of science works like this in the modern day
19:57:13FromDiscord<_timurski> I'm not exactly sure what you're saying but arguing against peer review seems questionable 🤔
20:00:23FromDiscord<tempestro> The shit that passes peer review nowadays is pretty laughable if I dare say so myself
20:00:59FromDiscord<_timurski> well that's just bad peer review
20:01:09FromDiscord<_timurski> there are big systemic issues with many journals
20:01:14FromDiscord<_timurski> people are imperfect
20:01:23FromDiscord<_timurski> but it doesn't follow that peer review is somehow unnecessary
20:01:50FromDiscord<_timurski> I've seen many cranks try to work independently when some peer review would have helped them get off a bad path
20:03:50FromDiscord<_timurski> what I want to emphasize is that collaboration and differing view points has led to some of the greatest scientific developments, and this is also the case for engineers looking at each other's work
20:08:09*oculux joined #nim
20:10:00*kick455 quit (Ping timeout: 244 seconds)
20:23:33FromDiscord<Aceroph> i do not know what i am supposed to be looking for in that code block↵(@DetermiedNim1)
20:23:45FromDiscord<Aceroph> theres no `and` keyword
20:25:24*deavmi quit (Quit: No Ping reply in 180 seconds.)
20:26:22FromDiscord<_timurski> In reply to @Aceroph "i do not know": i think they are referring to the `and` in the comment
20:26:48FromDiscord<DetermiedNim1> oh my god i didnt notice that it was commented 😭
20:26:58FromDiscord<DetermiedNim1> my bad
20:27:28*deavmi joined #nim
20:33:07*deavmi quit (Ping timeout: 272 seconds)
20:41:05*deavmi joined #nim
20:44:23FromDiscord<11clock> Alright new operator to go with the tilda one I introduced yesterday.
20:44:26FromDiscord<11clock> https://media.discordapp.net/attachments/371759389889003532/1522342202439762022/d76d10d3ab5d3945710003e91c23fcec.png?ex=6a481f28&is=6a46cda8&hm=32e94b150cbed6c791d7202c1ee3479c21beeec32f8542d75bf88e3c40fe24e0&
20:45:05FromDiscord<11clock> https://media.discordapp.net/attachments/371759389889003532/1522342367389290629/f8b7d04e35e1f606d7f5b3888537da4d.png?ex=6a481f50&is=6a46cdd0&hm=74443623421c2c1718bedbcf6285baa7d5b7cb51c086430cc01846f5b92cd29d&
20:46:43FromDiscord<11clock> The original idea was to bring in C#'s object initializers.
20:46:48FromDiscord<_timurski> In reply to @11clock "": what's the benefit of this?
20:47:05FromDiscord<_timurski> introducing new opaque operators like this should be done with immense thought imo
20:47:21FromDiscord<_timurski> oh i see
20:47:32FromDiscord<_timurski> it's like lambdas?
20:47:42FromDiscord<_timurski> so you refer to the result with `~()`?
20:48:04FromDiscord<11clock> It's a single argument pipe operator essentially.
20:48:41FromDiscord<11clock> I made it to reduce the amount of times I need to hold an inbetween variable. C#'s object initializers helped a lot with that and I wanted that functionality in nim
20:49:14FromDiscord<11clock> So this was going to be an object initializer, but I expanded it to be applicable to any return value for any proc.
20:49:23FromDiscord<11clock> Or just expression in general
20:51:36*deavmi quit (Quit: No Ping reply in 180 seconds.)
20:53:25*deavmi joined #nim
20:57:02FromDiscord<11clock> I also made it "~>" because it pairs with the tilda operator I made yesterday.
20:58:07FromDiscord<11clock> I defined "~" to mean "self" so the operator is like "ok pass this in as self into this block"
21:02:27*deavmi quit (Quit: No Ping reply in 180 seconds.)
21:09:37*deavmi joined #nim
21:13:00*deavmi quit (Client Quit)
21:14:23*deavmi joined #nim
21:40:43*rockcavera joined #nim
21:51:08FromDiscord<11clock> Hmm, trying to understand the rules around expressions in nim
21:51:12FromDiscord<11clock> https://media.discordapp.net/attachments/371759389889003532/1522359005245214910/0692123cdf2a2c9d592172da5ddbb763.png?ex=6a482ece&is=6a46dd4e&hm=29538847473c1851981b2a75a5d2768a36eaf415226a4c211799a38ba8542114&
21:51:19FromDiscord<11clock> This isn't valid nim syntax
21:51:25FromDiscord<11clock> But...
21:51:46FromDiscord<11clock> This is? https://media.discordapp.net/attachments/371759389889003532/1522359148690407516/a63bbf2b8a2e0546d2b9470abc9975bf.png?ex=6a482ef1&is=6a46dd71&hm=542200337a419894fd6dc55a456340db90920d57ef46dc62b9f0e73ca1397b09&
21:52:41FromDiscord<11clock> This also works https://media.discordapp.net/attachments/371759389889003532/1522359382430715997/e09ba6ceb4395a33160451396e85f7f4.png?ex=6a482f28&is=6a46dda8&hm=817a0d67497fd4e85b8f1a29f5848f4cd2625d068ac60df597e88133131ce80f&
21:52:52FromDiscord<11clock> So what determines when you need or not need semicolons?
21:54:49FromDiscord<mratsim> In reply to @tvoyglaza "But, if I want": https://github.com/mratsim/constantine/blob/master/constantine.nimble#L252-L312
21:56:06FromDiscord<mratsim> The only tricky part is that if you use Nim runtime, say seq or strings or ref, i.e. anything allocated, you need to call NimMain().↵↵You don't need to if you don't use that
21:57:15FromDiscord<demotomohiro> In reply to @11clock "Hmm, trying to understand": Statement list expression needs semicolons between statements:↵https://nim-lang.org/docs/manual.html#statements-and-expressions-statement-list-expression
21:58:00FromDiscord<mratsim> I use the following to autoload NimMain: https://github.com/mratsim/constantine/blob/ea8c268603a5c5f5be479dda9ba27dcbdc51dade/constantine/platforms/loadtime_functions.nim↵+ https://github.com/mratsim/constantine/blob/ea8c268603a5c5f5be479dda9ba27dcbdc51dade/bindings/lib_autoload.nim#L38↵↵(when compiling I namespace `NimMain` to `ctt_init_NimMain`
21:59:27FromDiscord<mratsim> You can look at my headers: https://github.com/mratsim/constantine/tree/master/include↵and grok through the codebase to see the matching Nim proc
22:00:43FromDiscord<mratsim> Most are autogenerated from https://github.com/mratsim/constantine/tree/master/bindings
22:36:45*beholders_eye joined #nim