by kaycebasques · 5y ago · 0 comments
> What can you say in this language that would be impossibly inconvenient to say in others?
The first experience that comes to mind for me was XSLT. Early on in my technical writing career, I needed to convert the Doxygen output of a C library to a more barebones HTML output (so that the reference docs would have the same branding as the rest of our site). I used XSLT to extract only the bits of HTML that I needed and I transformed them into nice, straightforward, semantic HTML. It took me a while to wrap my head around XSLT's flow but I was amazed to find that a task that would have taken probably 50-100 lines of looping and condition checking could be accomplished in literally 1-3 lines of XSLT.
Would love to hear other's experiences along these lines (i.e. concrete examples).
Pandas/Numpy is close but R's macro/custom operators make everything much more seamless.
R is definitely weird language, not as useful for general purpose computing, and has far less marketshare. But that's kinda the point of pg's essay.
XSLT doesn't do itself many favors, either, because the model depends on the execution of a few "hidden" default templates that drive the tree processing. If you don't know those are there or what they're doing -- or worse, if you don't know they're there and you accidentally override them -- then it's really hard to understand what the heck is going on. It just looks like poorly-defined magic.
Plus, you need to understand XPath to write effective templates and most people don't understand it as well as they think they do. It's deceptively powerful.
Finally, add on the fact that XSLT programs are themselves valid XML -- who the heck wants to write code in XML! -- and it really never had a chance to be understood, much less liked.
But many of its ideas were good!
Then you try to e.g. format a date or something.
As long as you stick to what it is good at and relegate everything else to another layer, it's fine (it could certainly be a lot better, though)
XSLT is basically SQL for structured text.
That is what XQuery is for.