trait SmartJsonNumberParsing { val doubleRe = """.*\..*""".r scala.util.parsing.json.JSON.perThreadNumberParser = { n : String => n match { case doubleRe() => BigDecimal(n) case int => BigInt(n) }} }
Chapter X. In which our her0 enters waters of åNdroid (but not only) development while fulfilling his destiny which will never be known to anyone including those who's supposed to know it but for reason of their non-existence you're not reading this aren't you question mark.
Friday, June 11, 2010
just use this one if you need per-thread smart(produces ints if can) parsing of json numbers:
Thursday, June 10, 2010
functional programming
Meanwhile "folding" is awesome. If you're from the non-functional-programming background, like me - learn one. Really blows mind as OO used to in the good ol' days.
blogging is about complaining isnt'it?
And here I come, ma.
Scala is a beautiful language which compiles to JVM's or CLR's byte code. Cool? Cool. But it also means that it inherits all the ... little things from those VMs. And Java's biggest thingy I know so far is type erasure.
Compatibility with old code? Great. Support code for win3.1 apps in XP? Perfect idea for marketing dept.
Before getting out of home, check your winkdoodle, because 400 years ago someone didn't and got bitten by the dog. It was huge.
Well, they run XP code in VM on Vista-shmista these days, okay, an option. What do we have in java these days?
Scala is a beautiful language which compiles to JVM's or CLR's byte code. Cool? Cool. But it also means that it inherits all the ... little things from those VMs. And Java's biggest thingy I know so far is type erasure.
Compatibility with old code? Great. Support code for win3.1 apps in XP? Perfect idea for marketing dept.
Before getting out of home, check your winkdoodle, because 400 years ago someone didn't and got bitten by the dog. It was huge.
Well, they run XP code in VM on Vista-shmista these days, okay, an option. What do we have in java these days?
scala> List[Pair[String, Any]]("a" -> 2) match { case (h :: t) if h.isInstanceOf[Pair[Int, Any]] => "match!" case emp => "nada" }And those people disallow me picking in nose and call that language type safe? Yeah! Way to go for the backward compatibility!:6: warning: non variable type-argument Int in type (Int, Any) is unchecked since it is eliminated by erasure List[Pair[String, Any]]("a" -> 2) match { case (h :: t) if h.isInstanceOf[Pair[Int, Any]] => "match!" case emp => "nada" } ^ res1: java.lang.String = match!
Saturday, June 5, 2010
even though results seem to look same, refactoring is joy of getting things right, migration is pure pain in the ass of just making it work.
Subscribe to:
Posts (Atom)