News for hackers. Stuff that matters.
Re:Seed – A Rust front-end framework for creating fast and r... by jbandela1 on Friday September 17, 2021 @02:17PM (#28569002)
Kudos to the author for making this framework.

I am using this for my personal project: https://www.biblemaze.com which is a Bible trivia game.

Here are some things I like about Seed:

1. The Elm architecture seems to flow nicely in Rust.

2. The way of defining the elements on the page is more Rust like rather than html like. I initially tried Yew which is another similar framework, but since I am a more backend developer, I found writing in a more Rust style more comfortable than writing in a more html-like dsl. Other with different experiences may be more comfortable with more html-like syntax.

3. Very easy to perform REST API calls. I am using Actix for the backend, and I have a shared library that declares the types which both the backend and frontend use. This is one big advantage for using Rust for both backend and frontend, in that you never have to worry about your types getting out of sync.

4. In general as to why Rust for the front end, apart for being able to share types, for more complex algorithms, for me, having a compiled language with an emphasis on safety and that tries to ensure correctness as much as compile time (and especially pattern matching) makes writing complex code more enjoyable for me.

5. Excellent documentation on the Seed website. There are lots of examples and walkthroughs of basics as well as examples of how to do stuff like integrate with Javascript libraries.

Anyway, thanks again to the authors for making and supporting such an awesome library.

Re:Seed – A Rust front-end framework for creating fast and r... by rictic on Friday September 17, 2021 @04:00PM (#28570259)
- This is one big advantage for using Rust for both backend and frontend, in that you never have to worry about your types getting out of sync.

One thing to be aware of here, you may have users with stale clients after deploying an update to the server. e.g. picture someone who leaves a tab open for a week and then comes back to it and interacts with your app some more without refreshing.

Text based serializations will tend to be more forgiving of changes in the RPC schema (in the sense of erroring out when required fields are missing), while more compact serializations are more likely to incorrectly decode a message when they should fail.

Re:Seed – A Rust front-end framework for creating fast and r... by mdtusz on Friday September 17, 2021 @05:40PM (#28571218)
The quick and dirty solution to this is to have a client response handler that checks for a header set on responses to ensure its a compatible version, then prompt a page refresh if not.
Re:Seed – A Rust front-end framework for creating fast and r... by dgb23 on Friday September 17, 2021 @07:51PM (#28572171)
At this point, I feel like this is the most consistent way. There are notable web apps that do this. There are plenty of good reasons for this, including caching and service workers.

It feels dirty because you’re not handling these issues silently. But it’s explicit, clear and it enables a consistent and performant experience.

Re:Seed – A Rust front-end framework for creating fast and r... by bonestormii_ on Friday September 17, 2021 @08:50PM (#28572552)
I wish more people thought this way about computing.
Re:Seed – A Rust front-end framework for creating fast and r... by cwp on Friday September 17, 2021 @10:03PM (#28572902)
An equally-quick but not-at-all-dirty version of this is to use the Accept header and do content negotiation. There is a solution to this exact problem in the HTTP spec.
Re:Seed – A Rust front-end framework for creating fast and r... by jbandela1 on Friday September 17, 2021 @05:40PM (#28571221)
One thing you can do in the shared library is to have a version number constant that is always passed in the rpc. That way if the client is stale, it can easily be detected, and you only have to change 1 place when you update the shared structs.
Re:Seed – A Rust front-end framework for creating fast and r... by da39a3ee on Friday September 17, 2021 @11:10PM (#28573298)
> This is one big advantage for using Rust for both backend and frontend, in that you never have to worry about your types getting out of sync.

Of course this is a hack compared to Rust BE and FE, but I’ve been finding that auto-generating Typescript type definitions from a Pydantic (Python) API works pretty nicely. Of course, what’s going on under the hood there is all a lot uglier than a beautiful modern compiler with an expressive modern type system, but it’s cool that it works.

Re:Seed – A Rust front-end framework for creating fast and r... by the__alchemist on Saturday September 18, 2021 @12:14AM (#28573654)
When I learned of Pydantic, my first thought was "This is a lot like Serde in Rust".
Re:Seed – A Rust front-end framework for creating fast and r... by metadaemon on Friday September 17, 2021 @03:40PM (#28570069)
Very fun! Is it possible to remove the '-' symbols once a new path has begun? They were blocking previous paths, which also may be the point.
Re:Seed – A Rust front-end framework for creating fast and r... by jbandela1 on Friday September 17, 2021 @03:53PM (#28570209)
Thank you. It seems this is in reference to my game. If so, please contact me on my email (in my profile) so we can discuss further in detail.
Re:Seed – A Rust front-end framework for creating fast and r... by metadaemon on Friday September 17, 2021 @04:37PM (#28570629)
It's not a big deal, thanks.