[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua Needs
- From: "Soni L." <fakedme@...>
- Date: Tue, 27 Nov 2018 07:42:24 -0200
On Mon, Nov 26, 2018 at 8:51 PM Soni L. <email@example.com> wrote:
> Suggestion: Don't assume (or use) inheritance. Or at least don't mix inheritance with components.
> Rust has traits, which are somewhat similar to components, but it doesn't have inheritance. That's because mixing traits/components and inheritance is, at best, messy.
So on the one hand, you're completely right. Traits are a much better
model for this than inheritance, and mixing traits and inheritance can
indeed get quite messy.
But on the other hand, that still leaves the matter of "what's the
best way to implement traits in Lua?" as a question to be discussed.
Sorry, uh, is it okay if I ask what you mean by that?
I mean, I was specifically saying these shouldn't be a thing:
foo:thing.other.more.why() -> foo.thing.other.more.why(foo)
foo.thing.other.more:why() -> the ability to use self.super.super.super to access foo
Mostly because they look nothing like traits, but also because they look like some weird attempt at inheritance?