…And we’re back with another exciting round of Project Wallet, formerly known as WBJUS!
- Multline Strings (note the date)
- Use "package" to indicate default visibility
- “Elvis” operator? Well, you could do that… or you could use Option instead and worry less about NPEs.
- Import Aliases (third example)
- Lightweight Properties? There are a variety of friendly-syntax ways of simulating properties in Scala, but they’re not declarative enough. I feel like something like this is needed in Scala too.
- “This” type? Someone points out that you can use self-referential type parameters to do the same thing, which of course Scala supports.
- Static method in interfaces? It’s debatable whether this is even desirable, but there’s no direct analog in Scala. However, you can have singletons that don’t suck or "interfaces" that have method implementations. Take your pick!
- Fold keyword? sigh — with closures, so many language features don’t need to be language features.
- Multiple switch expressions and case ranges? Scala’s pattern matching and tuples make “multiple expressions” trivial, but for ranges, you have a completely general solution: pattern guards (e.g. case n: Int if n >= 1 && n <= 5)
- And finally, “Simplified Varags Method Invocation”. In Java, T… is sugar for T[], and Java arrays are not subject to type erasure. In Scala, T* is sugar for Seq[T], and the T is erased, so it’s safe.
Why “Project Wallet”? Well, why settle for a handful of coins?
- Friday March 6, 2009
- 3 Comments
- Previous Article
- Next Article
1 · logicallygenius · Sun Mar 8, 01:30 am
Lets hope there are events in Scala like VB 6 had, instead of the cryptic actionlisteners in Java,
2 · Alex Cruise · Sun Mar 8, 06:01 am
logicallygenius,
Please have a look at the scala-swing examples to see one take on how “events” can be used in Scala—and note that scala-swing is just a library.
When your language has the right features, you don’t need language features. :)
3 · Alex Cruise · Mon Mar 9, 05:24 am
I forgot to point out the scala-swing examples (ch. 32 & 33) from Programming in Scala.