Archive for October, 2007
Pattern Matching
Hm, I’m kind of starting to notice a repeating pattern in writing Scala code. It’s a very simple pattern: after the size of a source file reaches some notable size (like 100 lines or so, corresponding to some 500 lines of Java — or 5000, while at it…) I’m spending more time admiring the existing code than actually writing more of it. :) (… just being bluntly honest.) (Certainly, this has never happened with Java, in case you were thinking.) But, I’m still living the initial crush, so I must beg your forgiveness for my utter narcissism❣
Plus, beer & listening to Antony and the Johnsons may have something to do with this. Life’s good at times.
(And hey, despite the slacking, I’m still 250% more productive compared to Java; although, that figure is probably something like 1k due to increased happiness. (Non-leaky) Abstractions rule.)
I am very happy
So please hit me
I am very very happy
So come on hurt meI’ll grow back like a Starfish
I’ll grow back like a Starfish
I’ll grow back like a Starfish
I’ll grow back like a Starfish
— in “Cripple and the Starfish”
XO link-local
Peter notes in his presentation Jabber, the Real-Time Internet, and You [via] that the XO-1 (OLPC) uses XMPP for link-local messaging. I could of course state something like way cool!, but that would only implicate that it was something unexpected, which it definitely isn’t. Reasonable options are getting slim, fortunately! :)
Unstable identifier
In case you had missed this teeny bit of Scala spec [v2.6, 8.1.4 Stable Identifier Patterns]:
Example 8.1.2 Consider the following function definition:
def f(x: Int, y: Int) = x match {
case y => …
}Here, y is a variable pattern, which matches any value. If we wanted to turn the pattern into a stable identifier pattern, this can be achieved as follows:
def f(x: Int, y: Int) = x match {
case ‘y‘ => …
}Now, the pattern matches the y parameter of the enclosing function f. That is, the match succeeds only if the x argument and the y argument of f are equal.
And, a little earlier:
A variable pattern x is a simple identifier which starts with a lower case letter.
I was trying to match a type with a lowercase name and it took me a moment to figure out why it didn’t work.. :)
Btw., I don’t like this syntax-by-convention a bit, and it was a major surprise to bump into such here (with Scala, that is). I guess I need to question this at the forum.
Update (a better look): Ok, backquoting an id is an established syntax for denoting a stable identifier. Oh so novice for not knowing. But still, “identifier which starts with a lower case letter”.
Tags: Scala
Exit strategy
If you want to get acquired by Google, use python. :)
My Musical Taste
Joined Jaiku
Eventually. Contacts welcome.
The IM interface is the killerest, thanks guys. It feels like the way Jaiku should be used, 140 char input really doesn’t need a web page.
Update 10/09: And at the very last time: Jaiku got bought by Google, and they’re invite-only currently.
Congratulations, guys! That’s awesome!
Facebook the spam attracter
Duh! The morons of stalkbook printed out my Jabber address in plain text, which naturally is the same as my personal email address. (And my phone number, if I just managed to collect myself and configure Asterisk; PBXes didn’t let you use your own domain last time I checked.)

(Fixed it already.)
ps. spammers would be unbelievably stupid not to use some very simple OCR to read addresses out of those pics…




