Hi Wishy,
with new module API it seems like there is no any obligation to register intermodule function, we only have to call 'GetModuleInstance()' function which returns an instance of any installed && active module and all methods of this module are accesible from now. But - why You don't use passing by refererence? (I am talking about function 'GetModuleInstance()' from /lib/classes/class.module.inc.php) Is it a feature? In this case I can have many independent instances of one module object in one time, and it may be unwanted situation if i want to change any data or 'state' of module object - this change will be not projected to other instances...
Am I correct, or did I miss something?
Intermodule functions
Intermodule functions
To be perfectly honest, i didn't that far into it. I just assumed that situations where people would use the intramodule functions would be only need them passed normally. I don't think it would be a bad thing passing by reference, but because modules don't really keep state, I still can't think of a very good reason where it would help... maybe just because it would take less memory to pass by ref?
Intermodule functions
Yes, memory optimization is one important argument, but not last. In case there is more then one module with dependency on other module, it will be more then 'useful' - one dependent module can change state of 'root' module and other dependent module can not get those changes in this time - it will be working with its own copy of module object...wishy wrote:..., but because modules don't really keep state...
maybe just because it would take less memory to pass by ref?

Excuse me for my impertinence


Intermodule functions
Yeah, you make a lot of sense as to why pass-by-ref is more valuable. I think I'm going to update that now. Thanks.
Intermodule functions
I'm glad to help, thanks for Your time
BTW, creating new instances (resp. copying existed into new variable) of db-connection of gCms object in all functions which needs db-connectivity is also unnecessary. I don't know how much memory is allocated for every AdoDB object, but CPU time wasted by this operation (creation copy of initialized complex object) is also important - not in case small website, I agree
And another thing: what about file 'lib/module.functions.php'? Has it any purpose in version 0.9?

BTW, creating new instances (resp. copying existed into new variable) of db-connection of gCms object in all functions which needs db-connectivity is also unnecessary. I don't know how much memory is allocated for every AdoDB object, but CPU time wasted by this operation (creation copy of initialized complex object) is also important - not in case small website, I agree

Intermodule functions
That's a good point. Maybe it would be a good idea to make GetConnection functions, along with some others for things like config and variables.
As for module.functions.php, it's only real purpose at the moment is to handle the rendering and smarty processing for moduleinterface.php. At some point, I'll probably get index.php and moduleinterface.php to use to the same rendering functions, but not before 0.9 comes out, that's for sure.
As for module.functions.php, it's only real purpose at the moment is to handle the rendering and smarty processing for moduleinterface.php. At some point, I'll probably get index.php and moduleinterface.php to use to the same rendering functions, but not before 0.9 comes out, that's for sure.