Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site fortune.UUCP Path: utzoo!linus!philabs!seismo!hao!hplabs!hpda!fortune!crane From: crane@fortune.UUCP (John Crane) Newsgroups: net.lang Subject: Self-modifying code Message-ID: <2157@fortune.UUCP> Date: Tue, 3-Jan-84 14:58:52 EST Article-I.D.: fortune.2157 Posted: Tue Jan 3 14:58:52 1984 Date-Received: Wed, 4-Jan-84 05:11:48 EST Organization: Fortune Systems, Redwood City, CA Lines: 29 I can think of a very good reason for writing self-modifying code or for a program to generate code which it later executes. I once wrote a report generator similar to RPG. I wrote it in IBM assembler because I needed the ability to generate code, mnodify it, and execute it in real time. I look for this ability in a language and consider its presence an asset and its absence a serious drawback. I agree that the ALTER statement in COBOL is an abomination as is the rest of the language as presently used. COBOL could be a useful business programming language if it had some of the control structures that C has. A lot is made of the ability of C and Ada to have separately-compiled modules which can be linked together as well as functions which could be called with a list of parameters. The features were there in COBOL and PL/I, but programmers didn't understand their usefulness and IBM made them so difficult to use that everybody was afraid to try them. In my opinion, COBOL's verbosity is not a drawback. It forces the programmer to document his code. I think every line of a C or assembler program should be documented even if you as a programmer think the code is so obvious anybody could understand it. I came to this conclusion after years of trying to decipher other people's spaghetti. As a result, my C programs look a lot like COBOL.