Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!spool.mu.edu!mips!apple!agate!priam.Berkeley.EDU!edward From: edward@priam.Berkeley.EDU (Edward Wang) Newsgroups: comp.text.tex Subject: Re: Why use TeX if ... Keywords: TeX, PostScript, typesetting, page description, programming Message-ID: <1991May12.032219.1019@agate.berkeley.edu> Date: 12 May 91 03:22:19 GMT References: <1991May10.065219.23433@agate.berkeley.edu> <1991May10.211802.4344@csrd.uiuc.edu> <1991May11.013248.16286@nntp-server.caltech.edu> Sender: root@agate.berkeley.edu (Charlie Root) Organization: University of California, Berkeley Lines: 70 In article <1991May11.013248.16286@nntp-server.caltech.edu> marcel@cs.caltech.edu (Marcel van der Goot) writes: >As far as I can tell, the only way in which you can have the freedom of >presenting your input as almost plain text, with very little knowledge >about the details of the underlying programming language, is with a >language based on macro substitution. A conventional programming language >with strict syntax means that your input has to obey very strict rules. I don't think it's desirable or even possible for the input to be completely unstructured text. For example, SGML is nothing but structure. Given that, then it's possible to design a syntax based on the natural text structure. Syntax then becomes a part of structural correctness. For example, on a trivial level, here's Tex's \centerline macro as a Lisp function in an imaginary embedding of Tex in Lisp: (defun center-line (x) (line (hss) x (hss))) The function body (line (hss) x (hss)) has the same nesting as that of the box-and-glue typesetting model, which is a structure any writer of such Tex macros has to understand. Control constructs necessarily have some syntax of their own. Even Tex can't get away from that. >Is it important to have so much control over the form of your input? Yes, >it is. Not so much for you programmer types. Programmers are used to >obeying strict syntax rules. But it is important for people who do the >actual writing of the books, papers, letters, etc. For those people the >ease of *usage* of the macros is important; TeX can make that very easy. >Of course, that means that the *construction* of macros becomes more >complicated. This level of control gives us lots of cute tricks and some truly useful features, but I don't think the results are easy to use. My favorite example is that \verb in Latex can't always be used in macro arguments. In fact, it's possible to make the opposite argument that the power is good for the expert, but the inconsistency is bad for the novice. >In short: TeX's macro language makes input of text much easier than >any conventional type programming language could; the price is the >increased burden for the macro designer. A conventional conventional language, yes. However there's no reason that a conventional language can't be augmented with constructs to input text. >Dynamic scoping is pretty much inherent in macro languages. Lexical scoping >requires strict syntax rules. This isn't true. Tex can be changed to be lexically scoped without even changing the syntax (though the rest of the system is structured to take advantage of dynamic scoping). Indeed, macro arguments in Tex are lexically scoped. >When TeX is compared with other programs/systems, one should keep in >mind what TeX is intended for. Since TeX is intended for typesetting >books and the like, it should not be compared as if the primary use >of TeX is as a programming language. The emphasis in the design of TeX >is on the possibility to write easy-to-use macro packages, at the >cost of hard-to-program macros. (That, of course, does not imply that >all macros written are easy to use.) Nevertheless, Tex is used to write large programs, and these programs are necessary. In any case, I believe that both ease of programming and ease of use can come from the same well-designed language. Scribe is another story.