Follow

By popular request, I have decided to devote the rest of my life making XML-Python, the most efficient way to write Python

In plaintext:

<python version="3">
<def name="greeting" params="names, location">
<for var="name" iterable="names">
<print format="name, location">
<str>Hello {} from {}!</str>
</print>
</for>
<return>name</return>
</def>
</python>

@milofultz

Normally, the fact that attributes are unique is a nifty feature but it becomes awkward here with params and format still needing a separate parsing pass. Comma-separated words in a string. Instead, they need to be elements. <params><param>names</param><param>location</param></params>

@Sandra maybe the <def> tag needs a <meta> child tag that contains everything:

<def>
<meta>
<name>greeting</name>
<params>
<param>names</param>
<param>location</param>
</params>
</meta>
...
</def>

@milofultz Yeah, <head> and <body> is what lisp and HTML both call it. 👍

@Sandra I love that doing the XML best practices makes this already-bad-before-it-was-published joke so so so much more cursed, ty for your service

@Seirdy @Sandra I don't know enough to understand what that means, but I saw in a StackOverflow it has something to do with XML, so yes of course!

@milofultz Fun fact: XHTML5 has no DTD because it's just an XML serialization of HTML5 which gave up machine-parseable standardization. Breaks a few XML tools.

@Seirdy ohhhh I always wondered once I started trying to understand void tags etc. and seeing so much "well it's valid XHTML but not valid XML but it doesn't matter"

@milofultz Well it's well-formed but it's not something meant to be validated with a DTD.

I can type a JSON object in about ten seconds but it's not a valid ActivityPub message even if it's well-formed JSON syntax. I can write an XHTML5 document but it's not meant to be validated with a DTD, the vocabulary isn't defined like that.

@Seirdy how did HTML get the way it did? Is there/was there a reason to deviate from strict XML?

@milofultz It needed error handling to recover from bad markup instead of just aborting. It also switched to being a living unversioned standard since its standards often have errors which need to be corrected instead of frozen and enshrined.
@milofultz I learned all this last week when I converted seirdy.one to polygot markup and set up content-negotiation to deliver the markup as `application/xhtml+xml` if requested as such, and when I added XHTML + ActivityStreams + ostatus to my Atom feeds.

@milofultz

And when I work with XML, it looks like this:

(def (meta (name "greeting")
           (params (param "names") (param "location")))
     ...)

That’s been my relationship to XML for 20 years. (And I don’t even edit that directly; I use a tree outliner called paredit.)

The angle brackets notation is what’s dumb; there are a couple of other really big flaws with XML, but the angle brackets expression of it is what people really hate about it.

@Sandra I was just noticing on some of your last posts all the lisp going on. Is that for emacs stuff? Lisp seems rad, just never had an opportunity to get into it

@milofultz Emacs is a good IDE for doing lisp and I use it for writing lisp, but it's not for Emacs and it's a dialect Emacs can't use. This project: https://idiomdrottning.org/brev

@Sandra @milofultz that Lisp code is likely a possible SGML representation, but then, almost everything is. Yeah, I remember DSSSL too.

(Pet peeve: markup that had entities like >this< ...)

@scruss

I just ran the code that @milofultz posted through ssax to get the SXML representation.

@milofultz

What if you convert your XML to S-expressions...

;)

@ale this is what the online converter did and it's worse than I could have imagined

@milofultz Can this successfully cross-breed with soap in the wild?

@tychosoft I will say yes and then figure out what that is later

@milofultz (Reads through all the responses so far)
(Nods sagely)
(Adds xml:space="preserve")

_Now_ it’s XML-Python.

@milofultz sad to see that all names come from same location...

@scruss oh interesting! Haven't checked that out before, surprised it's supported by all browsers to convert on the fly like that

@milofultz the idea, back in the late 90s, was that HTML would go away completely as a delivery format, and all pages would be delivered in custom XML with XSLT to transform it to HTML in the browser. I know of a few pages that are like that still.

There was also XSL-FO, which was supposed to create fully-formatted documents. That one fell apart ages ago

@scruss This seems like a cool and fun way to serve sites. Not necessarily very ergonomic or user friendly, but the idea of a transitionary format for webpages seems like the right one. Thanks for sharing this!

@milofultz this what we call “mobile code”, right? *zwinkersmiley*
Sign in to participate in the conversation
Merveilles

Revel in the marvels of the universe. We are a collective of forward-thinking individuals who strive to better ourselves and our surroundings through constant creation. We express ourselves through music, art, games, and writing. We also put great value in play. A warm welcome to any like-minded people who feel these ideals resonate with them.