----boundary-LibPST-iamunique-1274547453_-_-
Content-type: text/plain
> Any (normal) procedure may be
> activated by any"one", a method only by the owner, i. e. an object of the correct type.
There is no practical difference between o.Init and Module.Init( o ) because in order to perform the latter call one still has to have an object (o) of the correct type.
The only difference is the explicit appearance of Module in the second case, which I maintain only adds to clarity of the code.
> Of course you can avoid OOP alltogether and the code may even be more effective.
> But I believe encapsulation to be quite useful.
All this has nothing to do with encapsulation.
Coming back to your chain of three types A, B, C, inheriting from each other, A and B being ABSTRACT, and C being LIMITED, all defined (as you proposed) in separate modules (call them ModuleA, ModuleB and ModuleC).
Suppose instead of (extensible) methods like (a: A) Init() one has procedures like ModuleA.Init( a: A ), etc.
ModuleB.Init( b: B ) only has to make a proper call to ModuleA.Init -- and C does not need to know how B is implemented -- how it calls ModuleA.Init, etc.
A perfect encapsulation, so far as I can see.
If one inherites from the type B, one knows which module the type B is defined in (ModuleB), and one automatically has access to procedures in ModuleB.
So writing b.Init instead of ModuleB.Init( b ) hides exactly nothing, and only saves typing the module name.
Supercalls are completely superfluous and are replaced by calls to ordinary procedures.
To reiterate: a type one inherits from always belongs to some known module,
therefore one has access to the procedures in that module, including whatever initialization procedures one might need for hidden fields.
The situations you described all can be handled this way without a slightest damage to encapsulation.
PRO: a perfect transparency as to which exactly procedure is being called in each case.
CONTRA: some extra typing.
I see no practical problems -- dangerous or other -- introduced in the described scenario.
Erroneous calls like ModuleA.Init( b ) are equivalent to erroneous calls like b.Init^, so there is equivalence here too. Both are to be prevented in a similar fashion (by inserting a proper type test in (a: A) Init().
Cheers
Fyodor
Powered by the E-mail PIM - Info Select - www.miclog.com
--------------------------------------------
To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
blackbox-request{([at]})nowhere.xy
To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.
Send any problem reports or questions related to this email list to the list owner at
owner-blackbox{([at]})nowhere.xy
Current posting policy:
a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.
b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.
----boundary-LibPST-iamunique-1274547453_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwID4gQW55IChub3JtYWwpIHByb2NlZHVyZSBtYXkg
YmVccGFyDQo+IGFjdGl2YXRlZCBieSBhbnkib25lIiwgYSBtZXRob2Qgb25seSBieSB0aGUgb3du
ZXIsIGkuIGUuIGFuIG9iamVjdCBvZiB0aGUgY29ycmVjdCB0eXBlLlxwYXINClxwYXINClRoZXJl
IGlzIG5vIHByYWN0aWNhbCBkaWZmZXJlbmNlIGJldHdlZW4gby5Jbml0IGFuZCBNb2R1bGUuSW5p
dCggbyApIGJlY2F1c2UgaW4gb3JkZXIgdG8gcGVyZm9ybSB0aGUgbGF0dGVyIGNhbGwgb25lIHN0
aWxsIGhhcyB0byBoYXZlIGFuIG9iamVjdCAobykgb2YgdGhlIGNvcnJlY3QgdHlwZS5ccGFyDQpU
aGUgb25seSBkaWZmZXJlbmNlIGlzIHRoZSBleHBsaWNpdCBhcHBlYXJhbmNlIG9mIE1vZHVsZSBp
biB0aGUgc2Vjb25kIGNhc2UsIHdoaWNoIEkgbWFpbnRhaW4gb25seSB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