Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site hp-pcd.UUCP Path: utzoo!linus!philabs!seismo!hao!hplabs!hp-pcd!orstcs!nathan From: nathan@orstcs.UUCP Newsgroups: net.lang Subject: Modula-2 faults - (nf) Message-ID: <1891@hp-pcd.UUCP> Date: Wed, 21-Sep-83 03:50:51 EDT Article-I.D.: hp-pcd.1891 Posted: Wed Sep 21 03:50:51 1983 Date-Received: Fri, 23-Sep-83 08:32:34 EDT Sender: notes_gateway@hp-pcd.UUCP Organization: Oregon State University, Corvallis, OR Lines: 77 #N:orstcs:22400002:000:3537 orstcs!nathan Sep 18 02:23:00 1983 Concerns about Modula-2: There is a standard set of gripes about M-2 which I will not discuss here: string/character constant handling, statement delimiters, etc. There are also some real inadequacies which may limit the language's usefulness. I believe that it is not too late to fix these problems. (in advance:) (I don't want to get into the debate raging in net.lang.c over whether an i/o module is part of the language. I claim that standard modules ARE, whether they have to be imported or not, because most programs' portability depends upon them being identical from impl. to impl.) Problem 1: The standard modules specified by N. Wirth (in his book, Programming in Modula-2) signal error conditions by exporting an 'error variable'. This makes the modules non-reentrant -- which is a real problem in a language which contains multi-tasking primitives. The solution is found in Volition Systems' own standard modules which they supply as alternates to Wirth's. First, calls should RETURN an error code; second, a SetHandler call should be available for each module to allow attempts to recover from or clean up after errors. The handler could, at least, set an error flag that is available only in the scope of the calling routine so that other pre-empting processes would not be able to clobber it. Problem 2: Dependencies of one module on others are not explicit; these dependencies must be documented informally. Judging from Volition Systems' (hereafter called "VS") valiant attempts, this is inadequate. It's hard enough to keep documentation up-to-date when only the module's function needs to be documented. Problem 3: The interrupt priority scheme for modules is just not adequate. Apparently the current definition is acceptable on PDP-11's; if there is a well- structured method which is sufficiently general to support most architectures, it should be adopted instead. (Have we any suggestions?) At the least, there should be some way change the priority of a module at run-time. Language syntax will have to be adjusted to accommodate the facility, unfortunately. Problem 4: Wirth supplies a standard module Processes, with primitives for multi-tasking. Unfortunately, It requires that the calling function allocate stack space for any new task created. This limits its usefulness, as the programmer should not have to deal with such details. On many architectures this allocation can be handled much better in hardware. A facility should be provided to use this hardware assist if such is available; a handler would be specified which either operates on memory-mapping hardware or allocates stack out of the heap as it does now. Problem 5: The programmer does not have enough control over variable sizes. There is no standard way to specify a 16-bit or 32-bit quantity, or even to tell what the compiler's WORD size is, at compile time. On 16-bit machines there is apparently no way to specify a 32-bit value at all. Various implementations will add support as non-standard modules; these will of course *not* be portable, and (in VS' case) will not even use generic arithmetic operators. This is not at all an exhaustive list; it represents what I was able to recall at 1 am Sunday. I hope to see: a: suggestions to solve these problems in an aesthetic way b: descriptions of other problems of equal or greater magnitude. Nathan C. Myers uucp: ...!hplabs!hp-pcd!orstcs!nathan Oregon State University, Corvallis