Class extension (dot syntax for new methods)

BlitzMax Forums/BlitzMax Programming/Class extension (dot syntax for new methods)

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Err, what? Of course there is. What is "Modserver.Module.Type.ExtendedMethod" then ?

Modserver.module.type.Method references a method DEFINED IN THE MODULE SOURCE CODE, so it can't have any duplicated, and that way the module is always compatible with any other module, even if any other module has classes with the same name, and the same methods and the like.

Adding the possibility to add methods from another module breaks this rule. How would a extended method be considered part of the original class? Don't you see that we would be adding false methods to the original BaseModServer.BaseModule.BaseClass ? If we do that, the problem stated before is there. Problems at compile time. two or more modules could be adding the same method to a base class, and with the same namespace BaseModServer.BaseModule.BaseClass.ExtendedMethod. Obviously you could state that the extended methods could mantain the namespace of the module where they are created, and from where they are extending the original base class, but that would definitively make code even less clear and would break all the logic of a correct namespacing.