Re: eliminate EXTENSIBLE types?
----boundary-LibPST-iamunique-1167639339_-_-
Content-type: text/plain
On Sun, 03 Oct 2004 17:36:26 +0400, Fyodor Tkachov
<fyodor.tkachov{([at]})nowhere.xy
> why not use simple procedures (not methods) instead of initialization
> methods which you'd like to invoke as supercalls?
> The only objection I see is a somewhat more verbose code (module names
> have to be called) -- but then there can be no confusion in regard of
> which procedure is being called.
I see more than this in the use of a method. Any (normal) procedure may be
activated by any"one", a method only by the owner, i. e. an object of the
correct type. Of course you can avoid OOP alltogether and the code may
even be more effective. But I believe encapsulation to be quite useful.
For example you somewhere have a list structure (a type Queue) which
inside its own scope (a module) manages elements of a type Element. The
class Element is abstract but not empty. It must possess a method Init, so
that it's private fields and methods are dealt with in a controlled
fashion. Class Element being ABSTRACT, Objects of subclasses can be
inserted into and eliminated from the queue. The containing module is
accessible via it's interface only so the Init method of Element wil have
to be exported and EXTENSIBLE as objects of sub(sub)classes must have
access to it and may extend it.
In order to deal with more specialized objects a subclass Part inherits
from Element, adds some more (eventually private) attributes and methods,
but being still too general for some special purpose this class as well is
abstract. Nevertheless its fields and methods must be initialized as have
been the fields and methods of the superclass Element so it has its own
Init method overriding the inherited Init (and using it via a supercall).
Finally there is a concrete (hidden) class CarPart, again in a different
module adding even more attributes which have to be initialized.
> An Init for a LIMITED type ought to be hidden anyway within a factory
> procedure/method (belonging to another type).
Of course will there be a constructor creating a new CarPart object and
initialising it properly. And then you find the situation I sketched. The
constructor activates the Init method from CarPart. This method
necessarily has to activate the Init of it's superclass Part because
otherwise ...? And again the Init of the super(super)class Element must be
called because otherwise ...?
Now, that was the idea behind my example and I don't see how to do the job
without supercalls, unless you follow the way outlined in my alternative
which avoids supercalls but introduces other (and in my opinion) more
dangerous problems.
> Also, LIMITED types are introduced to ensure that the creator can
> guarantee their invariants, the client is not supposed to have access to
> that.
That' exactly what is supposed in the above example.
Regards
H. v. Lavergne
--------------------------------------------
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-1167639339_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIE9uIFN1biwgMDMgT2N0IDIwMDQgMTc6MzY6MjYg
KzA0MDAsIEZ5b2RvciBUa2FjaG92ICBccGFyDQo8ZnlvZG9yLnRrYWNob3ZAY2Vybi5jaD4gd3Jv
dGU6XHBhcg0KXHBhcg0KXHBhcg0KPiB3aHkgbm90IHVzZSBzaW1wbGUgcHJvY2VkdXJlcyAobm90
IG1ldGhvZHMpIGluc3RlYWQgb2YgaW5pdGlhbGl6YXRpb24gIFxwYXINCj4gbWV0aG9kcyB3aGlj
aCB5b3UnZCBsaWtlIHRvIGludm9rZSBhcyBzdXBlcmNhbGxzP1xwYXINCj4gVGhlIG9ubHkgb2Jq
ZWN0aW9uIEkgc2VlIGlzIGEgc29tZXdoYXQgbW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ct 03 2004 - 16:54:17 UTC
This archive was generated by hypermail 2.3.0
: Thu Sep 26 2013 - 06:28:35 UTC