[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: eoo.lua: OO in 5 lines of code
- From: Eduardo Ochs <eduardoochs@...>
- Date: Sun, 12 Sep 2021 08:04:05 -0300
Hello list,
I have just finished rewroting the documentation of eoo.lua, that is a
very minimalistic implementation of OO in Lua in just 5 lines of code.
Its code is just this, except for some functions that I only use very
rarely:
Class = {
type = "Class",
__call = function (class, o) return setmetatable(o, class) end,
}
setmetatable(Class, Class)
Most people will probably think that this has too few features to be
useful to them, but the diagrams in the documentation are very nice,
and can be adapted to other implementations of OO too (I guess).
It is here:
http://angg.twu.net/LUA/eoo.lua.html
http://angg.twu.net/LUA/eoo.lua
Cheers,
Eduardo Ochs
http://angg.twu.net/
http://angg.twu.net/luaforth.html