Pointer compatibility question

From: [at]} <Wojtek>
Date: Thu, 19 Jun 2003 18:25:27 -0400 (EDT)

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

Hi:

  I am not sure I understand the reason for the error message
generated by the following test module. We wanted to implemented
a few list-management procedures from the textbook by Reiser and Wirth.
The procedures do not compile under BlackBox because the pointer
to the daughter class cannot be passed as a VAR parameter.
I am somewhat confused why. The variable "anchor" is assignment-compatible
with the formal VAR parameter "first", see the Language Report Appendix A,
Assignment compatible, rule 3:

3. Te and Tv are pointer types and Te is an extension of Tv;

It follows that it should be possible to assign a variable of type
HistNode to the VAR parameter of type Node, because HistNode is
an extension of Node. However, the program does not compile
with the error message that the types are not *identical*. They do not
need to be identical, they only need to be assignment-compatible.
What am I missing?

Wojtek Skulski skulski{([at]})nowhere.xy

MODULE WorkTest;
        TYPE
                Node = POINTER TO EXTENSIBLE RECORD
                        next: Node;
                END;

                HistNode = POINTER TO RECORD (Node)
                        hist: INTEGER
                END;

        VAR
                anchor: HistNode;
                last: HistNode;

        PROCEDURE InsertLast (VAR first:Node; new:Node);
        BEGIN
        END InsertLast;

        PROCEDURE AddNew;
        BEGIN
                NEW(anchor);
                NEW(last);
                InsertLast (anchor, last) (*incompatible?*)
        END AddNew;

END WorkTest.


--------------------------------------------


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

e1xydGYxXGFuc2lc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F1ZXN0aW9ucyByZWxhdGVkIHRvIHRoaXMgZW1haWwg
bGlzdCB0byB0aGUgbGlzdCBvd25lciBhdFxwYXINCiAgIG93bmVyLWJsYWNrYm94QG9iZXJvbi5j
aFxwYXINClxwYXINCkN1cnJlbnQgcG9zdGluZyBwb2xpY3k6XHBhcg0KXHBhcg0KYSkgVG8gcG9z
dCB5b3Ugc2hvdWxkIHVzZSB0aGUgc2FtZSBhZGRyZXNzIGJ5IHdoaWNoIHlvdSBhcmUgc3Vic2Ny
aWJlZCB0byB0aGUgbWFpbGluZyBsaXN0LiBUaGF0IHdheSwgdGhlIGxpc3Qgc2VydmVyIHdpbGwg
cmVjb2duaXplIHlvdSBhcyBzdWJzY3JpYmVyIGFuZCBmb3J3YXJkIHlvdXIgcG9zdGluZyBpbW1l
ZGlhdGVseSwgd2l0aG91dCBjcmVhdGluZyBhbnkgb3ZlcmhlYWQuXHBhcg0KXHBhcg0KYikgSWYs
IGZvciBzb21lIHJlYXNvbiwgeW91IGNhbm5vdCBwb3N0IGZyb20gdGhlIGFkZHJlc3MsIGJ5IHdo
aWNoIHlvdSBhcmUgc3Vic2NyaWJlZCwgeW91ciBtZXNzYWdlIHdpbGwgYmUgbW9kZXJhdGVkIHRv
IGF2b2lkIHNwYW0uIFBsZWFzZSB1bmRlcnN0YW5kIHRoYXQgbW9kZXJhdGlvbiB3aWxsIG9mdGVu
IGNhdXNlIHNvbWUgZGVsYXksIGluIHBhcnRpY3VsYXIgb3ZlciB3ZWVrZW5kcyBvciBob2x5ZGF5
fX0AdGx5IKB1


----boundary-LibPST-iamunique-1372725366_-_---
Received on Fri Jun 20 2003 - 00:25:27 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:29:11 UTC