Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

No.

That was my tongue-in-cheek remark about C++. Using a subset of C++ is exactly the same argument people have been making for years. The problem with that line of thought is that you're never working only with your own code (that, and the fact that Scala is not optimized for your subset).

That's the bad thing with a language born out of lots of compromises -- while initially a pragmatic choice, if it's popular it only grows uglier and uglier until it becomes the bottleneck of the industry.

If you don't believe me that Scala is ugly, try explaining a "Hello World" to a beginner that was never exposed to programming, taking the sample out of the official documentation, preferably without resorting to a cargo-cult style explanation of "just do this".

Here, I'll get you started:

   object HelloWorld {
     def main(args: Array[String]) {
       println("Hello, world!")
     }
   }
You have to explain -- (1) what are functions + (2) what are those singleton objects, with OOP sprinkled in between + (3) why functions have to be declared inside classes or singleton objects + (4) what are generic types + (5) the "main" entry point.

Compare this to the Python version:

    print "Hello world"
Or the Haskell version:

    main = putStrLn "Hello, World!"
Both of which only require an explanation of functions + the main entry point in the Haskell case. Yeah, the Scala version does more - that's the problem with ugly, it cannot scale from simple to complex easily.


I think we're talking past each other. First, I'm talking about capabilities, not aesthetics. Also not on the list of things I'm discussing: teach-ability.

Second, you asked for Java+1 ... then you post a code snippet that's pretty much exactly that, and tear it to ribbons. Let's be consistent.

On scaling from simple to complex:

There's a wide variety of techniques used to create abstractions, which (speaking generally) is how to tackle complexity. (Modules, OO, message passing, functional abstractions...)

On this front, Scala is remarkably uncompromising: The language designers have chosen to provide as many of those techniques as possible (and even add a new one or two of their own along the way).

Maybe that's overkill for scaling from simple to complex -- but I can tell you it's incredible for scaling from complex to really complex.


I think the only thing your hello world example proves is that hello world examples don't really demonstrate the overall complexity of programming languages very well, especially when you try to use it to say Haskell is easier to explain. Sure the Haskell version of Hello World looks simple but, once you get even a little beyond that example you start having to explain MUCH more complicated subjects such as currying, monads, functors, typeclasses, etc. Don't get me wrong I love Haskell but it certainly isn't easier to learn then Scala even if the syntax is less verbose. I don't really get your argument that Scala code does not scale to solve complex problems; I would actually argue that Scala does that very well. Now I will agree that some aspect of Scala syntax are ugly but overall it seems to do an okay job unifying object oriented and functional programming while remaining accesible.


That's a very contrived example which certainly falls apart in Haskell as soon as you do anything relatively complex (Python I would agree is a perfect language for learning to program).

I think it's also safe to assume that one of Scala's design goals was to make it accessible to Java developers, not beginning programmers.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: