Hacker News new | ask | show | jobs
by emaringolo 1141 days ago
Many languages need constructors (and static methods) because the class is not an object.

In Smalltalk the class is the sole instance of another class (MetaClass), so a "static method" becomes a "class-side" method. And so it is inheritable.

The meta relationship is hard to understand (at first), but it is part of what causes the parsimony in all the interactions, and the "everything is an object". https://stackoverflow.com/questions/57898036/is-it-true-that...

Primitives (as in int, double, etc.) are a different subject, and although an Integer or a Smallinteger is a specially optimized object, it has the overhead of being an object (as in "Boxed" Integer in other languages), instead of some bytes at some memory location.

Most of the times you don't need the optimized version, and if were the case that you do, then it's when you optimize that piece of execution specifically (maybe making an external call to a more low-level, optimized version).