LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Lars Hellström <[log in to unmask]>
Thu, 17 Jul 2003 14:41:59 +0200
text/plain (43 lines)
At 11.07 +0200 2003-07-17, Joachim Schrod wrote:
>XSLT is a write-only language when it comes to
>implementing the "intermediate steps" above, that's no improvement to
>TeX macro programming. It has poor semantics (like TeX, it's even
>missing elementary boolean clauses), and its syntax is horrible to
>read and thus maintenance is hard.

TeX missing elementary boolean clauses? They're not there as primitives,
but they are not hard to define as macros. In particular the part of
docstrip that evaluates "guard expressions" provide an example of their
implementation that is readily available in a nearby file system. Here is
another take on the matter.

A "boolean expression" is something which in the mouth expands to 0 or 1.
The following take boolean expressions as arguments and may themselves be
used as boolean expressions.

\def\boolean@not#1{\if#10\expandafter1\else\expandafter0\fi}
\def\boolean@implies#1#2{\if#10\expandafter1\else#2\fi}
\def\boolean@and#1#2{\ifnum #1#2>10 \expandafter1\else\expandafter0\fi}
\def\boolean@or#1#2{\ifnum #1#2>\z@ \expandafter1\else\expandafter0\fi}

(The \expandafter commands are not necessary, but they help a bit with
cleaning things up.)

The tricky part is of course that not everything one might want to test
(such as the existence of a file) can be done entirely with TeX primitives
that expand in the mouth, but that is another matter. The TeX macro
language as such is both powerful and elegant, even though it is also
rather bizarre, but on the other hand one can say the same about lambda
calculus.

Contrary to the opinions commonly raised on this list the last two week, I
don't think the TeX macro language is the weakest part of TeX, even though
it could certainly do with some extensions for LaTeX (in areas such as
command argument processing, keyval-style value assignments, and calc-style
arithmetic). It is not surprising however that it is the part that is
giving the *ML people the most trouble, and that probably accounts for most
of the "bad press" it has been given. If you want to look at a part of TeX
that is _weak_, then consider alignments.

Lars Hellström

ATOM RSS1 RSS2