Hacker News new | past | comments | ask | show | jobs | submit login

Scala remains ahead of Clojure because it permits traditional OO. OO is wonderful; try writing some programs in a language that forces you to do proper OO (e.g. Smalltalk). Even if you ultimately decide you prefer non-OO, you'll learn techniques that make your programs better, and you'll at least be able to understand the thing you're criticising.



> OO is wonderful; try writing some programs in a language that forces you to do proper OO (e.g. Smalltalk).

Have you tried implementing a numeric tower with proper OO in Smalltalk? Would you describe the experience as wonderful and the program as beautiful? Rinse and repeat for any other problem that requires simultaneous pattern matching on several values.

I do think Smalltalk's style of single-receiver message passing is a sweet spot for structuring many kinds of programs.


> Have you tried implementing a numeric tower with proper OO in Smalltalk?

The number of languages that I've seen with a proper numeric tower that aren't Scheme (or direct descendants of Scheme like Racket) are zero, so "OO makes it hard to do something almost no one ever does"...?

> Rinse and repeat for any other problem that requires simultaneous pattern matching on several values.

No problem requires pattern matching, much less on several values, any more than a problem requires OOP. Pattern matching and OOP are idioms that can be used to solve problems, but they are never the exclusive idiom that can be used to solve a problem (though either might be the only one that a particular language provides.)


> The number of languages that I've seen with a proper numeric tower that aren't Scheme (or direct descendants of Scheme like Racket) are zero, so "OO makes it hard to do something almost no one ever does"...?

It doesn't have to be an elaborate Scheme or Common Lisp numeric tower. I mean any kind of lattice ("X and Y gives Z") that would normally be implemented with case analysis. Especially if that lattice has symmetries (e.g. commutativity).

> No problem requires pattern matching, much less on several values

Of course, but I think you know what I mean. Take any of the standard problems that are not amenable to natural forms of cascaded single dispatch. Pattern matching has its own limitations, but sometimes it's the right tool for the job.


Pattern matching is overused in Scala, dispatch also works well via trait flexible compositions, which also provide a Wadler compliant solution to the extension/expression problem. But I guess it is a question of taste: Martin's 1000+ line mega match, or my 100 trait solution.


Scala does have more support for OO than Clojure with traits, case classes and pattern matching, and generics but Clojure does have enough support for OO for basic service creation. See https://github.com/gengstrand/clojure-news-feed as an example where Clojure's defprotocol, defrecord, defmulti, and defmethod are used to implement a basic CRUD style RESTful API for 4 entities in about 300 lines of code.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

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

Search: