top | item 38519719

HTML, the Programming Language

319 points| recursivedoubts | 2 years ago |html-lang.org | reply

135 comments

order
[+] DistractionRect|2 years ago|reply
It's too early in the week, and I'm too sober for this.

My one nit, is the lack of static typing. I'm not a fan of radically changing the direction of a project, so instead of baking it into HTML, the Programming Language I suggest the TypeScript route. Something like a hypertext typed programming syntax, HTTPS, to compile to HTML, the Programming Language.

[+] recursivedoubts|2 years ago|reply
considering a hindley milner type system for the language, but it would be a big lift w/ explicit stack semantics

also looking at HTML, the programming language,++, or, possibly, Objective-HTML, the programming langauge, which would be easier to get to and potentially more awful

[+] lassejansen|2 years ago|reply
I'm using Swift Result Builders as a statically typed language to generate HtmlScript code (which a similar approach as html, the programming language):

https://htmlscript.org

This works pretty well for composable server side generated view components.

[+] gemstones|2 years ago|reply
One suggestion - it would be really cool to allow FFI. Something like

    <script type="text/javascript">
      const foo = (bar) => {
        document.getElementById('my-element');
        // More here!
      };
    </script>
That way you could really leverage the full power of HTML, the programming language!
[+] cantSpellSober|2 years ago|reply
The contents should be wrapped in a dangerouslySetInnerJS attr to prevent XSS
[+] recursivedoubts|2 years ago|reply
HTML, the programming language, is fully interoperable w/ JavaScript, the programming langauge (sic):

https://html-lang.org/#js

functions defined in HTML, the programming language, can be invoked by JavaScript, the programming language (sic) and vice versa.

[+] laurent_du|2 years ago|reply
Finally I can use html on the frontend and the backend! I am adding a "full-stack html" badge to my Linkedin account right away.
[+] dexwiz|2 years ago|reply
Would an HTML template system written in HTML lang be considered bootstrapping?
[+] MikeTheGreat|2 years ago|reply
The best part is how they have to keep repeating "HTML, the programming language" or "HTML, the markup language" everywhere in an attempt to keep things clear :)

It would be awesome if they were using some sort of macro system / templating engine to consistently expand {{html_prog}} and {{html_markup}} just to keep it straight while they're writing it.

Thank you for posting this, it made my day a bunch brighter!

[+] gorgoiler|2 years ago|reply
HTPL?

I appreciate their joke, but “HyperText Markup Language, the markup language” is a little redundant.

Some of us have had to include XSLT programming in our careers. We have seen into the dark abyss… and been paid to do it!

[+] jraph|2 years ago|reply
> It would be awesome if they were using some sort of macro system / templating engine to consistently expand {{html_prog}} and {{html_markup}} just to keep it straight while they're writing it.

You could use the <template> tag.

    <template id="my-macro-name">
        <!-- some operations -->
    </template>
To use it:

    <source src="my-macro-name"/>
Using source to look familiar to bash users because why not.
[+] paulddraper|2 years ago|reply
It's "HTML" aka "HTML Turing-complete Markup Language"
[+] xupybd|2 years ago|reply
Now the discussion around HTML being a programming language gets really muddy.

Thanks to "a slightly unhinged man living in montana"

[+] scop|2 years ago|reply
Is this "HTML-based" or "HTML, based"?
[+] moritzwarhier|2 years ago|reply
<output> is an obscure tag that I think allows to exploit accidental turing completeness similar to the checkbox hack.

Or is it? I once considered using that tag for some price calculator widget, but it couldn't even replace a div because of styling issues or something.

That being said, I spent like half a minute trying to figure out the point of this post and then lost interest...

Will try again, was hoping for a funny Rube Goldberg machine instead of T-shirt merchandise.

So nah, it's about as "based" as blogging about JS frameworks IMO.

[+] chrismorgan|2 years ago|reply
Not fond of using single-row tables for objects; definition lists are far more suitable:

  <dl>
      <dt>foo<dd><s>Foo</s>
      <dt>bar<dd><data value=10></data>
  </dl>
You could reasonably leave tables as a way of defining an Array<Object>.

Using <dd> for addition and <dt> for duplication just makes me sad. It almost makes be suppose you don’t care about HTML (the markup language) semantics!

[+] recursivedoubts|2 years ago|reply
good news! HTML, the programming langauge is completely pluggable so you can redesign it to your own tastes!

https://html-lang.org/#extending

and, in fact, HTML, the programming language, programs can modify not only themselves, but also the language itself, at runtime!

interesting possibilities await you, the programmer of HTML, the programming language!

[+] xnx|2 years ago|reply
As long as we're creating confusing names, are there any Hypertext Machine Learning projects (HTML)?
[+] toddmorey|2 years ago|reply
I’m going to make it my career mission to build something on this that you have to maintain, recursivedoubts
[+] halosghost|2 years ago|reply
[1] suggests that I should define functions with the `<dfn>` tag, but the documentation appears out-of-date, because the HTML program sample shows using the `<def>` tag. Is the next revision of HTML, the Programming Language, A Programming Language going to cover the difference between the `<dfn>` and `<def>` tags, or deprecate one of them?

All the best,

[1]: https://html-lang.org/#defining-functions

[+] recursivedoubts|2 years ago|reply
it appears there may have been an error in the example (not in HTML, the programming language, which is correct by definition)

i tried to fix it

[+] mrighele|2 years ago|reply
Maybe I am mistaken but it seems to me that the stack is implemented with a Javascript. I am a bit disappointed, in the sense that the stack too could have been implemented as a a list of tags in the containing document.

This would enable interesting features such as visual debugging (you just check the document to see the status of the program) and more importantly would enable the "code as data" paradigm, giving us easy metaprogramming and essentially a "lisp with brackets"

(Yes, I am not being completely serious)

[+] GuB-42|2 years ago|reply
Interestingly, since it is actually XML, you could take advantage of all the XML features. A XSD may be able to encode the language grammar, and with XSLT, get some nice rendering.

Of course, the parser is just a DOM parser, which is built in browsers and that's what the interpreter is using. But if you want to write a standalone compiler for it, just take an off the shelf XML DOM parser and you have your AST.

[+] xyproto|2 years ago|reply
This makes conversations that much harder:

Mallory: Is HTML a programming language?

Bob: No! Well some people think is, but they are wrong! Then again, there is the HTML programming language...

Mallory: !???

[+] g9yuayon|2 years ago|reply
I remember in the hay days of XML, someone made an article that discussed why XML is really just a language of S-expressions. This article seems argue something similar.

P.S., S-expression or not, XML-based DSLs are horrible. I don't know how many people have PTSDs using ANT or a slew of commercial "user-friendly" DSLs for test automation, process automation, and etc. It turns out the companies just didn't know how to design small programming languages and certainly lacked of compiler-writing skills.

[+] k__|2 years ago|reply
I remember JSX examples that went in this direction.
[+] klibertp|2 years ago|reply
...now I'm starting to wonder whether htmx and _hyperscript are similar to this, just disguised better...? And I was seriously considering using htmx for one thing, too.
[+] dewey|2 years ago|reply
Look at the footer, the site is connected to htmx
[+] imhoguy|2 years ago|reply
The next challenge - let it run itself:

   <script src="html.html"></script>
[+] recursivedoubts|2 years ago|reply
i made this
[+] arp242|2 years ago|reply
How many people have bought the shirt?
[+] protopete|2 years ago|reply
Hey I noticed that the division code example is using the "ul" tag instead of the "div" tag. Thanks!

Edit: nevermind, but the comment still says "This ul tag"

[+] dullcrisp|2 years ago|reply
In the setting properties example I think it should be <rp>body</rp> rather than <cite>body</cite>.
[+] krapp|2 years ago|reply
Thanks, I hate it.