By: Michael S (already5chosen.delete@this.yahoo.com), May 23, 2022 2:52 am
Room: Moderated Discussions
anon2 (anon.delete@this.anon.com) on May 23, 2022 12:47 am wrote:
> 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.
>
>
Templates are too generic answer to the challenge of generic programming.
Pattern matching, which is at heart of templates, is hard and more than occasionally confusing, not just to compilers, but to human readers as well.
More restrictive solutions to generic programming (e.g. generic facility of Ada) appear to be less confusing.
Less powerful, too, but powerful enough for most practical purposes.
It seems, C++ committee is well aware of the problem. That's why they are adding concepts in the new version. But just adding concepts without removing old ways is not going to make the language simpler.
> 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.
>
>
Templates are too generic answer to the challenge of generic programming.
Pattern matching, which is at heart of templates, is hard and more than occasionally confusing, not just to compilers, but to human readers as well.
More restrictive solutions to generic programming (e.g. generic facility of Ada) appear to be less confusing.
Less powerful, too, but powerful enough for most practical purposes.
It seems, C++ committee is well aware of the problem. That's why they are adding concepts in the new version. But just adding concepts without removing old ways is not going to make the language simpler.