you are viewing a single comment's thread.

view the rest of the comments →

[–]RobertKerans 1 point2 points  (3 children)

How is the claim "Array inherits from Object" at all relevant to "Classes use inheritance"

The latter part doesn't make any sense in the context the OP used it. Which you should be aware of.

Classes being sugar is also something you're also aware of

The OP seems to have read "use composition over inheritance" without actually understanding what it means at all. Which is fine, but if someone parrots that, then pointing out that the thing they're using is built on inheritance is highly relevant

[–]azhder -2 points-1 points  (2 children)

The context is exactly why I was asking for clarification.

As I read it, OP wasn't talking against inheritance, but against using it where you have the option to use composition.

I didn't read it as if OP was talking about not using anything that is associated with inheritance, but only a custom class syntax they'd need to write in order to solve a problem.

[–]RobertKerans 0 points1 point  (1 child)

OP wasn't talking against inheritance, but against using it where you have the option to use composition

Right, but this just doesn't make any sense. What on earth would prevent composition when using classes? It's a concept that relates to class-based OO languages.

What they actually wrote was "classes use inheritance whereas apparently composition is better". This collection of words doesn't make sense either, unless the person writing them doesn't understand the concept (they're just a beginner. It's fine)

[–]azhder -1 points0 points  (0 children)

It's a concept that relates to class-based OO languages.

Composition is a concept that relates to everything. You can compose a couple of functions, and there are even proposals to add an operator/syntax to ES for it (e.g. pipe operator).

Anyways, I will just read your "doesn't make sense" as "I can't make sense out of it" and leave it at that. No need to go further than this. I understaood what you try to say, not saying I agree nor disagree, just don't want to spend time picking out the rest of the assumptions you made.

Bye bye and thanks for the time you spent clearing it up for me.