RE: Procedure types

From: Fyodor Tkachov <"Fyodor>
Date: Fri, 19 Nov 2004 08:56:04 +0300

----boundary-LibPST-iamunique-870253770_-_-
Content-type: text/plain

Wojtek,

After you unload the module TestUpper,
the object on the heap will continue to exits just fine.
It contains a hidden tag -- the pointer to the type descriptor (so it will be garbage collected just fine, when its time comes).
The type descriptor need not be unloaded along with TestUpper. TestUpper knows its type descriptors, so it can do things like NILlify back references from them to itself when unloading, as well as NILlify pointers to methods.
So if an attempt to call the object's method (whose code is in the unloaded TestUpper), the situation is easily detected (e.g. the NILlified pointers to methods) and the module can be reloaded.
All the information is available when it's needed, no implementation difficulties.

A procedure variable is just an address of the entry point into the procedure: there is no auxiliary information to help the run-time system.

Cheers
Fyodor

> > That is, a procedure variable may contain a dynamically created reference
> > to a procedure in the module being unloaded, even if the latter is not
> > related by import with the variable's module.
>
> Is the same not true with objects as well?
>
> MODULE TestLower;
> TYPE hookType* = POINTER TO EXTENSIBLE RECORD END;
> VAR hook* : hookType;
> END TestLower.
>
> MODULE TestUpper;
> IMPORT TestLower;
> TYPE myHook = POINTER TO RECORD (TestLower.hookType) END;
> VAR hook: myHook;
> BEGIN
> NEW (hook);
> TestLower.hook := hook;
> END TestUpper.
>
> As you see, I have installed a "hook object" in a module Lower.
> I can now unload module Upper because it does not have clients.
> What happens if TestUpper.hook uses resources from module Upper?
>
> Naturally, one should take care of this in the CLOSE section of module
> TestUpper, but what if there is no CLOSE section? Can you guarantee there
> are no safety problems if one unloads such a sloppy module, even though I
> have not used procedure variables?
>
> What I am driving at is that possibly procedure variables are no more
> dangerous than the O-O solution would have been, in the hands of a sloppy
> programmer of course.
>
> Comments?
>
> W.

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-870253770_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIFdvanRlayxccGFyDQpccGFyDQpBZnRlciB5b3Ug
dW5sb2FkIHRoZSBtb2R1bGUgVGVzdFVwcGVyLFxwYXINCnRoZSBvYmplY3Qgb24gdGhlIGhlYXAg
d2lsbCBjb250aW51ZSB0byBleGl0cyBqdXN0IGZpbmUuXHBhcg0KSXQgY29udGFpbnMgYSBoaWRk
ZW4gdGFnIC0tIHRoZSBwb2ludGVyIHRvIHRoZSB0eXBlIGRlc2NyaXB0b3IgKHNvIGl0IHdpbGwg
YmUgZ2FyYmFnZSBjb2xsZWN0ZWQganVzdCBmaW5lLCB3aGVuIGl0cyB0aW1lIGNvbWVzKS5ccGFy
DQpUaGUgdHlwZSBkZXNjcmlwdG9yIG5lZWQgbm90IGJlIHVubG9hZGVkIGFsb25nIHdpdGggVGVz
dFVwcGVyLiBUZXN0VXBwZXIga25vd3MgaXRzIHR5cGUgZGVzY3JpcHRvcnMsIHNv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