Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!dsl.pitt.edu!pitt!willett!ForthNet From: ForthNet@willett.pgh.pa.us (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: PUZZLES AND PROBLEMS Message-ID: <1555.UUL1.3#5129@willett.pgh.pa.us> Date: 20 Aug 90 00:41:32 GMT Organization: String, Scotch tape, and Paperclips. (in Pgh, PA) Lines: 34 Category 3, Topic 35 Message 140 Sat Aug 18, 1990 W.BADEN1 [Wil] at 22:34 PDT Gordon Ganderton, Although easy to do (see my 1985 FORML Pretty Phraser), pretty printing with indication of stack depth is not as satisfying as doing it yourself. The values on the stack correspond to the variables in profane languages, and stack indications should have meaningful names for the values. The result of automatic indication would be like programs in Basic with single letters for names of variables, only worse. Forth programs put values on the stack, and take them off. You can make a chart showing the rise and fall of the stack depth. When the chart hits a valley either the values on the stack represent the same things they did earlier, or the individul values represent something new. In either case there should be some stack comment, or extra space if the it's the same as at the previous stack comment. If a valley is not as low as the previous valley, you are probably missing a stack indication. If one stack status predominates after initial instructions setting it up, as it usually happens, but there is a section in the middle with a different status, that is a strong suggestion to consider factoring out that section. A good test for readability is to read the definition backward, last line first. If you can understand what each line does from stack comments previously given without having to mentally execute the code, then the definition qualifies for consideration as readable. There will always be someone who disagrees, though. ----- This message came from GEnie via willett through a semi-automated process. Report problems to: uunet!willett!dwp or dwp@willett.pgh.pa.us