Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!ncar!gatech!udel!haven.umd.edu!socrates.umd.edu!socrates!rockwell From: rockwell@socrates.umd.edu (Raul Rockwell) Newsgroups: comp.lang.apl Subject: J comment styles Message-ID: Date: 26 Apr 91 00:15:20 GMT References: <1991Apr24.183906.14541@jato.jpl.nasa.gov> <24APR91.20363659@uc780.umd.edu> <1991Apr25.151215.224@jato.jpl.nasa.gov> Sender: rockwell@socrates.umd.edu (Raul Rockwell) Organization: Traveller Lines: 45 In-Reply-To: sam@kalessin.jpl.nasa.gov's message of 25 Apr 91 15: 12:15 GMT Sam Sirlin writes: > I think your branch around initial comments won't stop the parser from > looking at the comment lines at the definition phase ... Yeah, you still need to be careful. It's just simpler to type. > On the other hand, I think any readable programming style should use > comments sprinkled throughout a program, and this would be contorted > using branching all the time. By making it cumbersome, J seems to be > designed to discourage comments. I think you're squashing some unrelated ideas together here. J does not provide an anomalous syntax for comments, but that doesn't mean comments need to be cumbersome. First off, it helps to have a few tools to write programs with. One technique is to use an editor to build your objects, and save everything in a workspace. Another is to build scripts which read objects in from standard input (that is, the script). Second off, there are quite a number of useful quoting techniques. The first of which is to organize your program carefully. Also, using descriptive names helps a great deal. Also, for some verbs, it helps to have a block comment at the begining (or end), to orient the reader. And then, you can always adopt a style where you have comments describing individual lines of a program (usually, you set off both the comments and the described lines with blank lines). And, finally, you can do "running narrative" tricks like: a =. ['step one'] here is a calculation b =. ['step two'] here is another I don't know if it is possible to come up with a "perfect" comment syntax (for example, in C you have to be careful when you divide by a number referenced via a pointer, and you can "accidentally" comment out large sections of code with no warning from the compiler). J's comment style has the advantage of making comments proper objects of the language (which makes the language itself somewhat simpler, and allows the user much more flexibility than some sort of pre-processing kludge). Raul Rockwell