We should learn more from Go and Erlang.
I hope the Tide will do.
61–70 of 91 posts
We should learn more from Go and Erlang.
I hope the Tide will do.
I hope the Tide will do.
I am truly moved by what this small (probably one, maybe two person?) team has accomplished here. Just look at their code and its organization, while noting how languages like Rust, Nim, and Go show us how to tackle the software complexity in various software domains. Having been in the enterprise field for a handful of decades, I am convinced that work such as this is signaling a brave new world of software developm…
While you're correct it's becoming more of the rule, this has been true a for a very long time. Clayton Christen wrote about this in 1997 with "The Innovator's Dilemma". He believed it was still repeatable in large organizations via 'intrapreneurship', which I'm not convinced is entirely true... considering the enterprises continued obsession with middle management and hierarchy, and top-down R&D.
Is anyone able to lay out some of the reasons why you might want to write web applications in rust? I was under the impression rust was designed as a safer language for low level systems programming. Thanks!
Earlier quoted context omitted.
FYI: This is Rocket, a web framework for Rust, not Racket, the programming language.
Ah my bad, assume we have to use a nightly build then?
I've never tried Rust or Rocket, but it appears to be gaining popularity, so I have the following questions for existing users: What's it like to work with? Do you prefer it to JS/PHP/Python for web related projects? Can you iterate on code quickly, or is there a compile step on every iteration? Are there stable libraries for interacting with MySQL/Redis/Postgres asynchronously? Is there good IDE support, for example…
> What's it like to work with? Do you prefer it to JS/PHP/Python for web related projects? Of the popular frameworks in languages you mention, Rocket is fairly close to Flask in terms of feel. Rust is a typed language and Rocket uses code generation and function's type signatures to automatically check the incoming parameters. This can be fairly simple, like verifying+converting a param to a number. It can be fairly…
That said, it really depends on what you're doing. If you are debugging something, it can be a bit painful but not terrible (typically, you're just changing a few things as you go along). If you're implementing a feature or refactoring, you're better served using "cargo check" (especially in combination with "cargo watch") to only run typechecking but not code generation, which means extremely fast feedback.
Earlier quoted context omitted.
It's a bit rough to work with still - the IDE support is still a work in progress (though improving) and there is a compile step with every iteration (incremental compilation has improved this too). Diesel is the main library for interacting with SQL databases, it wasn't async last time I used it, and a quick web search tells me it still isn't - this has been a BIG problem with Rust over the last year, as everyone wa…
Isn't diesel being sync largely hid behind a connection/thread pool? Generally you want to limit the connections to the database anyway, so a connection pool is desirable...
I've never tried Rust or Rocket, but it appears to be gaining popularity, so I have the following questions for existing users: What's it like to work with? Do you prefer it to JS/PHP/Python for web related projects? Can you iterate on code quickly, or is there a compile step on every iteration? Are there stable libraries for interacting with MySQL/Redis/Postgres asynchronously? Is there good IDE support, for example…
I've bumped around a site idea I've been working on for five years now. I started with Flask, then Django, then felt bad about page load times so I looked for something faster. That basically made me shelf it for about two years, until last year when Rocket was rising and I gave it a shot. Got hung up again that year due to missing expressiveness in query handling and shelved it again. In the last month I picked it b…
That is what expected the least, when I was starting out. I was looking for something that is a little like Python, but faster than it. It gives me a sense of security to see the compiler call me out for a reason, telling me exactly which cases I forgot. Together with the type system I often find myself in situation where I do something quite complicated (for my experience) and then I am at a point where I am confident it works, I `cargo run` the whole thing and it works like a charm.
In Python a lot of things would run, but also broken things. Having it run was no guarantee at all it won't end up in a convoluted traceback later. In Rust having it run is a great part of the deal, I rarely encountered Panics afterwards, and when I encountered them it was me willfully defining where I would encounter them.
The weird thing is: because it takes much more to just get a program that compiles – even if you're lazy you end up with a higher code quality. It won't let you take some shortcuts that will haunt you later and that is a good thing.
Earlier quoted context omitted.
I'm really eager to push for use of rocket (and thus rust) at work, but while rocket being on version 0.x it probably is a tough sell. The benefits rocket (at least seems to) bring feels obvious and I notice every now and then at work that "hey, this would be so easy to do with rocket".
> benefits rocket (at least seems to) bring feels obvious Sorry I am not a webdev. Curious what these are compared to something like RoR.
Here are couple of examples (didn't test them, but they should illustrate the point):
// Simple with admin user.
#[get("/admin")]
fn admin(user: AdminUser) -> String {
// Request is made as admin user.
format!("Allowed.")
}
#[get("/admin"), rank = 2]
fn admin(user: User) -> String {
// Request is made as a normal user.
format!("Not allowed!")
}
#[get("/admin"), rank = 3]
fn admin(user: AnonymousUser) -> String {
// Request is made as a anonymous user.
format!("Please login.")
}
// More flexable, with permissions.
#[get("/article//edit")]
fn aritcle_edit(permission: PermissionEditContent, article_id: u64) -> String {
// Request is made with a user that has the correct permission.
format!("Allowed.")
}
#[get("/article//edit"), rank = 2]
fn aritcle_edit(article_id: u64) -> String {
// Request is made with a user that doesn't have the correct permission.
format!("Not allowed!")
}
// Or in single handler.
#[get("/article//edit")]
fn aritcle_edit(permission: Option, article_id: u64) -> String {
if permissions.is_some() {
format!("Allowed.")
} else {
format!("Not allowed!")
}
}
This is just one of the nice things that rocket brings. To know more, the guide is really good source: https://rocket.rs/v0.4/guide/.