Re: [BLACKBOX] Variant Records vs. Component Pascal

From: [at]} <Bernhard>
Date: Sat, 2 Jan 2010 18:35:43 +0100

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

Hi Stephen,

maybe you'll need a type bound procedure (defined as ABSTRACT for the base
type) which
defines your ordering relations, which is called as

IF myrec.Order() = less THEN ...

Here your comparision is handed to the type-bound procedure, which is
unknown beforehand.

The other solution is a less generic sort routine, which has the base type
as parameter, and a type test for
the actual type. In this case you have to know (and import) all possible
extension beforehand.

and again: Mössenböck's book is an excellent starting point.

Bernhard

----- Original Message -----
From: Stephen R. Troy
To: BLACKBOX{([at]})nowhere.xy
Sent: Friday, January 01, 2010 8:10 PM
Subject: Re: [BLACKBOX] Variant Records vs. Component Pascal


Thanks to Douglas and Bob for their quick replies, regarding my problem
migrating a database using Modula-2 variant records to Component Pascal. In
Modula-2, I had variant records, and was able to use the same sorting
routine with each of the variants.
In Component Pascal I tried using a base EXTENSIBLE record, and each of the
variant record types as an extension of the base. The problem was that I
couldn't pass each of the variants to the sorting routine, and it looked as
though I would need a separate sorting routine for each variant.


Douglas's method looks like it would work if indeed I did all my sorting on
variables that were common to the base record type, but alas that is pretty
limiting. Bob's method looks like it might solve my problem, but I'll have
to bang my head with a brick some more to be sure I understand it. Thanks
again and Happy New Year to both of you!


Steve Troy


---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to
LISTSERV{([at]})nowhere.xy


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1001030837_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzc1xmY2hhcnNldDAgQXJpYWw7fQ0Ke1xmMVxmbW9kZXJuIENvdXJpZXIgTmV3O30NCntcZjJc
Zm5pbFxmY2hhcnNld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luZyBy
b3V0aW5lIGZvciBlYWNoIHZhcmlhbnQuXHBhcg0KXHBhcg0KXHBhcg0KRG91Z2xhcydzIG1ldGhv
ZCBsb29rcyBsaWtlIGl0IHdvdWxkIHdvcmsgaWYgaW5kZWVkIEkgZGlkIGFsbCBteSBzb3J0aW5n
IG9uIFxwYXINCnZhcmlhYmxlcyB0aGF0IHdlcmUgY29tbW9uIHRvIHRoZSBiYXNlIHJlY29yZCB0
eXBlLCBidXQgYWxhcyB0aGF0IGlzIHByZXR0eSBccGFyDQpsaW1pdGluZy4gIEJvYidzIG1ldGhv
ZCBsb29rcyBsaWtlIGl0IG1pZ2h0IHNvbHZlIG15IHByb2JsZW0sIGJ1dCBJJ2xsIGhhdmUgXHBh
cg0KdG8gYmFuZyBteSBoZWFkIHdpdGggYSBicmljayBzb21lIG1vcmUgdG8gYmUgc3VyZSBJIHVu
ZGVyc3RhbmQgaXQuICBUaGFua3MgXHBhcg0KYWdhaW4gYW5kIEhhcHB5IE5ldyBZZWFyIHRvIGJv
dGggb2YgeW91IVxwYXINClxwYXINClxwYXINClN0ZXZlIFRyb3lccGFyDQpccGFyDQpccGFyDQot
LS0tIFRvIHVuc3Vic2NyaWJlLCBzZW5kIGEgbWVzc2FnZSB3aXRoIGJvZHkgIlNJR05PRkYgQkxB
Q0tCT1giIHRvIFxwYXINCkxJU1RTRVJWQExJU1RTLk9CRVJPTi5DSCBccGFyDQpccGFyDQpccGFy
DQotLS0tXHBhcg0KVG8gdW5zdWJzY3JpYmUsIHNlbmQgYSBtZXNzYWdlIHdpdGggYm9keSAiU0lH
Tk9GRiBCTEFDS0JPWCIgdG8gTElTVFNFUlZATElTVFMuT0JFUk9OLkNIXHBhcg0KfQ==
----boundary-LibPST-iamunique-1001030837_-_---
Received on Sat Jan 02 2010 - 18:35:43 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:37 UTC