Hacker News new | ask | show | jobs
by insanitybit 959 days ago
> not allow rust for essentially the same reasons he disallowed C++,

Unless what he disliked was the inheritance/OOP stuff in C++, which isn't an issue in Rust.

1 comments

Rust has its own flavour of OOP, only data inheritance isn't part of the picture.

Interfaces/traits, dynamic dispatch, static dispatch, encapsulation, polymorphism, traits inheritance, is all there.

Additionally macro system as powerful as Common Lisp, which allows to do stuff that would make Linus blowup on the spot.

> Rust has its own flavour of OOP, only data inheritance isn't part of the picture.

I think it's fair to say that Rust is a lot less 'OOP' than C++. There is no concept of 'protected', traits are separate from structs, there's no data inheritance, there's no 'isinstance', dynamic dispatch is explicitly behind 'dyn' keyword, etc.

> Additionally macro system as powerful as Common Lisp,

It's not like the Linux kernel doesn't make use of C's macros.

There is no "less" or "more" OOP as per CS definition.

Plain textual text replacement isn't the same as a proper macro system.

Abusing inheritance of virtual methods instead of interfaces (which makes classes closed to extension, and the possibility of overriding non-zero methods is nothing short of weird), and implicit "this" parameter (which makes stuff needlessly hard to read and refactor), are two of the biggest annoyances on my list -- because they are so basic.
Well, you can enjoy explicit this parameter in C++23, if that is your thing.

As for the complaints, they are kind of doable in Rust as well.

Use traits with function pointers, empty types, and some macros.