|
|
|
|
|
by ironmagma
1925 days ago
|
|
In a systems context, where performance and memory ostensibly matter, why wouldn’t you want to be made aware of those inefficiencies? Sure, Go hides all that, but as a result it’s also possible to have memory leaks and spend extra time/memory on dynamic dispatch without being (fully) aware of it. |
|
But of course you want to use async and hyper and tokio and your favorite async db connection pool. And the moment you add `async` to the Handler type definition - well, welcome to what author was describing in the original blog post. You'll end up with something like this
plus type params with trait bounds infecting every method you want pass your handler to, think get, post, put, patch, etc. And for what reason? I mean, look at the definitions It would be reasonable to suggest that if the first one is flexible enough to be stored in a container without any fuss, then the second one should as well. As a user of the language, especially in the beginning, I do not want to know of and be penalized by all the crazy transformations that the compiler is doing behind the scene.And for the record, you can have memory leaks in Rust too. But that's besides the point.