exceptions should be panics
you say so much about implementation inheritance and all that stuff. but every language is just extending or object or any or whatever. every languages is doing that. what about that.
i agree they provide a base. but also they are not just interfaces. they implements fns, methods on them. each class can override it if it wants. but thats the thing.
so here composing over inheritance, delegation over inheritance all that stuff is gone. huh?
but thats the thing everyone is an object. you can’t avoid this implementation inheritance?
thing is if we can’t, and we are using it and its solving such a thing. why its so bad. why its not used. whats the point in not using it. why its so bad.
other way to think of this is we constrained it. and in code we are not doing anything actually… its hidden or abstracted out.
one can also think of object as virtual thing. else instead of object. you take T. but you can’t create a method for each. so whats better way. take Object/Any.
it can be used as good but mostly it’s an abuse. it’s can be abused more easily than used for good.
also that any or object is a very streamlines example. esp since its constructor is empty. also since it contains no domain/businesses level logic. it contains language level logic.
also as i said, very streamlined, object does not have any state.
why composition over inheritance, delegation over inheritance came? cause, we wanted low coupling high cohesion.
with extends there too much coupling. you can’t change refactor a class, variable names cause downline thing might break. below classes are using internal details.
but same can be said for a object or any. but tbh, imo those are special cases and they are a language feature. and compiler make them. or you can say implements them for each type…
thats the only issue. java should have object as a interface than a class.
that’s what it got wrong… then everything would be solved.
ok got are saying common method. i am saying fine. it’s so abstract. call it abstract class.
rust got that right too. so good. any is a trait.
https://www.infoworld.com/article/2073649/why-extends-is-evil.html?page=2