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

classes != objects

Yes, the typing and semantic models are wildly different. The point is that they’re primitive in a way that the other widespread alternative, C++, did not inherit from its Cfront heritage.






> classes != objects

that's what I was aiming at, maybe poorly.

There's tons of libraries that use some kind of runtime-observable instance property as a tag, to mimic nominal typing in JS.

The same thing is also possible using prototype identity, if you either use the class keyword syntax sugar introduced with ES5 (?), or if you manually do OOP using prototypes. But the latter is very uncommon.

It seems to be more common to add a property like

  $_$_$____superlib__$-inst_WALRUS
and use that as a tag.



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: