creating a new module as an extention of another module
I'm now using lua 5.1 and migrating my previous package system ('hack'
describes in pil 5.0) to this lua version.
I think it's now very clean with this new package module system but I
have a question on how to do a module
that is an extension of an another module?
--file : rule.lua
function and(r1,r2) ... end
function or(r1,r2) ... end
suppose now you want to extend the previous module with to have a
function notUnary(r1) ... end
the question is finally how to push all function of module rule into the
module completeRule. In a way, it's like inheritance for class.
I think I have already seen such mecanism in Ocaml.
Someone as an idea? or is it to basic to ask the question (I'm a newbie
concerning the packaging system)?
> Someone as an idea? or is it to basic to ask the question (I'm a
> newbie concerning the packaging system)?
I guess we all are, as it's brand new :)
Tomas posted some code recently showing how it could be done:
> I would like to add that if you want some inheritance, you
> use the second argument of `module()' to achieve an elegant solution.
> local obj = require"obj"
> module ("myobj", obj:inherit())