|
Re: A Brief History of Scala
|
Posted: Jun 13, 2006 3:59 PM
|
|
> Scala is definitely an advance in the realm of the > "curly-bracket" languages. However, there are a number of > improvements or missed opportunities that I would like to > see in a modern language, some of which I consider more > fundamental to advances in language design than the typed > vs. untyped war. ... I sympathize with a lot of your comments. However, when designing a language you have to pick your goals, knowing that you can't have all desirables at the same time. For us, the overriding goal was compatibility with the Java/C# familiy of languages. Not because they are so great but because they are widely used and at the same time provide a decent foundation for more advanced designs. The C/C++ family seems harder to map to because implementations differ more and there is no standard garbage collector.
So most answers to your questions would be: Because Java does it that way and we did not want to alienate Java programmers by too many deviations.
Some comments are more fundamental however:
We use ::: instead of + for list concatenation because, ending in a colon, it's right associative. Also, if you want to use + for concatenation you could add it to the List class. You can even do that without touching the code of the List class, using an implicit conversion like the following:
class Plus[T](x: List[T]) {
def +(x: List[T]): List[T] = this ::: x
}
implicit def listsHavePlus[T](xs: List[T]) =
new Plus[T](xs)
[A question aside: How can I make code like the one above properly indented and highlighted according to Scala syntax? Right now it uses Java highlighting]
> 4. Making arrays properly generic is a good move. Java > needs to get rid of the "pseudo-object" array[] notation. > However, I'd like to see proper consideration and support > for array notation and semantics, rectangular arrays (not > just arrays of arrays), vectors (not the C++ but the > mathematical version arising from vector-spaces), > matrices, tensors, ... > Good point. But nobody prevents you from implementing multi-dimensional arrays in the library, as additional classes. I want to clearly state that while the language Scala is considered fairly complete, the same is not true for the libraries. We need more classes that support Scala and use its features, and we need your help in writing them!
> 5. OO programming is lot about structures, and their > relationships. Mathematics, esp. algebra, has a lot to > teach about that. So why do I never see language designers > provide a language where I can express well-defined > algebraic structures like groups, rings, fields properly. > This can be done using implicit parameters. Another topic for a future blog...
> Why aren't the basic types like integers expressed as an > implementation of a ring, double as a field. Where is the > field of complex numbers? > Again, this is possible, it only requires some library code using implicit conversions like the one I showed above.
> 7. Is there work planned to add Design-By-Contract to > Scala?
No concrete plans yet, but it's certainly an interesting avenue.
-- Martin
|
|