Announcement

Collapse
No announcement yet.

Linus Torvalds' Initial Comment On Rust Code Prospects Within The Linux Kernel

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #81
    Originally posted by oleid View Post
    Rust is equipped even worse to deal with my code - all of it is around managing a dom tree structure - which a LibreOffice .ods file is all about:
    you have an office:body which has office:spreadsheet etc etc until you get to table:table-cell and almost all of them have parents, children, values and styles which might be shared across multiple nodes. To create a convenient api each of these types of nodes has to be a class and needs to call into other classes and modify them at any place in code. And so each of them has to have a &mut Arena instance - it's impossible to have it unless you wrap it in Rc<RefCell<>>. I mean Rc<RefCell> works if your code is reasonably small, but once it gets sophisticated (an .ods file needs like 60 types of classes that must interact/modify each other) - you can't design around not violating RefCell's aliased mutability rule at some point at runtime. I guess that's one of the reasons why Mozilla's rust WebRender's dom structure is gc managed by JavaScript.

    Comment


    • #82
      Originally posted by cl333r View Post
      Rust is equipped even worse to deal with my code - all of it is around managing a dom tree structure - which a LibreOffice .ods file is all about:
      https://github.com/tafia/calamine/bl...ter/src/ods.rs

      This is a ods file reader, but it would seem they don't use any tree structure here.

      But I guess you're more interested in a writer. Which reminds me at Xi editor. They use an immutable tree datastructure for text.

      https://github.com/xi-editor/xi-edit...pe/src/tree.rs


      Originally posted by cl333r View Post
      I guess that's one of the reasons why Mozilla's rust WebRender's dom structure is gc managed by JavaScript.
      As far as I've heard it is easier to keep the Dom in JS as JS expects it do be garbage collected.

      Comment


      • #83
        Originally posted by oleid View Post
        This is a ods file reader, but it would seem they don't use any tree structure here.
        But I guess you're more interested in a writer. Which reminds me at Xi editor. They use an immutable tree datastructure for text.
        As far as I've heard it is easier to keep the Dom in JS as JS expects it do be garbage collected.
        I was trying to reimplement my own C++/Qt5 project in Rust [1] and hoping it would be better but it's now clear Rust isn't suited for my case. Yeah, the calamine project isn't about CRUD an .ods file in a user friendly way (not even close).
        I would have used Swift but I looked at it yesterday and it's clear that Apple's support for Ubuntu is pretty much only on paper.


        [1] https://github.com/f35f22fan/QOds

        Comment

        Working...
        X