4 ms·
Hello friends! Author here, nice to see so much discussion :) I've spent most of my adult life working on large C++ codebases with public API's (most notably Q
by akling 7y ago
Hello friends! Author here, nice to see so much discussion :)
I've spent most of my adult life working on large C++ codebases with public API's (most notably Qt and WebKit), which has led me to cultivate a defensive programming mindset. Someone mentioned Hyrum's law, which is 100% accurate in my experience.
I should be honest and admit that Badge<T> is not yet diligently applied everywhere in the Serenity codebase. I wanted to "feel it out" for a while first, but now I've decided I like it, so I'm applying it more and more going forward.
Oh and while I have your attention, I recently posted a May 2019 update video[1] on the Serenity OS project if you're curious how things are going :)
[1] https://www.youtube.com/watch?v=KHpGvwBTRxM https://www.youtube.com/watch?v=KHpGvwBTRxM
- w0utert 7y agoI like this idea, except for the fact that the extra parametrer pollutes the method signature and method calls, for something that really should only be a compile-time directive. I'm actually curious why something like this has never been included as a language feature, it seems trivial to come up with a syntax for fine-grained access control, that is fully backwards-compatible and a true zero-cost abstraction. Most obvious first shot: class A { private: void badgedFunction() const friend Device, SomeOtherClass; }; Did you ever check with the C++ working group if there are any proposals for language extensions for this purpose?
- akling 7y agoYeah, polluting the signatures is a shame. I've only just decided that I enjoy using this pattern so my internal standards committee hadn't progressed to the proposal stage yet. :) Your syntax makes perfect sense to me, and I think it would make a great addition to the language. I wonder what the real working group would say. (I tried quickly googling for something that might sound like an existing proposal but came up empty.)