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

i used scala for a few months. it sounded very promising, java without the verbosity. but in the end i decided to stop using it.

The biggest problem for me was readabilty. Scala is the first language that i've learned where at first i couldn't just read code and immediately guess what it does.

I think the prime reason for this is that scala permits operator overloading; more than that, in fact, almost every character can be an identifier. This results in often very cryptic code and libraries, because you can't guess what that function does without reading its definition. quick, what's the difference between +++ and ::: ? what's /: and /:\ ? You can't even google it!

The other big problem for me was the type system. At first it sounded really great, and in fact the amount of compile-time code verification that you can achieve is indeed impressive. But in practice, i found myself fighting with the type system a lot, for example when trying to reuse a function with generic type restrictions that I had't written: some time these can get very long and your only choice is to copy-paste them from the original definition.

Also, how do you test that your type constraints are correct? you can't, by definition, write compilable code that would invalidate them.

Finally, it turns out that a lot of the bad stuff that's in java ends up in scala also, because of runtime compatibility concerns. in particular, scala's generics are an extension of java's. so, for example, almost all generic type information is lost at runtime, except for some extra metadata that scala stores in the object. this results in pretty ugly code when you have a dynamic object and you need to use it with a generic method.




>I think the prime reason for this is that scala permits operator overloading; more than that, in fact, almost every character can be an identifier.

I've been toying with the idea of trying scala for a serious project for a few months, and this part scares me. It's so obviously a bad idea it makes me wonder what other dumb things are in there.


Scala doesn't permit operator overloading, it doesn't even have operators.


Well, that's true, technically. But can't you name your functions things like "++"?


Yes. Because Scala doesn't make up random rules about how you name your methods.

If you name your method addAll or ++ is pretty much the same. The same rules apply to both. Both can be called the same way:

    coll1.addAll(coll2)        coll1.++(coll2)
    coll1 addAll coll2         coll1 ++ coll2


Those "random rules" make the code base much easier to read. This kind of thing is a big step backwards for people working on large projects, especially people who need to come up to speed on a large code base.




Applications are open for YC Winter 2019

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

Search: