- About Scala
- In the Enterprise
- Scala Community
- Language Research
- In the Press
- The Scala Team
- Scala's Prehistory
- Contact Us
- Learning Scala
- Tour of Scala
- Scala API
- Setup & Getting Started
- Programming Guides
- Other Guides
- Code Examples
- Scala Developers
planned type system enhancements
after 10+ years of using statically typed languages and not having a clue why anyone would use dynamic types because all you get is code you can't maintain, i finally understood one big advantage of dynamic typing (thanks to clojure which was an eye opener).
in java, you force the caller of a method to use an instance of type X - even if you only need a small fraction of X's methods or fields. if you have a big class that can do a lot or provides a lot of information, that class will appear virtually anywhere even though only parts of it are accessed.
in clojure, instead of "i need type x" you say "i need something that is compatible to type x" where type x might never be explicily declared and only exists in the programmers mind and at runtime.
scala has structural types for that, but clojure's destructuring is more powerful. it works on maps, arrays and classes and i won't have to worry about what is given to my function.
the absense of a type system also makes things like
createmap(key, value, key2, value2... keyN, valueN) possible. no typesystem i know of can be told to make sure the number of parameters is _ % 2 == 0. of course you can always cheat by using tuples or method overloading for every possible parameter count up to 2*n but the most simple solution in this case is to just skip the static types.
so i wonder, what are the improvements planned for the next scala releases?