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

I don't know any theoretical explanation, but I try explain it.

You see static String.Split and normal method Split of String objects.

First method does not belong to string objects, it belongs to String class.

String class is an object itself, so why not make this distinction more explicit?

It exactly so in Scala: classes are classes and all static members goes to companion objects. Companion objects by nature are singletones.

I think it's much more natural this way than in C++/Java/C#. Everything on its place, even singletones became elegant.




Applications are open for YC Winter 2020

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

Search: