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

Forgive my ignorance, but what is wrong with static class members?



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.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: