[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: TeX and ruby
From:       David Kastrup <dak () gnu ! org>
Date:       2006-12-10 12:25:08
Message-ID: 85r6v8hrhg.fsf () lola ! goethe ! zz
[Download RAW message or body]

pierodancona@gmail.com writes:

> ishamid wrote:
>> Hi,
>>
>> On Dec 9, 9:50 am, pierodanc...@gmail.com wrote:
>> > Essentially, TeX is just some trivial arithmetic.
>>
>> Not so, designing/implementing its algorithms provided more than
>> one gradaate student with his doctorate :-)
>
> Hey, I did not want to sound dismissive. I read
> the TeXbook quite thoroughly (if you have heard
> of pdfsync.sty, I wrote the first iteration of it :)

Well, I don't want to sound dismissive either.  I read TeX, the
Program, quite thoroughly, and I contributed the last iteration of
pdfsync.sty because it broke too many of my tools and packages.

> and consider TeX and the work behind it one
> of the gems around here. That said, after all
> this work, TeX's algorithms are now a bunch
> of trivial arithmetic, and they should be easy
> to replicate in any language...

After all the work, _any_ algorithm is just trivial combination of 0s
and 1s.  There is never any magic involved, and one can replicate the
work in any language.

But that is not actually a question worth considering, and the various
TeX user groups paid a large price to learn this lesson: NTS was a
commissioned complete port of TeX to Java.  The idea was that Java,
instead of the original idiosyncratic Pascal dialect, would lend
itself better to extension and modification.

Which turned out about as successful as porting a violin solo cantata
of Bach to the piano.  It is already harmonically complete, and there
is nothing you can sensibly add to it.

One problem is that Knuth uses Pascal like assembly language.  The
actual data structures manipulated are not the data structures of
Pascal, but rather Patricia trees, various kinds of linked lists
implemented without pointers and/or new, self-implemented memory
management and allocation using reference counts, compressed hash
tables and so on.  And most of the data structures are tied into the
table of equivalents, meaning that they obey TeX's group structure.

There is a saying "a bad programmer can write Fortran in any language"
which actually is an understatement if you compare "Numerical Recipes"
and "Numerical Recipes in C": perfectly useful Fortran in the former
got translated into an inefficient abomination of C in the latter
(array indices still starting at 1, 2-dimensional arrays implemented
by row pointer indirection instead of pointer arithmetic and so on).

In a similar vein, ports of TeX tend to be just TeX, nothing else,
and/or not useful.  And in particular, not pretty, and that means that
nobody bothers working with the results.

At the current point of time there are two projects that are somewhat
interesting in that regard: ExTeX (Java again, TeX compatible) and Ant
(OCaml currently, TeX inspired, can work with LaTeX files to some
degree IIRC).  At least the latter seems to have reached a state where
fiddling with the internals makes sense.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic