Re:C++17 constexpr Compile-time Ray Tracer (2017)
by jcelerier on Tuesday October 30, 2018 @02:19PM
(#18339759)
> My point is, this mismatch between how flexible the technique we're using is versus how much flexibility we actually need
well, most of the software I use every day have some sort of plug-in interface which is done at some point by loading a .dll at runtime and getting derived instances of a base type defined in the host app.
Re:C++17 constexpr Compile-time Ray Tracer (2017)
by phaedrus on Tuesday October 30, 2018 @04:09PM
(#18340845)
That's a very good point. It might be question of high versus low level. From a video I watched today (the rest of the video is worth watching, too, but the following stand-alone quote is apropos): "Polymorphism and interfaces have to be kept under control. I don't believe that their role is in a very low level system like interpolating a couple of numbers in the animations, but they have their place in high level systems, in client facing APIs. They are amazing if you do a type of plug in and you really need some type of dynamic polymorphism."
An analogy would be if we used only ball-and-socket joints everywhere in machines, even where a single-axis hinge would work just fine. And then just accepted that machines are inherently wobbly, rather than questioning whether extra degrees of freedom (whether needed or not) are always better than less.
I think sometimes what we really want when we use class inheritance is actually something like a std::variant where we don't have to know all of the constituent types in advance.