CSvax:Pucc-H:Pucc-I:Pucc-K:ags@pur-ee.UUCP (10/29/83)
The fact that Apple Pascal places a limit on the length of procedures does not make it a toy. I have been using Apple Pascal for about 3 years, and for many applications I prefer it to Berkeley Pascal (on a VAX) or to Pascal 6000 on CDC machines. Yes, I know it is slower and supports less memory than those implementations. It is still quite capable of compiling and running useful programs. Yes, I once got the "procedure too long" message. I don't know what the maximum is, but I suspect it depends more on the amount of code generated than on the number of source lines. My procedure consisted of a single case statement with a huge number of branches. I got around the problem by writing three case statements, each in a separate procedure, with all three enclosed in an executive procedure which determined the proper subrange and called the appropriate sub-procedure. This didn't make me particularly happy at the time, but since it has happened only once in three years I do not consider it a major problem. There are other ways to express algorithms as alternatives to huge case statements. I am not surprised that beginners would run into the "procedure too long" limitation. Beginners' programs typically contain long stretches of straight- line "stream-of-consciousness" code. An experienced programmer structures his program as a large number of short procedures (no more than a page in length), not out of fear that the compiler will deem them "too long," but for at least two other reasons: 1. A procedure should do one thing, and do it well. A procedure which does two things is less likely to be of general use throughout the rest of the program. 2. Long procedures are harder to understand and harder to modify. The benefits of well-structured code become increasingly obvious over time. Dave Seaman ..!pur-ee!pucc-k:ags