Created
April 20, 2011 13:54
-
-
Save aturon/931391 to your computer and use it in GitHub Desktop.
Anonymous pimping in Scala (from http://www.decodified.com/scala/2010/12/02/the-quickpimp-pattern)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit def str2toInt(s: String): { def toInt: Int } = new { | |
def toInt: Int = java.lang.Integer.parseInt(s) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: "Support for structural types in Scala internally relies on reflection. This makes QuickPimps slower than their 'regular' siblings that are based on dedicated wrapper types."