[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Why OO in Lua is a hard sell
- From: Dirk Laurie <dirk.laurie@...>
- Date: Sun, 24 Nov 2013 15:38:54 +0200
2013/11/24 John Hind <john.hind@zen.co.uk>:
> I realise OO is a hard sell in some quarters
Lua, unlike most other languages, fully exposes the metatable.
That allows each user to roll his own mixture, subtly different
from the next user's. Given the maverick attitude that Lua
programmers already tend to have, there is just no way to
get us to agree that any one object-oriented method is best.
I like your approach of the class name being a constructor.
It allows me, by suitable upfronting, to load either a function,
a callable table, or a callable userdata that can do "Table",
"Set", "List", etc. and keep the rest of the code the same.
No way, of course, that a maverick like me is going to agree
to using your implementations of them :-)