[BLACKBOX] Variant Records vs. Component Pascal
----boundary-LibPST-iamunique-1661310720_-_-
Content-type: text/plain
Hello List,
This is my first post to this list. To help you reply, I started programming digital computers, in machine language, in 1957. Since then I have done scientific and engineering programming in FORTRAN, BASIC, Pascal, and then Modula-2 for many years. I have only limited familiarity with C. Now retired, recently I have moved to Oberon and now Component Pascal, writing programs to support hobbies.
I have a program I have been evolving for several years, which reads in a database which is in a structured ASCII text file using a third-party database schema. The program develops several index files, performs various sorting and filtering operations on these indexes, and the uses the modified indexes to write out reports using the same database schema. There are three main types of records, and I was able to write very efficient sorting and filtering procedures in Modula-2 by writing the records as variant records of a basic type, then instantiating the records by pointers. My indexes were linked lists of the pointers, both linear and binary trees, and so I could find, sort, and filter each of the three types of records using the same very efficient code, because I manipulated only the pointers' "next-record" pointer in the linked lists, not moving any records in memory.
But I apparently I can't use this method in Component Pascal because variant records are not allowed. I tried defining a basic record as an ABSTRACT type, then defining each of my three record types as extensions. However, I can't instantiate a record as a NEW(pointer to basic type), and I can't use a single sort routine with each of the three (pointer to extension type) -- I need three separate routines, which is clumsy at best, and seems contrary to the basic intent of Component Pascal. I tried defining the basic record type as EXTENSIBLE, but that made no difference. I found an obscure section in the Component Pascal documentation that said that using a RECORD [union] system flag, which allowed a "C-type" union data structure, it was possible to simulate Pascal- and Modula-style variant records, but the example in the documentation will not compile -- it gives an "invalid system flag" error message on the [union] flag.
Any suggestions would be welcome at this point.
Thanks,
Steve Troy
---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
----boundary-LibPST-iamunique-1661310720_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbWh0bWwxIFxkZWZmMHtcZm9udHRibA0Ke1xmMFxm
c3dpc3NcZmNoYXJzZXQwIEFyaWFsO30NCntcZjFcZm1vZGVybiBDb3VyaWVyIE5ldzt9DQp7XGYy
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