"I have a mind like a steel... uh... thingy." Patrick Logan's weblog.

Search This Blog


Friday, January 04, 2008

Scala Buzzzzings

All the buzz about Scala again, suddenly.

Via Stefan Tilkov, from Doug Pardee...

I’d long felt that combining a powerful static type system with functional coding would be almost ideal. Now that it’s been done—and done quite well—I find that it’s “not all that” after all.

The documentation is weak... A book is in the works... I haven’t read any of it, but I don’t have much hope...

I’ve already discussed the complexity of its type system... But with Scala’s abstract types, a variable or parameter or whatever can be declared to be of a type that is defined somewhere in the inheritance tree… and not just superclasses, it could be defined in a subclass as well, including the possibility of an anonymous subclass. And since Scala allows classes to be defined darned near anywhere, tracking down all of the possibilities is not fun...

def sum(l: List[int]): int = (0/:l){_+_} Isn’t that lovely?

I agree with Doug's complaint about weak, out of date information. But I have the current book draft and have read a good deal of it already. The book seems a good place to start to learn functional programming, especially for someone with Java or C# experience. There are some good introductory books for Haskell as well, and this books seems about as good. Unfortunately about twice the size as the Haskell books, though, as this book attempts to explain most of the Scala language, while the Haskell introductions I've been through do not cover all of Haskell.

I've written several times already how I am at best unused to thinking with more modern function type systems. This dynamic language programmer is used to sending messages to objects and applying any number of any kind of argument to a function without a darn compiler insisting that it must have a valid type theory for what's bounding around in my head.

As for that stretch of Scala syntax above, I do think sometimes Scala, like Haskell, goes way over the top with its cute, concise notation. I can handle this ok, since I am used to the concepts like "fold left" and "fold right". If your a Smalltalker, think "inject:into:". Then once those little bits of syntax can be translated into a familiar vocabulary, it's not so bad. But not great for beginners, I'd agree.

No comments:

Blog Archive

About Me