4 ms·
Also, the author does not seem to understand how C callbacks work. Gtk uses the same stuff, hiding them under "signals". Qt had an awful hack to support C++-sty
by dig1 3y ago
Also, the author does not seem to understand how C callbacks work. Gtk uses the same stuff, hiding them under "signals". Qt had an awful hack to support C++-style callbacks through the MOC preprocessor, which, in the end, were "compiled" into C-style callbacks. AFAIK, after C++11 they moved from this.
> If you can pass a const, you can pass a string literal for example, which will then be de-const’d, so you can modify it at will. Welcome to the land of undefined behavior by design!
The author needed to understand what C is - a weakly typed language that doesn't get in your way. EFL (and Enlightenment) was created and led by Rasterman [1], the guy who knows his craft and doesn't waste his time with type-related theoretical nonsense. I find his code extremely readable and performant, and he has a lot of good resources to learn from.
[1] https://en.wikipedia.org/wiki/Carsten_Haitzler https://en.wikipedia.org/wiki/Carsten_Haitzler
- dale_glass 3y ago> Qt had an awful hack to support C++-style callbacks through the MOC preprocessor, which, in the end, were "compiled" into C-style callbacks. AFAIK, after C++11 they moved from this. Nothing really awful about it. MOC is the MetaObject Compiler, and it's needed to support introspection. In standard C++ you can't just list the methods or properties any random thing has, for instance. Signals are also pretty complex. At the simplest, yes, they're more or less a C callback. But they can also be queued and sent between threads, and that of course needs special support that Qt does for you behind the scenes. What changed in newer releases is that signal syntax moved from using strings: connect(sender, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed())); // This is pretty much: connect(sender, "destroyed(QObject*)", this, "objectDestroyed()"); to references: connect(sender, &QObject::destroyed, this, &MyObject::objectDestroyed); Which means connections are checked at compile time instead of at runtime, and you can also connect signals to functors or lambdas.
- agumonkey 3y agoAlso enlightened (and thus rasterman) had a reputation of non trivial optimizations and low memory footprint which was critical for early smartphones.
- IshKebab 3y agoThey didn't display any misunderstanding of C callbacks. The two complaints I read were: 1. You pass a const pointer in and get a mutable pointer out. 2. The value of one of the parameters was inconsistent. Both are valid criticisms. The first point is objectively wrong API design. Let me repeat, it is objectively wrong. C may not have the strongest type system but that doesn't mean that the intended programming model is "completely ignore const correctness". > knows his craft Maybe. But there are plenty of programmers who achieve great things while being objectively awful programmers. The criticisms in this article (assuming they are true) are really unarguable.