Have you ever wanted to define a default for a type parameter in Scala? Here's how:https://gist.github.com/propensive/8894fd2a58ac93bfa2c3 …
-
-
Replying to @propensive
@propensive hmm. this is clever and not obviously unethical ... trying to remember if I have ever wanted to do this.1 reply 0 retweets 1 like -
Replying to @tpolecat
@tpolecat@propensive not obviously ethical either if you ask me ;) I'm curious of the use case?5 replies 0 retweets 1 like -
Replying to @aloiscochard
@aloiscochard@tpolecat Sometimes we don't want to have to specify the type parameter, e.g. "extract a String unless I specify otherwise".1 reply 0 retweets 0 likes -
Replying to @propensive
@propensive@tpolecat do you have something really concrete, I mean a RealWorld(c) example? what that function you describe do?2 replies 0 retweets 0 likes -
Replying to @aloiscochard
@aloiscochard@tpolecat Yeah, exactly the example I gave, but extracting a parameter from an HTTP request, or from the command line...1 reply 0 retweets 0 likes -
Replying to @propensive
@propensive@tpolecat there is no good default for a HTTP parameter, `String` don't look like a good default to me, that should be inferred.1 reply 0 retweets 0 likes -
Replying to @aloiscochard
@aloiscochard@tpolecat Really? HTTP parameters are more String than any other type... because (unlike all other types) they *are* strings!3 replies 0 retweets 0 likes -
Replying to @propensive
@propensive@tpolecat I suppose my problem with that feature, is that it would simply not exists if scala had proper inference algo1 reply 0 retweets 0 likes
@aloiscochard @tpolecat I think that depends on what "proper" is. ;) I find the prioritisation rules complicated but useful all the time...
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.