On Mon, Feb 02, 2004 at 10:40:02AM +0100, Mirar @ Pike developers forum wrote:
Module variables can be modified, but are assumed to be constants at compile-time. Ie,
But they can't be modified (and accessed directly) _outside_, however.
See above. Modules are just there to give namespace. If you really want to do this (and have a global object), you need a query method to get the global object every time.
It is more logical (IMHO, of course) to access some "global" (i.e. defined in module) variable by using syntax like Module.var, rather than Module.var() - which is a bit misleading. Also, it would be nice to have possibility to _modify_ such variable simply by using Module.var = "value", but it seems that language doesn't allow such accesses.
And, according to your explanation, _anything_ that is defined in module is a constant, which is different to declaration (and to class declaration as well).
There is no use in accessing variables in modules from outside the module.
Why not? I can access variables in objects, and module is an object, or?
Well, I know that it is good practice - to access object's internals through methods, but again... Syntax... Something like "properties" (which was discussed some time ago) would solve this problem...
Sometimes I hate to use `->() and `->=() to define only few "properties" (this looks confusing to anyone who is not familiar with Pike).
Regards, /Al