Hacker News new | past | comments | ask | show | jobs | submit login

I have a app that have been ported from old python -> f# -> rust (e-commerce like) and the transition was great (https://www.reddit.com/r/rust/comments/hh9tz6/does_rust_have...).

You need to pay attention in how align the whole software stack. Pairing Rust with tailwinds and htmx or Hotwire simplify so much stuff is like cheating.

For regular CRUD flows having enums/traits/iterators make domain modeling very good and found is more productive to me than F#/Python at the domain layer.

I do my own micro SQL-orm layer (I have the need to talk to +6 RDBMS and be dynamic at runtime), and most db libraries in the rust ecosystem are mature enough now.

I find recently the whole auth is not as mature as you find with Django (aka: Not need to code part of it, you can certainly do it manually), but anyway is now better to offload to key cloak or similar.




Could you comment a bit more on how Rust let you model the domain better than F# did?


The thing with F# is that (idiomatic) models/functions rely on type inference, and eventually is hard to see what is the flow without look at the IDE. Rust making type annotations explicit with minimal inference is much clearer.

Also, the fact I can do mutation + imperative code locally yet give a functional feel make some hacks around this on F# unnecessary.

But probably the biggest thing is that Rust make idiomatic things like conversions with From/Into/AsRef/etc instead of rely in your own conventions, making code more readable in the long run.

Other source of simplification is serde. A lot of my stuff is transfer/(re)encoding of data and have a "de facto" idiom for this help a lot.

One thing that F# make far easier and I miss much is the sequences (https://docs.microsoft.com/en-us/dotnet/fsharp/language-refe...). Making iterators is boilerplate and wish Rust have generators in stable.

I found a decent library for this in https://lib.rs/crates/genawaiter but is not the same as have it in-build.


Admittedly I work for a very opinionated team - we even have our own style guidelines (https://github.com/G-Research/fsharp-formatting-conventions) which are often in direct contradiction to Microsoft's, and my team strongly skews towards writing explicit type annotations on all function signatures. I can certainly see how there would be a problem if one defaulted to omitting type annotations.


Can you share a bit about how you’ve integrated Hotwire with Rust? I recently wondered how well they’d pair.


I use htmx, just pointing Hotwire will be similar.

With this kind of library, your rust code is the same as processing regular html forms, is only the HTML that need to be annotated.

MAYBE you could optimize partial rendering detecting just the portion to change:

https://htmx.org/docs/#requests

But I not bother with that.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: