This Would Be Just a Library in Scala
Posted under Scala ·Update: First in a series. Episode II is also available.
Scala’s flexible syntax, implicit conversions and powerful support for abstraction are extremely conducive to the implementation—as libraries—of useful software constructs and idioms that would normally need to be “baked in” to other languages.
Many of my cheeky pot shots at Project Coin are illustrative in a small way of this capability.
To illustrate further, I thought I’d start off by listing just a few of the well-liked features of other languages that have been implemented successfully as Just A Library In Scala:
Other Language | Feature | Scala |
---|---|---|
Erlang | Actor concurrency | Scala Actors |
(many) | Map Literals | Map("hi" -> true, "bye" -> false) |
(many) | List Literals | List("hi","there") or "hi" :: "there" :: Nil |
(various) | Automatic Resource Management | manage(stream) { stream.write… } |
Before you write to complain that any of the above has annoying syntax, please remember that It’s Just A Library, and if it bothers you enough, you can write your own.
- Wednesday March 11, 2009
- 2 Comments
- Previous Article
- Next Article
1 · Monis Iqbal · Fri Mar 27, 07:35 am
My only concern with this great great power is the emergence of humongous amount of libraries performing the works of well established frameworks. This is good, however a solid library is hard to write and manage and with this easiness everyone would try to create their own version without putting much into it.
2 · Alex Cruise · Fri Mar 27, 08:06 am
Monis, thanks for your comment.
First, I don’t think I implied that creating high-quality, easy-to-use libraries is easy in Scala, just that it’s possible to create Scala libraries that meet substantially the same requirements as other languages’ baked-in features.
And secondly, tomorrow’s world-changing framework often starts out as someone’s loose collection of convenient libraries—what’s the downside of having more libraries and frameworks to choose from? The “market” will weed out the bad ones.