The Power of Lua and Mixins
notmagi.me
The Power of Lua and Mixins
1–10 of 25 posts
Re: The Power of Lua and Mixins
#2Re: The Power of Lua and Mixins
#3Re: The Power of Lua and Mixins
#4Given this background and my general coding experience up to now, I'm very skeptical about OO frameworks for Lua, because they mostly provide mechanisms that are neither true to the language's design nor are they really necessary. Specifically, mix-in patterns are extremely easy to implement just using core features already present.
Most languages work best if you don't try to forcefully adapt them to emulate another language. In my opinion, some of the worst features in both PHP and JavaScript come from a more or less hidden desire to mimic Java instead of being confident in the paradigms those languages already provide.
Lua already allows you to share code between "objects", and it allows you to do that with excellent granularity, simplicity, and a lot of control. There is no question that Lua is well-suited for modification and can be adapted for many things, but in this case I'm having trouble seeing the benefit (other than perhaps a programmer's familiarity with "standard" OO design which can be a considerable boon in the short term).
Re: The Power of Lua and Mixins
#5Animated pictures of a Jump'n'Run game make blog posts really hard to read. Might be related to the way human attention works, but well.
Re: The Power of Lua and Mixins
#6I've bee studying Lua very thoroughly recently because I'm working on a toy language based on its runtime, so I gained a certain appreciation for some of the concepts Lua uses. Given this background and my general coding experience up to now, I'm very skeptical about OO frameworks for Lua, because they mostly provide mechanisms that are neither true to the language's design nor are they really necessary. Specifically…
(I don't like his class style either, the constructor should return self, and I just like prototypal inheritance anyway).
Re: The Power of Lua and Mixins
#7I've bee studying Lua very thoroughly recently because I'm working on a toy language based on its runtime, so I gained a certain appreciation for some of the concepts Lua uses. Given this background and my general coding experience up to now, I'm very skeptical about OO frameworks for Lua, because they mostly provide mechanisms that are neither true to the language's design nor are they really necessary. Specifically…
Mixins are a useful mental model for some kinds of code reuse though. (I don't like his class style either, the constructor should return self, and I just like prototypal inheritance anyway).
They are, but I can think of at least one core feature-based solution to do the same thing with less overhead. Each mix-in or trait could easily be in its own table, to be joined with the object as it's being constructed in whatever fashion desirable.
Re: The Power of Lua and Mixins
#8Re: The Power of Lua and Mixins
#9Animated pictures of a Jump'n'Run game make blog posts really hard to read. Might be related to the way human attention works, but well.
i thought they made the abstract nature of a construct like mixins into something far more concrete.