• 4 Posts
  • 7 Comments
Joined 1 year ago
cake
Cake day: September 2nd, 2023

help-circle


  • I based my suggestion based on the logical requirement stated (first quote) which was later ignored (second quote).

    I know they call it a requirement, but it has the phrase “as little as possible.” If that were taken as broadly as it could be, it would not be written in Rust or C++, since, after all, there might be a standard library problem that takes Firefox and the crash reporter both down.

    The stated requirement is “don’t use Firefox’s code.” GTK is not Firefox’s code, and the code paths exercised by Firefox are going to be different than the ones exercised by this crash reporter. Besides, a lot of people use GNOME, XFCE, or LXDE: if GTK as a whole is borked, then you wouldn’t even be able to start Firefox under these environments, much less crash it.

    Also, they list other requirements, not just that one (it’s not a requirement if it uses words like “minimal,” because there’s no definite test to see if you’ve met the requirement or not; these are all desirables).

    • We want to minimize the use of external code: to improve crash reporter reliability (which is paramount), we want it to be as simple and auditable as possible.
    • Firefox vendors all dependencies in-tree, so we are hesitant to bring in large dependencies (GUI libraries are likely pretty sizable).
    • There are only a few third-party crates that provide a native OS look and feel (or actually use native GUI APIs): it’s desirable for the crash reporter to have a native feel to be familiar to users and take advantage of accessibility features.

    They downplay it in this list, but I’m pretty sure a11y is the biggest non-negotiable requirement, so Iced is out of the picture.

    Slint, on the other hand, is not a small library at all, and it only has full functionality if it pulls in Qt. There might not be a clear-cut, definite criteria for “minimize the use of external code,” but pulling in Qt definitely doesn’t count.








  • As much as I understand why Rustaceans don’t like classical inheritance, that’s only a minor factor in Rust not having support for it.

    Before 1.0, there was a project to solve Servo’s needs for inheritance. An important point about this is how it made the question of whether inheritance is good or not moot — Servo implements the DOM, and the DOM needs inheritance, end of story.

    • Servo uses a bunch of procedural macros to implement OOP, and so do other projects in similar positions (GNOME, PyO3, Windows…). Anything worth adding to Rust needs to be better than that.

    • Solving inheritance for Servo means it needs to be as fast as C++ (the Internals thread linked above is mostly about this requirement). It’s hard, because C++ doesn’t prevent things like object slicing, and a safe implementation of subclassing for Rust would need to (while still providing control over an object’s allocation like C++ does).

    • About object slicing: TFA describes inheritance as having a “hidden member variable” within a child class that’s an instance of the parent class. This is mostly how it works, but it’s important in trad OOP that the child class encapsulates the parent completely. For example, if you’re implementing the DOM and an HTMLTemplateElement wants to implement its own clone and adopt steps, there should not be any way to bypass them. Also, it should not be possible to get a reference &mut Node and use mem::replace with a non-template, since that would still be a way to violate the invariants those methods seek to enforce.

    • JS, Python, and WinRT are all substantially different. Covering all of them means the language features look less like a complete object system and more like a framework for building an object system.

    Note: it’s been a long time since I last made any meaningful contributions to Servo, and I never worked on the JS bridge code much. I’m reflecting the story as best I can. Please read the original Internals thread to get a deeper understanding of this, without creating a bad game of telephone.