From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-3.2 required=3.0 tests=BAYES_00,NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!news.eternal-september.org!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Java and Python have just discovered "record" type finally after 40 years. Date: Sun, 14 May 2023 13:29:15 +0300 Organization: Tidorum Ltd Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net RVKUD9VZq6ZxMG4MydylkQkmtGZkM7trQTaF6SxNcQkdVKnJiR Cancel-Lock: sha1:dVqWRU95Rf6X6zbghr89OzcC7Dk= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Content-Language: en-US In-Reply-To: Xref: news.eternal-september.org comp.lang.ada:65229 List-Id: On 2023-05-14 9:46, J-P. Rosen wrote: > Le 13/05/2023 à 18:53, Niklas Holsti a écrit : >>> What about COBOL and LISP? >> >> >> As I understand it (but I don't claim to be expert), the early COBOL >> languages could describe the structure of file records, and of >> working-storage objects, as nested sequences of components and >> sub-records, but each such description defined a _single_ "record" >> object, not a "record" data-type that could have many instances. So if >> you wanted to have two record objects with the same structure, you had >> to duplicate the whole record description. > AFAIR, COBOL didn't have types, but you could define a variable LIKE > another one. So I also remembered, but (before writing the above) I looked through some COBOL syntaxes on the net and could not find LIKE as part of the data division syntax. However, after more searching, I see that at least current Microfocus RM-COBOL supports a "SAME AS" definition that has that effect. I don't know when that feature was introduced. I did not find it in the current IBM COBOL description. In Microfocus RM-COBOL, the LIKE word can be used as a boolean relation that compares the content of a variable to a pattern, like a regexp match. I did not find this kind of relation in IBM COBOL. Another way to clone a COBOL record structure is to put the record structure description in a separate source-code file, and COPY that file (like C "include") into the declaration of any object that should have that structure. But ugh. And it could make a mess of the "level numbers", where the RM-COBOL SAME AS definition adjusts those automatically.