Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

After reading the article, it sounds like a terrible idea to port that sort of program directly to Clojure (gotos, globals, and mutable state) without performing an intermediate port to a C-like high-level language first.

TeX may have fewer dependencies (given that it predates many libraries), so `Go` would probably a good target for an intermediate port - imperative/procedural, globals, goto support, static compilation.

Modernize this program in Go, then port it to Clojure.



Perhaps Glenn has different goals than you might expect? The video goes into this better than the InfoQ article.

In short, I think Glenn embraced the differences and challenges of adapting TeX in Clojure from an educational perspective. I don't think he intended to port it quickly or verbatim.

Glenn wanted to head-to-head comparison to promote education. To explain, in Glenn's talk around 11:36 (https://www.youtube.com/watch?v=824yVKUPFjU) he says:

> While I'm glad that the source code of TeX is still available to study, I sure wouldn't point a new programmer toward it because we should not be doing programs today like we did then.

> But what might be really valuable is to have a modern reimplementation written in a modern functional style to study alongside [the original TeX] to see how much has changed and to appreciate what he have and the value of improved tools and techniques and the tradeoffs that have been made.

His slide on his educational goals can be seen at 12:06:

> Illustrate what's changed

> Demonstrate values of expressive code

> Provide real examples of expressing procedural algorithms in functional style

> Show how functional programs are easier to reason about

> Show different styles of optimization


As the article makes clear he isn't doing a direct port to Clojure. He wants to write it in idiomatic Clojure, so it's in a much more functional style than the original code. Obviously it won't use gotos (because Clojure doesn't have them) and I imagine globals and mutable state would be used very sparingly as well.


After hearing the talk, I certainly was struck by the complexity of TeX and the mental challenge of adapting it.

It seems unlikely that doing two ports (first to Go, second to Clojure) would result in less work overall. I would not expect that a procedural-to-functional adaptation would be made dramatically easier by porting to Go first.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: