Hacker News new | ask | show | jobs
by fosap 4228 days ago
Namespaces are the least of my worries.

TeX is not a programming language, it's two programming languages. These languages have a self modifying syntax and is parsed with state machines that can be changed. Changing the syntax into something meaningful other is yet quite impossible. It's meant not meant to be able to read markdown or xml.

These Languages are so odd even division of two variables is non-trivial, yet both are truing complete and servly limited, a classic turing tar pit, even division of two variables is nontrivial.

The hole TeX thing is a huge state machine, and uses imperative paradigms, while declaratives would have been much nicer.

All that leads to a horrible, monkey patching coding style.

On the internals there are other horrible things: Unicode was known when it was invented, font formats are a mess (even with XeTeX; I think I can't have another mapping for my the cursive style of a font then for regular. Good thing is the very verbose documentation for fontspec does mention "mapping" twice)

2 comments

> Unicode was known when it was invented

Certainly not, not even latin-1 was existing when TeX was created.

Indeed, TeX: 1978. Unicode: 1987.

Perhaps some dyslexia lead someone to believe they were invented in the same year? :-)

You fall into a simple trap: TeX is not a programming language. At all. It's a typesetting DSL. Whether it's a good one is another thing.
It's typesetting DSL, but if you want to typeset you'd need a typesetting meta-DSL. The one thing that works fine with TeX is math, because math typesetting is build in. Typesetting something more specific other than english text and math is hard and ugly.

If does follow imperative paradigms, as it does, the programming language part is essential if you want to do anything meaningful with it. If exotic task you never need in typesetting, such as multiplication, is hard to implement, something is wrong. And IMO that is why LaTeX is so odd and hackish.

Context is much better, tough.

And, by the way, the unfortunalty dead ANT uses a nice Haskell like language and is still a typesetting DSL.

http://sourceforge.net/projects/ant.berlios/ https://web.archive.org/web/20090310012257/http://ant.berlio...

According to Knuth (quoted at http://tex.stackexchange.com/a/167443/1169):

    Knuth: So TeX is a programming language but I had to put in those features kicking and screaming.
But the quote equally shows how much it is not intended to be.
> But the quote equally shows how much it is not intended to be.

Yes, certainly, but you said (https://news.ycombinator.com/item?id=8615643):

> TeX is not a programming language.

rather than "TeX is not intended to be a programming language." It is nit-picking to be sure, but I think that, if the creator of a language (especially one who knows his stuff as Knuth does) says that it is a programming language, then it is.

Another appeal to (a lesser) authority—the TeX Users Group (https://www.tug.org/whatis.html):

    In summary, TeX is a special-purpose programming language that is the centerpiece of a typesetting system that produces publication quality mathematics (and surrounding text), available to and usable by individuals.
… and an appeal to the fact that people have written programs in it: http://stackoverflow.com/a/1931289.

(P.S. To "so, is XSLT a programming language because of, say, http://www.unidex.com/turing/utm.htm ?" I say "sure, why not?" What is the point of excluding something from being a programming language?)

Actually LaTeX was invented to be a typesetting DSL. As someone who has taught TeX and LaTeX and written my own software on top of TeX, I have come across this question very often. Basic TeX is not meant to be high level at all. LaTeX hides the complexity of 95% of the typesetting needs.
If it's Turing complete, it's a programming language.
Magic: The Gathering is turing complete. SQL as well. Petri-Nets with certain extensions are. Many logic systems are.

They are hardly programming languages.