By: anon2 (anon.delete@this.anon.com), May 23, 2022 12:47 am
Room: Moderated Discussions
Jörn Engel (joern.delete@this.purestorage.com) on May 23, 2022 12:11 am wrote:
> anon2 (anon.delete@this.anon.com) on May 22, 2022 11:42 pm wrote:
> >
> > Curious: where do you see an object-oriented approach in Highway? All I see is a bunch
> > of specialized parametrized types and tags as well as partially overloaded operations.
> > That’s no more object-oriented than say, distinction between int, float and double.
>
> template
> class Vec256 {
>
> You are right, I don't see a second example. And even this example appears to only implement operators.
Well, classes are basically the same as structs, it’s just a way to define an aggregate type. It’s not really object-orientation until you get into inheritance. And in C++ aggregate types can also be used to implement scope-restricted functions (member functions) - as usually, C++ likes to conflate things and make them confusing. It’s still just syntactic sugar, not object orientation.
> I guess I should have complained about templates instead. But that's probably just one more
> example of the C/C++ cultural divide, you either have a strong dislike or you embrace them.
Why aversion against templates? They are just the way to parametrize implementations. In plain C you either end up with vicious amount of copy-pasted code or messy macros that do exactly the same thing. On the end it’s about ergonomy and maintainability.
> anon2 (anon.delete@this.anon.com) on May 22, 2022 11:42 pm wrote:
> >
> > Curious: where do you see an object-oriented approach in Highway? All I see is a bunch
> > of specialized parametrized types and tags as well as partially overloaded operations.
> > That’s no more object-oriented than say, distinction between int, float and double.
>
> template
> class Vec256 {
>
> You are right, I don't see a second example. And even this example appears to only implement operators.
Well, classes are basically the same as structs, it’s just a way to define an aggregate type. It’s not really object-orientation until you get into inheritance. And in C++ aggregate types can also be used to implement scope-restricted functions (member functions) - as usually, C++ likes to conflate things and make them confusing. It’s still just syntactic sugar, not object orientation.
> I guess I should have complained about templates instead. But that's probably just one more
> example of the C/C++ cultural divide, you either have a strong dislike or you embrace them.
Why aversion against templates? They are just the way to parametrize implementations. In plain C you either end up with vicious amount of copy-pasted code or messy macros that do exactly the same thing. On the end it’s about ergonomy and maintainability.