Hacker News new | ask | show | jobs
by zohebv 5186 days ago
Scala is far more object oriented than Java. So + is a method of the Int object and you can write 2.+(3) instead of 2+3. Methods are allowed to be operators, so that you can write 2+3 instead of 2.+(3). If _ is a separate token it represents an unnamed parameter, no more no less. In your specific case some_obj open_! translates to some_obj.open_.! It is not too difficult, you are just at week 1 of Scala.

As for language comparisons

1. C is simple/readable

It is way better than C in terms of readability. All constructs in C are simple, but it takes a lot of C code to accomplish simple things. Also, how readable is while(<star>d++ = <star>s++);

2. Python is explicit

The advantage of Scala here is static typing and performance and much better IDE support. Python code typically looks cleaner than Scala code, but I have been told that closures in Python are less than perfect. Python OTOH has no build time issues.

3. Clojure is more functional

Clojure is not more or less functional than Scala. There are varying definitions of "functional"-ness. However, the gold standard of a functional programming language is widely recognized as Haskell. Scala is far closer to Haskell than Clojure in this respect. Again the significant difference between Clojure and Scala is static typing, not functional-ness.

1 comments

"There are varying definitions of "functional"-ness."

I wonder if there are varying definitions of "object-oriented"-ness.

Also, I hear clojure is a true scotsman while scala is not.

There certainly are varying definitions of "object-oriented"-ness, just contrast C++ and Smalltalk!
And then contrast Smalltalk with CLOS.

(CLOS is the Common Lisp Object System. If Smalltalk is more OO than C++, and I think most people see it that way, then CLOS is ... sideways OO than Smalltalk. It's not quite on the same spectrum, but it is still OO.)

Yes, OOP is not clearly defined: http://beza1e1.tuxen.de/articles/oop.html