Is the Scala type system too complicated?

Home

News: Is the Scala type system too complicated?

  1. Is the Scala type system too complicated? (12 messages)

    It’s precious when Java developers start complaining about how complicated the type system is in Scala. After all, it wasn’t until Java 5 came out that developers working with a JVM were given the opportunity to stop pulling lazy Objects out of the collections API and subsequently casting them into their respective types. What’s worse, given the outrageous number of organizations living on Java 1.4.2, not to mention the lazy and unmotivated old guard who refuse to properly type their code, it’s not uncommon to find an enterprise development project where nobody’s even heard of a ‘for-each’ loop.

    This is why it always seems so disingenuous when Java fanboys start complaining about Scala’s type system. “Oh, it’s too hard. Oh, it’s too complicated.” The fact is, it’s not. It’s only too complicated when you’re coming from a language like Java, which treats proper typing like a second-class citizen.

    The other day, TheServerSide had the opportunity to speak with Josh Suereth (@jsuereth) the author of Scala In Depth, a Senior Software developer at Typesafe, and a man that is passionate about both the Java and Scala programming languages. Is the type system in Java too complicated? Josh sets the record straight.

    The Scala Type System: Is it too complicated for Java programmers


    Follow Cameron McKenzie on Twitter (@potemcam)


    Recommended Titles

    Josh Suereth's Scala in Depth on Amazon.com
    Martin Odersky Programming in Scala
    Cay S. Horstmann's Scala for the Impatient
    Martijn Verburg's The Well-Grounded Java Developer

     

  2. I have news for you. Scala's type system IS too complicated, and it's getting worse all the time. Quick, what's the difference between:

    1. Nil
    2. None
    3. Null
    4. null
    5. Nothing
    6. Option[Null]

    Oh, and why all this mess with nestable Options that doesn't allow automatic 'unpacking'?...

    Then we get to functional type, including existential types, type inference and all other nice stuff. It's getting to the point where heavily templated C++ seems easy in comparison.

    And btw, all this type goodness gets erasured during the compilation.

  3. On the call...[ Go to top ]

    I think I need you lurking on the call the next time I talk to one of these Scala guys. :)

     

     

  4. On the call...[ Go to top ]

    Just imagine this conversation taking place on TSS

    https://github.com/twitter/bijection/issues/41

  5. Java has stayed so pulular for almost 20 yrs now is because of control and checks the language and compilers have built in. 

    Scala is trying to be best of scripting languages as wlell as a false notion of being highly typed like java and the above example of "nil, null, null" is a good exmaple of what a mess it is. 

    You may want to add to your stupid collection of empty-indicators ..."Nada, nada, zip, ZIP". 

  6. taking a leaf from the cloud the new "null" is one of many options including:

    • Maybe
    • Eventually
    • SometimeInTheNearFuture
    • InSomeParallelUniverse
    • GodKnowsWhenAndWhat
    • WhateverYouWantItToBeExceptForBijection

     

     

  7. taking a leaf from the cloud the new "null" is one of many options including:

    • Maybe
    • Eventually
    • SometimeInTheNearFuture
    • InSomeParallelUniverse
    • GodKnowsWhenAndWhat
    • WhateverYouWantItToBeExceptForBijection

     

    You forgott "AlmostEmpty" ;-)

  8. I don't think it' very complicated. All those things are for different situations. If you've understood the difference it becomes very simple and clear. Someone could say Java is too complicated because it has int, and, double, and char, and float etc. when it could have just String.

  9. Someone could say Java is too complicated because it has int, and, double, and char, and float etc. when it could have just String.

    Only a complete bafoon would say that int, double, char and float should be handled as String, and would be better advised to take up another career path.

  10. Only a complete bafoon would say that int, double, char and float should be handled as String, and would be better advised to take up another career path.

    I hope you realize how ironic your statement is, considering that you all made yourself look like complete bafoons for jumping on that "OMG, Scala has Nil, None, Nothing and Null!!!!!!!!!!!!!!!!1" train.

    If you thought that this would make you look witty and intelligent, let me tell you that you have utterly failed.

    I can only suggest that you honor your own advice, which you have seem to given out so freely to others.

  11. Only a complete bafoon would say that int, double, char and float should be handled as String, and would be better advised to take up another career path.

    I hope you realize how ironic your statement is, considering that you all made yourself look like complete bafoons for jumping on that "OMG, Scala has Nil, None, Nothing and Null!!!!!!!!!!!!!!!!1" train.

    What has his/her answer got to do with Nil,None,Nothing,Null ??? Answer : nothing. He/she was simply replying to a strange remark that some people would find anything "too complicated" and only be up to handling Strings everywhere, whereas anyone with a simple grounding in programming would know that basic mathematical operations involving floating point numbers would be impossible there (so 'such people' would indeed have little career path)

  12. Only a complete bafoon would say that int, double, char and float should be handled as String, and would be better advised to take up another career path.

    You will be surprised but there actually exist programming languages (or I'd better say programming environments) where essentially all objects are strings, list of strings or some structures of strings. And it's perfectly possible to implement quite complex applictions there (including math operations of course). People that have programmed there might wonder what all those int, float etc. in Java are for.

     

    What I wanted to say is that if someone finds something complicated and unnecessary it does not mean it is really complicated. Many new ideas are considered complicated and unnecessary first, and then become common knowledge. Just don't consider your own opinion the only possible one.

  13. Since when ?[ Go to top ]

     

    That's your problem Al Le. An int, double, char, and a float. is NOT a string.