Live data from Hacker News

Actix: a small, pragmatic, and fast Rust web framework

actix.rs

121–125 of 125 posts

Re: Actix: a small, pragmatic, and fast Rust web framework

#121
post #45

Earlier quoted context omitted.

Agreed. Good site. This is an aside, and I sincerely apologize for that, but I am compelled... I'm reading the greeting/hello-world example on this nice site and I notice unwrap_or(). That is a poor name: can it panic, as suggested by the "unwrap" part (I have just enough Rust to know that,) or can it not, as suggested by the "or" part? The name is inherently ambiguous! It's as if the .unwrap() that is festooned thro…

For prefixes, unwrap mean Option -> T while or means Option -> Option [0]. For suffixes, "else" means executable code (a closure). > > It's as if the .unwrap() that is festooned throughout such example Rust code has become so ubiquitous that someone felt it had to be used and so tacked on "_or". Why couldn't it just be .or() or perhaps .default()? Because Rust doesn't have function overloading and thus you'd be missi…

>> Because Rust doesn't have function overloading

That is the insight I needed. Thank you.

Rust seems novel in that despite having powerful abstractions and a rigorous type system it does not support overloaded functions. I gather from some of the discussions about it that this design decision greatly simplifies the compiler implementation; supporting function overloading would necessitate answering several very tough questions such as whether a function can be overloaded on argument lifetime.

So the Rust standard library has established conventions (in this case 'unwrap', 'else' and or 'combined' in various ways) to deal with the permutations that naturally emerge given the lack of function overloading. It's important understand this and inculcate these conventions, particularly when designing interfaces for use by others.

Re: Actix: a small, pragmatic, and fast Rust web framework

#122

Earlier quoted context omitted.

For prefixes, unwrap mean Option -> T while or means Option -> Option [0]. For suffixes, "else" means executable code (a closure). > > It's as if the .unwrap() that is festooned throughout such example Rust code has become so ubiquitous that someone felt it had to be used and so tacked on "_or". Why couldn't it just be .or() or perhaps .default()? Because Rust doesn't have function overloading and thus you'd be missi…

>> Because Rust doesn't have function overloading That is the insight I needed. Thank you. Rust seems novel in that despite having powerful abstractions and a rigorous type system it does not support overloaded functions. I gather from some of the discussions about it that this design decision greatly simplifies the compiler implementation; supporting function overloading would necessitate answering several very toug…

> Rust seems novel in that despite having powerful abstractions and a rigorous type system it does not support overloaded functions.

Neither Haskell nor ML (incl. its children) have function overloading.

Re: Actix: a small, pragmatic, and fast Rust web framework

#123
post #119
post #111

Earlier quoted context omitted.

What is the use case ? Is there simple examples one could go through?

Usually you return a closure with impl Fn. Another use case is to return an iterator. I wrote a post about it. Let me know if it helps. https://medium.com/@iopguy/impl-trait-in-rust-explanation-ef...

Your code is nothing but Magic . I have spent time trying to wrap my head around it. I am almost there but I don't understand .map(::into) . Monoid implements String

Re: Actix: a small, pragmatic, and fast Rust web framework

#125
post #123
post #119

Earlier quoted context omitted.

Usually you return a closure with impl Fn. Another use case is to return an iterator. I wrote a post about it. Let me know if it helps. https://medium.com/@iopguy/impl-trait-in-rust-explanation-ef...

Your code is nothing but Magic . I have spent time trying to wrap my head around it. I am almost there but I don't understand .map( ::into) . Monoid implements String

Finally, that code is itched in my brain
Post reply on HN