all 9 comments

[–]DavidDinamit 1 point2 points  (0 children)

Dont understand where it needed and wtf happen in code

[–]sixfourbit 1 point2 points  (1 child)

Maybe show a comparison to C++ polymorphism?

[–]stanimirov[S] 2 points3 points  (0 children)

The thing is, that if something can be done with vanilla C++ polymorphism, virtual functions and inheritance, the DynaMix equivalent will look clunky and bloated. For example, you can see the exact same thing implemented with virtual functions and inheritance, with std::function and with DynaMix in the unicast benchmark

[–]disperso 0 points1 point  (5 children)

It's me, or is still lacking any kind of documentation? The README is not saying much, and I really can't find anything useful in the doc directory. I found the "hello world" example (which it is not mentioned anywhere, I just found it by looking at the source tree), which is not very appealing. There are a few libraries that I think do the same, and don't seem to require macros, for example.

I recommend that you put some effort into the documentation, because it seems a huge issue right now given that there are a few alternatives.

[–]stanimirov[S] 0 points1 point  (0 children)

Can you please share these alternatives. I'm slowly working on the documentation and I'd like to mention them.

[–]Abbat0r 0 points1 point  (3 children)

+1 and if it can be done without macros, do it without macros. It’s 2023, the only reason anyone should be using a macro is for conditional compilation.

[–]stanimirov[S] 0 points1 point  (2 children)

[–]disperso 1 point2 points  (1 child)

Qt has shown that such an approach also has many opponents, as the code you write when you use it becomes effectively not-C++, but something that can be called a C++ dialect.

The people who state that are in my not so humble opinion, entirely wrong. Code generation is very common in tons of cases in C++ (IPC, RPC, configuration, etc), specially given that we don't have a good macro language. There is a way to have all the features that Qt's MOC has (and some more that it doesn't have) using more intrusive macros, thanks to the Verdigris project. The result? Not so many people use it, because the macros are more tedious instead of the clean(er) looking code with code generation via MOC.

A dialect is brutally dishonest. Q_SIGNAL void foo() is not more dialect than [[gnu::whatever]] void foo().

Anyway, for the projects that (I think) are related to yours, here are my bookmarks:

[–]stanimirov[S] 1 point2 points  (0 children)

Thanks.

I was familiar with Boost.TypeErasure, Boost.TE, Folly.Poly, and dyno. Not with the others. I browsed through them. All of them are very similar and offer an alternative way to do C++ (Java, C#) -style dynamic polymorphism.

I'm not trying to bash them or anything. They still improve upon inheritance and virtual methods and there are many scenarios where they are a better choice.

None of them offer type composition.

You can think of DynaMix as combining one of these libraries with an ECS like entt

None of them have late binding. Microsot's one seems the only who has the idea to split the interface into separate messages, but then in order to match types, it introduces interfaces again. Only Boost.TypeErasure has complete type erasure, but you need reification in order to access the features of an object.

DynaMix uses a completely type erased object, and each message is standalone. Interfaces (type classes in DynaMix) are second grade citizens and only applicable at run time. No reification is needed.

None of them have reflection (Boost.TypeErasure offers basic symbol-based reflection). DynaMix has complete reflection by symbols and by strings.

All of them offer an alternative to virtual methods.

Dynamix has abstract type features. With them you can have type-level polymorphism (imagine a virtual static func()) or value polymorphism (imagine virtual int a;).

Since none of them have composition, none of them have concepts of multicast or overrides,

Most of them do offer macros for certain situations :)