Remix.run Logo
JoshTriplett 4 days ago

Decades ago, I worked on the XCB library (the replacement for Xlib). I replaced the M4 macros used to generate all the X protocol bindings with XML protocol definitions and XSLT to do code generation.

The XML turned out extremely well, and it's still being used today, such as for bindings in several other languages.

Someone rewrote my XSLT in Python, and I cheered them on, because the result was much more readable, not least of which because the fundamentally procedural steps could be written in a procedural language with a good syntax, rather than XSLT's pure-functional language that suffered from being embedded in XML.

mcswell 4 days ago | parent [-]

Well said. I once had the displeasure of trying to write some code in XSLT (it had to fit in with existing XSLT code). It had to be the worst programming language I'd ever seen, with the possible exception of assembler. First, who decided that XML was a good format to write a programming language in? Punch cards would have been better. And second, trying to debug it was embarrassingly difficult.

xyz_opinion 3 days ago | parent | next [-]

XSLT is not a programming language. It's a declarative transform for XML, and when you need such a thing, it is extremely useful.

peterhunt 3 days ago | parent | next [-]

Let's see:

- Variable scoping https://developer.mozilla.org/en-US/docs/Web/XML/XSLT/Refere...

- Function definition and application https://developer.mozilla.org/en-US/docs/Web/XML/XSLT/Refere...

- Flow control https://developer.mozilla.org/en-US/docs/Web/XML/XSLT/Refere...

- Loops https://developer.mozilla.org/en-US/docs/Web/XML/XSLT/Refere...

- Module system https://developer.mozilla.org/en-US/docs/Web/XML/XSLT/Refere...

Yep, it's a programming language. And not a great one!

xyz_opinion 3 days ago | parent [-]

nah. its a transform for XML and its super useful when you need it. People such as yourself who claim its not a great programming language are probably not trying to use it for the right thing.

mcswell 2 days ago | parent [-]

I was using it to transform DocBook XML into LaTeX, based on an existing tool that used xslt code to do just that (https://sourceforge.net/projects/dblatex/). We had to modify the existing xslt code to allow for enhancements to DocBook that accommodated some linguistic structures (like interlinear text). So yes, we were using it for exactly the right thing: transforming XML.

xyz_opinion a day ago | parent [-]

yes, transforming xml. and it was useful. great!

edit: zomg mcswell I see you're the person I was replying to in the first place, to this absurd comment:

"First, who decided that XML was a good format to write a programming language in? Punch cards would have been better"

I mean come on.

mcswell 3 hours ago | parent [-]

I stand by my comment; apparently you don't recognize hyperbole when you see it.

At any rate, there's absolutely no reason for a command in any programming language to require open and close XML tags: it's a waste of space, and just gets in the way of understanding the program,. If you need to close a command, there are things like {}, semicolons, parens (LISP), exdenting (Python), or even--yes--the 80th column in a punch card.

mcswell 2 days ago | parent | prev [-]

On what grounds do you contend that it's not a programming language? There are other declarative programming languages, like Prolog, so I fail to see how the fact that it's a "declarative transform" makes it any less of a programming language.

aleph_minus_one 3 days ago | parent | prev [-]

> And second, trying to debug it was embarrassingly difficult.

I remember that in the past Visual Studio had a pretty decent debugger for XSLT.