On topic then, this is the first time I see Scala syntax and was somewhat pleasantly surprised (the only languages I really know are JavaScript and Python).
On slide http://monkey.org/~marius/talks/twittersystems/#16:
case class Stock(ticker: String, price: Double) {
def <(other: Stock) = price < other.price
}
val goog = Stock("GOOG", 675.15)
val aapl = Stock("AAPL", 604.00)
aapl < goog == true
goog < aapl == false
Correct me if I'm wrong but it seems to me that the class Stock gets a method called "<". So appl.< google (or the other way around) would also work. The previous slide also shows this, but the Stock example is makes it even clearer that "Scala is a pure object oriented language: every value is an object." appl and goog are objects, of type Stock, and < is an object, a method of Stock.I wonder if this kind of method would work
def ==(other: Stock) = price != other.price
and what would happen if it was like this def ==(other: Stock) = self != other
(where self would be a reference to the Stock instance, ala python, or this in javascript)and it was invoked like this
appl == goog
and return true