Replies: 5 comments 5 replies
-
Thanks for this interesting perspective! I have to say I almost completely disagree, but appreciate the feedback. From my perspective, the only reason to use this framework is that you prefer writing Rust to JavaScript, or have significant parts of business logic that are written in Rust or use Rust libraries. If anyone ever asks me, I'd always tell them that the best way to learn Rust is by learning Rust; in the same way that I'd say someone should learn JavaScript before learning how to use Svelte (a language that compiles to JavaScript) or React (a JavaScript library), they should learn Rust before learning how to use Leptos (a Rust library). I don't think it's that surprising that someone who doesn't have experience with Rust and looks at a Rust web framework for the first time would have questions about Rust syntax or semantics. I hope that this will be a framework that makes it easy for people who enjoy using the Rust programming language or are interested in learning it to make web apps and sites. If we ever live in a world in which people "learn Leptos" rather than "learning Rust" in the way that people now talk about "learning React" (and maybe even "learning Svelte"?) rather than "learning JavaScript," that will have been a failure on my part. I'm sure not everyone agrees with my opinion on this, and that's fine! |
Beta Was this translation helpful? Give feedback.
-
Hey I want to give a feedback from a perspective of a web developer (about 8 years od experience) who has never done Rust before. After one day of fighting with both Rust and Leptos I've resolved most of the problems and now I'm able to code without any interruptions or hiccups. So I disagree with the OP. It's fairly simple and if someone really wants to use Leptos (like me) they'll learn it quite fast. |
Beta Was this translation helpful? Give feedback.
-
I consider myself an intermediate Rust developer. But then came the difficulties Writing a closure with move, getters and setters on signals, made my raise an eyebrow. Seeing that the boxed value of a signal can be directly accessed but must be wrapped in a closure when you want to add +1 to it, made me a bit confused, but i figured this was probably an habit to get. Then discovering than to accept a derived signal, you have to use #[prop(into)]
progress: Signal<i32> began to make me start to ask myself "do i really want to do all this ceremony when defining the prop of a component ?" Going to the next paragraph and learning that for the component to accept an optionnal generic prop, you will have to use Box dyn and define the prop like this #[prop(optional)] progress:
Option<Box<dyn Fn() -> i32 + Send + Sync>> just made me close all windows and ragequit on the spot. This may be useful for some people, but for me, this feels like writing a webapp in C. Can probably be done, but not the first tool i would grab for the job. |
Beta Was this translation helpful? Give feedback.
-
Some context of my own. My team recently migrated from a modest React + PrimeReact + Typescript frontend (around 20k SLOC) and existing Rust http backend to fully Rust with Leptos. It took us about 2 months with 2 engineers I'm very comfortable with advanced Rust, my team has a more mixed experience and while there were some initial difficulties transitioning away from the flexibility of Typescript, the gains have been huge and well worth the pain of generics, closures, and all the "ceremony". I have had years of experience with traditional JavaScript frameworks with and without Typescript and I can attest that the time spent chasing down esoteric issues not related to rendering or logic has been as much, if not more time spent wrangling Rust types and pleasing the borrow checker/compiler. So no love lost there. However, the benefits of shared types between frontend and backend, fearless refactoring, excellent performance (lighthouse scores near 100 vs struggling to get above 70) and the ability to reason about my code through compile-time type abstractions far outweighs both the initial learning hurdles and the ongoing maintenance cost or faster iteration speed of traditional web frameworks. The recent changes to wasm code splitting and hot reloading go a long way to reducing those tradeoffs as well. I will grant that this situation isn't ideal for every team or company due to team dynamics, market forces for hiring talent, etc but for teams who have engineers who use or want to Rust and are willing to learn, it's worth it imo |
Beta Was this translation helpful? Give feedback.
-
This might be an opinionated take, but I don't consider
To be a good thing about a framework, and IMHO is why so many pieces of software (especially on the web) are prone to be slow, buggy or vulnerable to security attacks. Mastering a programming language shouldn't be a requirement to start using a framework, but it shouldn't hide critical details such that developers never learn skills required to build performant and stable software. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Having spent a considerable amount of time in web development, I've observed that frameworks like React (yes, it's a framework), Svelte, and others have done an excellent job of shifting the developer's focus away from mastering the underlying programming language. Instead, these frameworks encourage developers to concentrate on becoming proficient in using the framework itself. This is why many web developers are well-versed in these frameworks, but if you were to ask them to write plain JavaScript, they might find it quite challenging.
When I first encountered Leptos, despite being a Rust enthusiast, my initial impression was how much verbose it was compared to Svelte or React while accomplishing the same tasks.
When web developers hear about Rust and seek an example, they often turn to Leptos or another web framework in Rust. However, i assume they'll tend to have numerous questions when examining the code, unlike their experience with JavaScript frameworks. For instance, they might inquire about the following:
impl
=> which means you'll need to understand traitsmove
and what is the*
sign and is it necessary? => you'll have to understand borrowing and ownership|_|
=> you'll have to understand closuresAs you can see, getting started with Leptos requires a significant investment of time in learning Rust. In comparison, when using JavaScript frameworks like Svelte or React, all you need to grasp are basic programming concepts like functions and variable declarations, making the code appear less intimidating. If you follow the framework's conventions, you'll usually be in good shape.
We are already leveraging macros to abstract what's happening beneath the surface, such as view! or #[component] and I propose that we utilize even more macros (until the code resembles JavaScript to some extent 😆)
Beta Was this translation helpful? Give feedback.
All reactions