• 28 Posts
  • 290 Comments
Joined 3 years ago
cake
Cake day: April 27th, 2023

help-circle

  • I think that’s quite harsh. As I said, I know it’s not what OP asked and it was just a suggestion. I’m just adding it as an option. Perhaps someone else reading the thread will find it useful, if not OP (who I don’t think you should speak for).

    OP mentioned they want native speed and were struggling with badly documented libraries. I feel like it was appropriate to at least mention Rust, considering those two things. Since when is widening a discussion slightly considered bad? You don’t have to reply to my comment either, if my comment does not seem interesting to you. Let alone downvote it. You can just leave it alone, it doesn’t hurt anyone.



  • I know it’s not really what you’re asking, but have you considered learning Rust? In many ways, Rust is more similar to C than C++ and is just as capable. There are quite a few very well documented (as is common in the Rust ecosystem) Rust libraries for GUIs, including efficient native ones or immediate mode ones and such. Just a suggestion.


  • I think you’re misunderstanding the never type. The never type is not a hack at all. It’s a very natural part of the type system. Just as you have the unit type (), which is the canonical type with only 1 value, you also have the never type, the canonical type with 0 values.

    This is extremely useful in generic code. See my other comment in this thread.

    This is an unfortunate wart to appease a desire to those that want to be able to write code like they do in legacy languages

    What do you mean with this? I can’t really decipher it. What alternative to the never type would you want?


  • shouldn’t Rust enforce returning from function

    This is impossible. How would you enforce that? What prevents a function from panicking, aborting the whole process or just going into an infinite loop? All these things correspond to the never type.

    I think you’re misunderstanding what the never type is. It’s not equivalent to None at all. It’s a type that doesn’t have any values. This is useful in situations with generic code where for example an error type can be chosen as the never type. Then you could destructure or unwrap a Result without handling the error, cause the type system guarantees the error never occurs.

    I think you should read up on the never type a bit more. It’s a perfectly natural part of the type system. In fact you can make your own very easily: enum Never {}




  • Eh rust still has issues in some domains, e.g., when cyclic data is appropriate

    This might be but then again I’ve been writing Rust for several years and have yet to actually run into this problem. The borrow checker definitely places certain restrictions on what kind of stuff you can do (for good reasons!). Once you know how it works, your brain starts writing the code in advance to fit how the borrow checker likes it and it becomes second nature and a total non issue.

    Of course this is part of the reason Rust has a bit of a learning curve, which is fair. But any good sophisticated tool meant for professionals requires proper training and knowledge.


  • Eh, as funny as this is, I can’t agree that programming peaked with Java. In fact, much of this is just a rant about JavaScript, not about much else.

    VSCode can easily do cross-file renames if you write Rust. Rust is kind of peak programming if you ask me, and it’s modern and still new. I don’t feel programming has peaked yet tbh.




  • Really not a fan of this approach. Makes the order of operations extremely weird. I would much prefer having super blocks that are explicitly inserted in the above scope. I.e. this:

    tokio::task::spawn(async move {
        do_something_else_with(
            super { self.some_a.clone() },
            super { self.some_a.clone() },
            super { self.some_a.clone() },
        )
    });
    

    Would desugar to:

    tokio::task::spawn({
        let first_block = { self.some_a.clone() };
        let second_block = { self.some_a.clone() };
        let third_block = { self.some_a.clone() };
        async move {
            do_something_else_with(
                first_block,
                second_block,
                third_block,
            )
        }
    });
    

    Only problem is if the clone is inside another block… but perhaps you could do super super { ... }? But that sort of gets crazy and makes it very hard to read again.







  • I want a way to clearly express durations in terms of days

    The argument here is that expressing durations in terms of days is a bad idea because “day” does not really convey a very precise duration, as it is not always 24 hours.

    Maybe you won’t be confused by Duration::from_days right now, but maybe a junior dev before they get their coffee, or even the senior dev on code review might miss stuff like that.


  • I mean, it says what it is right there in the second sentence on the page, to be fair:

    Welcome back to another Dioxus release! Dioxus (dye • ox • us) is a framework for building cross-platform apps in Rust. We make it easy to ship full-stack web, desktop, and mobile apps with a single codebase.

    It’s not like the context was very far away 😅


  • Personally very intrigued by Dioxus. I posted this thread the other day about frontend and I can’t help but be drawn by the possibility of not having to learn a JS/TS framework and instead go with a Rust framework. But at the same time, Dioxus is still very much behind on the ecosystem side because it doesn’t have access to all the libraries and tools and support and online help that popular JS/TS frameworks do. So I’m sort of conflicted. Being a frontrunner comes at a cost sometimes 😅

    Only thing I actually don’t care much about with Dioxus is the fullstack premise. I’m not much for the fullstack idea. I think there is value in separating the backend and frontend. I feel like in principle it should be possible for many frontends to exist for a single backend. I feel the fullstack approach makes the backend and frontend too coupled and it would probably be hard to write a different frontend for the backend.