[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua Needs
- From: Coda Highland <chighland@...>
- Date: Mon, 26 Nov 2018 16:31:06 -0600
On Mon, Nov 26, 2018 at 6:58 AM Egor Skriptunoff
> On Mon, Nov 26, 2018 at 1:30 PM Soni "They/Them" L. wrote:
>> >> - Lua has little to no support for composition-based OOP
>> > Can you give an example of what you would want here?
>> The classic Cratera `foo:[component].method()` (note the colon) syntax.
> What OOP languages do support this "composition-based OOP" ?
it that way but its ability to do dynamic function rebinding would
make it POSSIBLE to do it there (I just don't know anyone that
The syntax isn't usually that pretty, though. Python's the only one I
know of off the top of my head that can make it look that clean. In C#
it looks more like foo.GetComponent<Component>().Method().
Lua actually can pull it off with foo[component]:method() if you have
foo's __index metamethod return a binding object, but that comes at
the cost of a fair amount of overhead relative to the syntax patch.