5 ms·
> You're still creating a bunch of objects. Unless you are a mashocist (...) you are still going to want to reuse methods between those objects. Aaaaaaand solu
by drapper 12y ago
> You're still creating a bunch of objects. Unless you are a mashocist (...) you are still going to want to reuse methods between those objects.
Aaaaaaand solution for that doesn't have to be a class (or something pretending to be a class), but for example a collection of functions/methods that you attach to an object, so you for example assign behaviour to data. This is something that Reginald Braithwaite for example advocates.
- taco_emoji 12y agoThat's called "composition over inheritance" and OO languages are perfectly capable of it.
- munificent 12y ago> a collection of functions/methods that you attach to an object Yes, that's what I meant when I said you have to design your own metaprogramming layer. You can do that. Just like you can invent your own class or prototype layer in C if you like. The question is "Is having to do that a compelling feature for the language?" Are user's metaprogramming needs so diverse that the language should punt this problem onto users? I don't see much evidence that this is the case. Most JavaScript libraries end up reinventing something that's within spitting distance of classes and single inheritance, maybe with a dash of mixins. All of that re-invention is a huge waste of engineer time.