Live data from Hacker News

Sile: A Modern Rewrite of TeX

sile-typesetter.org

171–180 of 181 posts

Re: Sile: A Modern Rewrite of TeX

#171
post #142

Earlier quoted context omitted.

This description of TeX's process (originally by Knuth himself) is quite tongue in cheek but I fail to see why this makes TeX's programming paradigm 'awful'. Think of it this way: both C and C++ (even Rust has macros, which I heard is the new hotness) have a preprocessor, which is exactly what TeX's 'mouth' is. The fact that the language of the preprocessor looks very similar to the main language does not make it wei…

I'll probably try SILE just because it does not support macro. I personally think the adoption macro is the embodiment of non intuitive programming languages and why a modern programming languages, for example Rust is supporting macro is beyond me. I'm not alone in this regard, D a modern successor of C and C++ does not support macro. Hopefully one day Walter will write document on "Macro Considered Harmful" to enlig…

> D a modern successor of C and C++ does not support macro.

These are macros:

https://dlang.org/articles/mixin.html

Re: Sile: A Modern Rewrite of TeX

#172

TeX is one of those bits of software that's so complex to replace, it'll take another few decades (and likely a few false starts) before we can get there. The fundamentals of TeX's typesetting are amazing, but everything else is just bolted on. You'd probably want to rebuild it with its own, custom language, perhaps inspired more by modern XML/markdown rather than the old TeX language. The biggest problem that we're…

I never figured the purpose of MathML. It's ugly/impractical to type as a text-based format. Verbose and inefficient compared to a binary format. A middle ground some people might like, but I can't stand. I'd prefer one of these: - A human-writable text format that's displayed in a formatted way, eg TeX or MathJax - A binary format that represents structs and enums in code with a clear documentation of how it's packe…

Like SVG, the point is to easily embed it into other XML documents.

Re: Sile: A Modern Rewrite of TeX

#173

Earlier quoted context omitted.

Not even close, these are not plaintext based so you can't track changes with git, let alone automatic generation of formulas.

.docx files are a zip folder of plaintext XML files. Theoretically they could be tracked with git if you unzip/zip every commit/checkout.

This doesn't work well when XML is not hand-edited, but rather a dump of some in-memory structure - there are many cases where e.g. order is not important, so it can be essentially random during serialization, and that then shows up as spurious diffs.

Re: Sile: A Modern Rewrite of TeX

#174
post #169

Earlier quoted context omitted.

I'll probably try SILE just because it does not support macro. I personally think the adoption macro is the embodiment of non intuitive programming languages and why a modern programming languages, for example Rust is supporting macro is beyond me. I'm not alone in this regard, D a modern successor of C and C++ does not support macro. Hopefully one day Walter will write document on "Macro Considered Harmful" to enlig…

I respect your stance (although I disagree strongly) but you might consider something other than Sile, as Chapter 6 of Sile's manual is called 'SILE Macros and Commands'. Also from reading about D, his strongest objection to using macros is that they do not respect the scope. This is probably the main source of macros' strength as code generators. Again, I respect your aversion to macros, I am not sure I understand t…

The SILE approach for macro is very limited and sane. I think that's purposely to make sure that it's simple to understand, intuitive and maintain. More complex activities or programming is delegated to Lua as mentioned in the Simon's TUGboat paper:

> SILE’s \define command provides an extremely restricted macro system for implementing simple tags, but you are deliberately forced to write anything more complex in Lua. (Maxim: Programming tasks should be done in programming languages!)

Re: Sile: A Modern Rewrite of TeX

#175

Earlier quoted context omitted.

I'll probably try SILE just because it does not support macro. I personally think the adoption macro is the embodiment of non intuitive programming languages and why a modern programming languages, for example Rust is supporting macro is beyond me. I'm not alone in this regard, D a modern successor of C and C++ does not support macro. Hopefully one day Walter will write document on "Macro Considered Harmful" to enlig…

> D a modern successor of C and C++ does not support macro. These are macros: https://dlang.org/articles/mixin.html

It's technically not macro as mentioned in the same page link:

>C preprocessing expressions follow a different syntax and have different semantic rules than the C language. The C preprocessor is technically a different language. Mixins are in the same language.

D shows that it's possible to be a very powerful and potent programming language for DSL, etc, without all the conventional macro abuse and misuse.

If anyone asked me how come Python has becoming very popular nowadays, the answer will be it's one of the most intuitive and user friendly programming languages ever designed, and that's mainly due to the fact that it does not support macro [1].

[1]https://news.ycombinator.com/item?id=33431843

Re: Sile: A Modern Rewrite of TeX

#176

Earlier quoted context omitted.

> D a modern successor of C and C++ does not support macro. These are macros: https://dlang.org/articles/mixin.html

It's technically not macro as mentioned in the same page link: >C preprocessing expressions follow a different syntax and have different semantic rules than the C language. The C preprocessor is technically a different language. Mixins are in the same language. D shows that it's possible to be a very powerful and potent programming language for DSL, etc, without all the conventional macro abuse and misuse. If anyone…

It's not a C preprocessor macro. Those are a very specific and limited subset of macros, and that is the main reason why they're criticized.

Broadly speaking, if something can generate parametrized chunks of AST on the go, it's a macro. Which is exactly what D mixins do.

As for Python, it doesn't really need macros because everything is runtime. But if you need it, compile() and eval() are there, and they can be abused much worse than any macro facility ever could.

Re: Sile: A Modern Rewrite of TeX

#177
post #108

TeX and Literate Programming (and Lisp) are my fundamental, day-to-day tools. Code it, explain it, generate a Literate PDF containing the code. The programming cycle is simple. Write the code in a latex block. Run make. The makefile extracts the code from the latex, compiles it, runs the test cases (also in the latex), and regenerates the PDF. Code and explanations are always up to date and in sync. I have found no b…

You may be interested in using Org [1], in conjunction with literate-lisp [2] (for Common Lisp) and literate-elisp [3] (for Emacs Lisp). Org provides various outlining commands (among other things), letting you view your program at different levels of granularity. literate-lisp/elisp advise the Lisp reader so the Org file can be loaded and/or compiled directly, without requiring tangling. Consequently, tools like xre…

I should have mentioned that emacs is also a fundamental tool for all of my work. But since everyone, everywhere uses emacs that would be stating the obvious :-)

I tried orgmode. I even attended a course at CMU that used it for the "live notes". It is excellent for teaching. But it has the same flaw as the "live notebook" idea. There is no generally accepted structure to the approach.

Everyone "understands" books. They have a preface, chapters, an index, a bibliography, pictures, credits, and a table of contents. Literate programs leverage that shared understanding of the structure.

Think of a physics textbook. If you just copy every equation out of the book then you "have the code". All the rest is explanation. They belong together so the explanation and equations (code) are intermingled.

I'm a "primitivist". I work in straight text at an emacs buffer in fundamental mode.

The point of my code is to "talk to the machine". The point of my literate program is to "explain to other programmers (mostly 'future' me)". Note that this is NOT DOCUMENTATION. It is explanation, best presented in book form.

Re: Sile: A Modern Rewrite of TeX

#178

Earlier quoted context omitted.

It's technically not macro as mentioned in the same page link: >C preprocessing expressions follow a different syntax and have different semantic rules than the C language. The C preprocessor is technically a different language. Mixins are in the same language. D shows that it's possible to be a very powerful and potent programming language for DSL, etc, without all the conventional macro abuse and misuse. If anyone…

It's not a C preprocessor macro . Those are a very specific and limited subset of macros, and that is the main reason why they're criticized. Broadly speaking, if something can generate parametrized chunks of AST on the go, it's a macro. Which is exactly what D mixins do. As for Python, it doesn't really need macros because everything is runtime. But if you need it, compile() and eval() are there, and they can be abu…

It really depends on your definition of macro [1]. Modern programming languages like Scala, Julia, Nim, Rust etc are supporting hygienic macro.

According to D authors Mixin is not macro because Mixin still looks like D language while supporting macro would meant the inclusion of macro (hygienic or not), and depending on the implementation, most often than not will render the language unrecognizable (become non intuitive). Again if someone is purposely writing a DSL in D for generating a new language's AST then that's perfectly fine. Essentially the output is another programming language because it is the intentional product of the exercises but the original programming language is still intuitive.

I suppose you can have runtime macro like VBA but Python language designers refused to incorporate it due to issues as mentioned beforehand.

[1]https://en.m.wikipedia.org/wiki/Macro_(computer_science)

Re: Sile: A Modern Rewrite of TeX

#179

Earlier quoted context omitted.

It's not a C preprocessor macro . Those are a very specific and limited subset of macros, and that is the main reason why they're criticized. Broadly speaking, if something can generate parametrized chunks of AST on the go, it's a macro. Which is exactly what D mixins do. As for Python, it doesn't really need macros because everything is runtime. But if you need it, compile() and eval() are there, and they can be abu…

It really depends on your definition of macro [1]. Modern programming languages like Scala, Julia, Nim, Rust etc are supporting hygienic macro. According to D authors Mixin is not macro because Mixin still looks like D language while supporting macro would meant the inclusion of macro (hygienic or not), and depending on the implementation, most often than not will render the language unrecognizable (become non intuit…

Surely hygienic macros are a subset of macros, as follows from their name?

I still don't see why D's mixins aren't hygienic macros. And the D documentation doesn't make that claim, either - it only highlights the difference with C preprocessor, not macros in general.

OTOH I can't think of anything in VB6/VBA that resembles macros, runtime or otherwise?

Re: Sile: A Modern Rewrite of TeX

#180

Earlier quoted context omitted.

It really depends on your definition of macro [1]. Modern programming languages like Scala, Julia, Nim, Rust etc are supporting hygienic macro. According to D authors Mixin is not macro because Mixin still looks like D language while supporting macro would meant the inclusion of macro (hygienic or not), and depending on the implementation, most often than not will render the language unrecognizable (become non intuit…

Surely hygienic macros are a subset of macros, as follows from their name? I still don't see why D's mixins aren't hygienic macros. And the D documentation doesn't make that claim, either - it only highlights the difference with C preprocessor, not macros in general. OTOH I can't think of anything in VB6/VBA that resembles macros, runtime or otherwise?

Sure hygienic macro belongs to macro but saner.

Mixin is not macro according to D authors. If you dig into Walter's past posts, perhaps you can find better explanations there than mine.

You can have macro in any runtime for example Ruby language, and that's the main reason for the maxim "Rails is not Ruby". That's also the reason Ruby is so powerful and to create a similar feat in Java will be close to impossible [2]. But at what cost? That's why Python now is much more popular even though Ruby is much more powerful. You can, however, create Rails clone in D language without all the macro nonsense [3].

[1]Ruby Macros Explained:

https://codeburst.io/ruby-macros-18bb67e051c7

[2]Stop Designing Languages. Write Libraries Instead:

http://lbstanza.org/purpose_of_programming_languages.html

[3]Diamond CMS:

https://github.com/DiamondMVC

Post reply on HN