-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
My feeling of the present state of things here is that closures are being used excessively, in ways that don't add value. For example, the closure-taking constructor and sort-of-setter methods feel weird. Taking the main function of the README example:
fn main() {
let app = do Application::new |app|
{
do app.settings |settings| {
settings.socket = Some(SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: 4000 })
}
do app.routes |routes| {
routes.get(~"/foo/(?<id>.*)", hello_world);
routes.post(~"/", hello_post);
}
};
let server = WidmannServer::new(app);
server.serve_forever();
}It seems to me that that would be much nicer like this:
fn main() {
let app = do Application::new();
app.settings.socket = Some(SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: 4000 });
app.routes.get(~"/foo/(?<id>.*)", hello_world);
app.routes.post(~"/", hello_post);
let server = WidmannServer::new(app);
server.serve_forever();
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels