Live data from Hacker News

Rewriting LaTeX in Pure Rust

github.com

91–100 of 148 posts

Re: Rewriting LaTeX in Pure Rust

#91
post #48

Personally, I think this approach -- which as far as the engine is concerned looks like a largely-automated "translation" of xetex from C/C++ to Rust -- is misguided. The xetex code is a byzantine tangle of disparate pieces that evolved over the course of a number of years and several changes of direction; it originally started as a personal tool to address one individual's use case for a "Unicode-capable TeX", and g…

[deleted]

Re: Rewriting LaTeX in Pure Rust

#92
post #73

Earlier quoted context omitted.

The unsafe blocks can be removed one by one as time goes on. It's no different to any other legacy refactoring project: get the old code on a new platform, instrument/add unit tests, refactor piece by piece until the end result is acceptable.

> It's no different to any other legacy refactoring project There are two approaches to a project like that, as you say, take something which works and iteratively make it better, or derive a specification from the project which works and create a new from-scratch implementation to meet that specification. My experience with the "from-scratch" approach is that it is very easy to miss details in the specification that…

The more I read about legacy (and actively maintained) project refactoring, the more firmly I find myself agreeing that the gradual replacement is the right way to go about things in nearly every case.

Whether we like it or not, the old system is a source of truth about how things are done, so the only way to preserve this knowledge fully is to copy the whole thing as-is and then "restate" parts of that knowledge in a more organised/modern way by refactoring, leaving the rest in place.

Re: Rewriting LaTeX in Pure Rust

#93

I wonder Does this still depend, even indirectly, at the WEB files written by Knuth? It has the strange license that says "Copying of this file is authorized only if (1) you are D. E. Knuth, or if % (2) you make absolutely no changes to your copy." http://mirror.las.iastate.edu/tex-archive/systems/knuth/dist...

…Those version numbers… I love it! % Version 0 was released in September 1982 after it passed a variety of tests. % Version 1 was released in November 1983 after thorough testing. % Version 1.1 fixed ``disappearing font identifiers'' et alia (July 1984). % Version 1.2 allowed `0' in response to an error, et alia (October 1984). % Version 1.3 made memory allocation more flexible and local (November 1984). % Version 1.…

For those unfamiliar, Knuth's versioning scheme approaches pi and therefore never reaches 4.0 [0]

> In his seminal text layout system, TeX, and his equally brilliant typeface design system, METAFONT, Donald uses a versioning number system that asymptotically approaches perfection. The version numbers of TeX approach π (the current version is 3.14159265) and the version numbers of METAFONT approach e.

[0] http://sentimentalversioning.org/

Re: Rewriting LaTeX in Pure Rust

#95
post #73

Earlier quoted context omitted.

> It's no different to any other legacy refactoring project There are two approaches to a project like that, as you say, take something which works and iteratively make it better, or derive a specification from the project which works and create a new from-scratch implementation to meet that specification. My experience with the "from-scratch" approach is that it is very easy to miss details in the specification that…

The more I read about legacy (and actively maintained) project refactoring, the more firmly I find myself agreeing that the gradual replacement is the right way to go about things in nearly every case. Whether we like it or not, the old system is a source of truth about how things are done, so the only way to preserve this knowledge fully is to copy the whole thing as-is and then "restate" parts of that knowledge in…

If you’re interested in this topic, you should read “How to work effectively with legacy code” by Michael Feathers.

Re: Rewriting LaTeX in Pure Rust

#96

Could this unify LaTeX and MathJax? I feel like any rewrite of LaTeX that could address portability would be a huge plus.

Would you care to elaborate on the point of your suggested integration? Are you (seriously) proposing the inclusion of a javascript backend into *TeX distribution?

Re: Rewriting LaTeX in Pure Rust

#97

I'm not sure rewriting Latex in XYZ is a good idea. The whole thing is a mess and a pain to use (and I use it multiple times a week). Sure the documents often look good, but when they don't or there is an error, fixing it just becomes a nightmare. I wish somebody would design a modern typesetting system that would accept say latex equations but without 50 years of cruft and levels of macroses upon macroses.

I don’t like Word but it does accept Latex math and is easy to use.

Word does not use plain text input, and its output looks objectively terrible compared to LaTeX. These two things make it completely inadequate as a competitor.

Re: Rewriting LaTeX in Pure Rust

#99
post #48

Personally, I think this approach -- which as far as the engine is concerned looks like a largely-automated "translation" of xetex from C/C++ to Rust -- is misguided. The xetex code is a byzantine tangle of disparate pieces that evolved over the course of a number of years and several changes of direction; it originally started as a personal tool to address one individual's use case for a "Unicode-capable TeX", and g…

I don't agree.

Even if an automated translation isn't using the new language in a "proper"/idiomatic way this can still be a good base to start working, while ensuring compatibility. From there one cna start and extract pieces and rewrite individual pieces and do lots of refactoring.

It is a long and tidious process, but a process which has a chance of leading to less bugs than a rewrite from scratch, by working on smaller pieces which can be verified one at a time, even if no proper test suite exists.

Re: Rewriting LaTeX in Pure Rust

#100

Earlier quoted context omitted.

…Those version numbers… I love it! % Version 0 was released in September 1982 after it passed a variety of tests. % Version 1 was released in November 1983 after thorough testing. % Version 1.1 fixed ``disappearing font identifiers'' et alia (July 1984). % Version 1.2 allowed `0' in response to an error, et alia (October 1984). % Version 1.3 made memory allocation more flexible and local (November 1984). % Version 1.…

For those unfamiliar, Knuth's versioning scheme approaches pi and therefore never reaches 4.0 [0] > In his seminal text layout system, TeX, and his equally brilliant typeface design system, METAFONT, Donald uses a versioning number system that asymptotically approaches perfection. The version numbers of TeX approach π (the current version is 3.14159265) and the version numbers of METAFONT approach e. [0] http://senti…

You’re leaving out the best part! When he passes (hopefully not anytime soon[a]) the version number of TeX will become pi. Any and all bugs will become “features” at that point. Same with METAFONT; it’ll become e.

[a]: I’d love to get a full and complete set of The Art of Computer Programming (all volumes) written first (on his own time, of course), but I doubt that’ll actually happen. According to Wikipedia, there’s supposed to be 7 volumes, and he’s still working on the second half(?) of the 4th.

Post reply on HN