gracelessfailures.blogspot.com
Graceless Failures: Scala RichString is not comparable to String
http://gracelessfailures.blogspot.com/2008/10/scala-richstring-is-not-comparable-to.html
Learning Scala. The hard way. October 24, 2008. Scala RichString is not comparable to String. Val r: scala.runtime.RichString = "1". Val s: String = "1". If (r = s) {. If (s = r) {. This isn't as sad as:. Which would precipitate Robey's "ultimate sadness". I got into this state by adding a .drop to a String, and chaos resulted. The details are tangentally described in: http:/ www.nabble.com/String-and-RichString-equality-td14888607.html. October 25, 2008 4:17 AM. Subscribe to: Post Comments (Atom).
gracelessfailures.blogspot.com
Graceless Failures: October 2008
http://gracelessfailures.blogspot.com/2008_10_01_archive.html
Learning Scala. The hard way. October 24, 2008. Scala RichString is not comparable to String. Val r: scala.runtime.RichString = "1". Val s: String = "1". If (r = s) {. If (s = r) {. This isn't as sad as:. Which would precipitate Robey's "ultimate sadness". I got into this state by adding a .drop to a String, and chaos resulted. The details are tangentally described in: http:/ www.nabble.com/String-and-RichString-equality-td14888607.html. Links to this post. October 13, 2008. Res1: Boolean = true.
gracelessfailures.blogspot.com
Graceless Failures: Pattern Guards fooled by null
http://gracelessfailures.blogspot.com/2008/12/pattern-guards-fooled-by-null.html
Learning Scala. The hard way. December 4, 2008. Pattern Guards fooled by null. Pattern guards don't handle nulls well, and, also, introducing a pattern guard appears to make a default not match on null values:. Scala def guard fails(s: String) {. Case s: String if s = null = println("null"). Case s: String if s! Null = println("s=" s). At sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method). At sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39). Case s: String if s!
gracelessfailures.blogspot.com
Graceless Failures: Parser surprise
http://gracelessfailures.blogspot.com/2009/05/parser-surprise.html
Learning Scala. The hard way. May 13, 2009. 1toString saz " error: ';' expected but '.' found.". Need to use (-1).toString. Posted by David Vydra. In -1 is not part of the (numeric) literal, but an operator. There is another example of a surprising situation that results from Scala's "everything is an operator" in Programming in Scala, which I read just yesterday as I revised a few chapters, but I couldn't find it. I think chapter 5. May 13, 2009 12:18 PM. May 14, 2009 2:04 AM. Leaving out the dot works:.
gracelessfailures.blogspot.com
Graceless Failures: May 2009
http://gracelessfailures.blogspot.com/2009_05_01_archive.html
Learning Scala. The hard way. May 13, 2009. 1toString saz " error: ';' expected but '.' found.". Need to use (-1).toString. Posted by David Vydra. Links to this post. Subscribe to: Posts (Atom). A group blog of tips, tricks, missteps, and minor revelations on the path to Scala.
gracelessfailures.blogspot.com
Graceless Failures: July 2008
http://gracelessfailures.blogspot.com/2008_07_01_archive.html
Learning Scala. The hard way. July 28, 2008. One useful thing if you're spending a lot of time interfacing with Java from Scala is renaming imports. I use scala ArrayLists and java.util.ArrayList a lot. Here's an easy way to not get confused:. Import java.util.{ArrayList = JArrayList}. Links to this post. July 27, 2008. Testing in Scala using a Java tool. And SUnit (built into the Scala distribution). And as Scala is "just Java" you can also use Java frameworks such as JUnit and TestNG. Having only u...
gracelessfailures.blogspot.com
Graceless Failures: November 2009
http://gracelessfailures.blogspot.com/2009_11_01_archive.html
Learning Scala. The hard way. November 24, 2009. This site now lives at http:/ gracelessfailures.com/. I mean, it always has, but now it's hosted on another blogging platform. The posts made it over there, but the comments didn't. Old content will live here on Blogspot for posterity. Posted by Alex Payne. Links to this post. Subscribe to: Posts (Atom). A group blog of tips, tricks, missteps, and minor revelations on the path to Scala.
gracelessfailures.blogspot.com
Graceless Failures: Confused by cons
http://gracelessfailures.blogspot.com/2009/01/confused-by-cons.html
Learning Scala. The hard way. January 19, 2009. While learning how to use lists:. Val oneTwo = List(1, 2). Val threeFour = List(3, 4). Val oneTwoThreeFour = oneTwo : threeFour / forgot one ":", I really meant to ": :" (concatenate). Val filteredList = oneTwoThreeFour.filter(n = n 1). Error:Error:line (16)error: value is not a member of scala.this.Any. Val l2 = oneTwoThreeFour.filter(n = n 1). Commenting out the offending line and replacing it with. OneTwoThreeFour List(List(1, 2), 3, 4). Fun sum nil i = i.
gracelessfailures.blogspot.com
Graceless Failures: NumberFormatException
http://gracelessfailures.blogspot.com/2008/10/numberformatexception.html
Learning Scala. The hard way. October 13, 2008. Res1: Boolean = true. That's pretty cool. Does it work for "false" too? Res1: Boolean = false. How does it handle other values, I wonder? Javalang.NumberFormatException: For input string: "1". This comment has been removed by the author. October 13, 2008 9:58 PM. Private def parseBoolean(s: String): Boolean =. Null) s.toLowerCase match {. Case true = true. Case false = false. Case = throw new NumberFormatException("For input string: " s " " ). It is not C&#...