design questions an oop library lua
i implemented little oop library lua, twin things definitely right yet. i need your advice!
how super()?
i need choice. 3 arguments i need solve super() are:
- the category where being finished (callerclass)
- the instance upheld (self)
- the name slight (method)
i halt between 3 forms:
--# tide way:
self:super(callerclass):method()
--# variant, i cleaner:
callerclass:super(self):method()
--# python style, good too:
super(callerclass, self):method()
which looks nicer easier remember you?
do i need category symbol?
in tide version, wholly visualisation list named object
, subclass. i have another chronicle where i introduced category symbol.
its tell instances classes. i.e. :
assert(object:iskindof(class))
local vigilant = object:new()
assert(not object:iskindof(class))
i unequivocally permitted request make slight contingency called class, starting slight with:
assert(self:iskindof(class))
is usefull lua? think? thanks!
Comments
Post a Comment