Hacker News new | past | comments | ask | show | jobs | submit login
HTML, the Programming Language (html-lang.org)
319 points by recursivedoubts 11 months ago | hide | past | favorite | 136 comments



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.


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


> hindley milner type system for the language

Hindley Type Milner Language

#ifixeditforyou


We're just a bit shy of "Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo", but with HTML.


You joke but XQuery isn't too far off


How about HTML, the programming language, 's Flying Circus with a very powerful yet flexible and optional type hinting system?


Parrot Typing.


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.


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!


The contents should be wrapped in a dangerouslySetInnerJS attr to prevent XSS


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.


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.


Personally I'm using CSS [0] on the backend, but might switch it out for HTML. It'd be cool to use the same technology for both. The CSS+HTML combo has some big limitations.

[0] https://dev.to/thormeier/dont-try-this-at-home-css-as-the-ba...


It would also be cool if someone would explore CSS for the frontend. I think isomorphic CSS could be a really neat stack.

Edit: I actually think I recall some pure-CSS frontend examples. We might just need to combine that with backend CSS technologies.

Edit edit: Probably the biggest issue will be to prevent the server from evaluating the CSS fully but maybe something like what Next.js does with server and client components could work here.


Would an HTML template system written in HTML lang be considered bootstrapping?


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!


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!


XSLT was the best!

Well, except for the syntax and the lack of resources and that it wasn't designed to be a programming language...

Okay so it wasn't the best. But somewhere in there is a language which does want to be the best!


XSLT might have the greatest ratio of brilliance to marketing of anything in our industry.

XSLT is a pattern matching DSL for converting trees into other trees. What things are trees? Programs.

It is also XML. XML is a boring business thing for boring business people associated with legacy Java codebases. We like json here. Or maybe yaml. To quote an otherwise excellent past colleague, "the pointy brackets hurt my eyes". It's horrible to edit in notepad too.

Who wants XML syntax for a purely functional programming language? No-one wants that, we write our compilers in C++ thank you.

As a bonus extra, "XML schema" are a similarly crufty rubbish old thing in nasty XML syntax that look suspiciously like "type of that tree". So you can typecheck the intermediate IR in your compiler pipeline. If you wrote it in the bad language from the before times. Emacs knows what those schema mean too.

The world has moved on to better marketed semantically worse things with prettier syntax. This brings me joy.


Hey, XSLT is functional, and functional languages are sexy, right?

What XSLT did do was standardize XML on a transformation language. JSON never really got that, and the ecosystem is worse for it.


Whoa there, “lack of resources”?!

The definitive and complete resource is Michael Kay’s XSLT book (originally Wrox Press, but now part of O’Reilly I think?). Granted, a paper book as a resource isn’t great, but it’s some book!

Kay went to Cambridge (Trinity) and did his PhD under Sir Maurice Wilkes. He’s no joke: one of the examples from the book is implementing the Knight’s Tour. Although this is only the chapter pre-amble, the commentary is indicative of what kind of book this is:

https://www.oreilly.com/library/view/xslt-20-and/97804701927...

It’s like Dijkstra writing the definitive reference manual for CSS and one of the formatting examples being an engine for solving Towers of Hanoi.

While I have qualms about the utility of XSLT as a general purpose language — it’s fine if you embed it in an imperative language a la SQL in Python, and awful if you try and use it standalone — it also gave us XPath which is by far the best way of querying markup that I’ve ever used. (Well, until CSS got attribute selectors, so I use it less and less these days I suppose.)

(You probably know all this, but it was interesting to add to the thread.)


So it's like... jq for xml, except the language is an xml dsl?

Is it pronounced "ex-slut"?


HTPL is what I immediately landed on too. Talk about confusing beginners!


> 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.


By the way, you can implement in HTML, the programming language, because it is extensible!

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


Maybe even

  <script src="my-macro-name" type="macro"></script>


It's "HTML" aka "HTML Turing-complete Markup Language"


Now the discussion around HTML being a programming language gets really muddy.

Thanks to "a slightly unhinged man living in montana"


Reminds me of xkcd's Frankenstein: https://xkcd.com/1589/


Is this "HTML-based" or "HTML, based"?


<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.


well that's no fun


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!


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!


As long as we're creating confusing names, are there any Hypertext Machine Learning projects (HTML)?


btw, this is a working programming language and there is an example of fib()

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

and live demo at the bottom:

https://html-lang.org/#live-demo

that runs disturbingly fast given the implementation is an inefficient recursive algo

computers are fast


I’m going to make it my career mission to build something on this that you have to maintain, recursivedoubts


based


[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


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


I appreciate your tireless efforts towards the perfection of HTML, the programming language, as well as its accompanying documentation.

Thank you!

All the best,


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)


progress... not perfection


I want this too.


s/stack/Slack/

(Neither am I)


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.


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: !???


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.


Oh, you reminded me about this article: https://www.defmacro.org/ramblings/lisp.html


I remember JSX examples that went in this direction.


...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.


> Footnotes: > This was revealed to me in a dream. > HTML: the programming language is brought to you by big sky software

Is the same big sky software :)

Had seen this pop up on github.. https://github.com/1cg/html.js


Look at the footer, the site is connected to htmx


Yes, I know. I think this "HTML, the programming language" is obviously a joke, so I'm asking whether htmx is also a joke - or an attempt at trolling web devs, more precisely - just disguised better... There is a whole book on htmx, but when it comes to trolling, some people definitely would put this much effort into making their trolling attempts more bulletproof.

I'm mostly joking, though. I think htmx is not likely to be a trolling attempt, but it would be absolutely epic if it was :)


Extremely based


Still better than YAML.


The next challenge - let it run itself:

   <script src="html.html"></script>


i made this


extremely cursed. great job


How many people have bought the shirt?


looking now... so far 0 (zero) people

still optimistic!


Hm, I'd order one, but unfortunately your form doesn't use proper ISO-8859-1 encryption so I'm a bit wary. It's always best to use ISO standards.


update: 4 (four) people!


So how high is my sales commission?


$0!


It's my birthday today so I might just not buy myself a little something.


should be at least 1 now


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"


just pushed another fix!


In the setting properties example I think it should be <rp>body</rp> rather than <cite>body</cite>.


thank you fixed!


Thanks, I hate it.


:heart-hands:


Everybody's so creative!


I did something similar for fun in uni: HTPL[1].

Basically, HTML->Python transpiler.

[1]: https://github.com/Koous61/htpl/blob/master/example/scratch....


Uh, why call it HTML? Why not call it HTML-Stack or something?

It's not HTML, but a language using HTML syntax.


it's not called HTML

it's called HTML, the programming langauge

(sometime I use "HTML" just to keep things shorter)


How about HTML: Turing-complete Machine Language


HTMLTML has a nice ring to it!


I’d shorten it to just HTML at that point, where the H is short for HTML:

HTML: Turing-complete Machine Language


ah, a good idea

i mean, who knows, maybe that's what HTML in HTML, the programming language stands for!


>ah, a good idea

nah, a GNU (new) idea


I think we need to save that for HTML, The Markup Language


How about HTML 2: Electric Boogaloo


HTMPL? “Hyper Text Markup Programming Language”

Then you could pronounce it “High temple”.


So, HTPL then.


It's web dev, the best way to get adoption is to trick people into using your stack


Ok, I guess I'll do Advent of Code in HTML, the Programming Language this year...


This almost reads like a deconstruction of my favorite explanation of Lisp: https://www.defmacro.org/ramblings/lisp.html

The explanation basically uses an AST that's apparent to the user to explain the language - and this is a language built on an AST whose structure is apparent to the user. I love it and will definitely be turning the idea over in my head for the next few days.


Should have called it HTPL.

That already exists, though: https://esolangs.org/wiki/HTPL


Worth it for the reference to Über die ästhetische Erziehung des Menschen (1795) alone...

https://www.projekt-gutenberg.org/schiller/aesterz/aesterz3....


Giving me memories of tag based Coldfusion days.


Same. I liked ColdFusion for what it was, but I also don't miss it. The spaghetti code I had to fix is what I remember most. While spaghetti code isn't a unique problem to CF, it is made so much harder to fix when you don't have a debugger and you can't right-click to find references. The horrors of endlessly nested cfloops inside cfifs with cfaborts and cflocation tucked away wherever the programmer needed it. never again!


Why is the iterator implemented as a GOTO instead of something like the following? Genuine question, I don't use stack based langs.

  <loop>
    <loop-statement></loop-statement>
  </loop>


in designing HTML, the programming language, i tried to stay as close as possible to existing semantics in HTML, the markup language, as I could, so that HTML, the markup language, developers would be comfortable with it in a minimum amount of time

most HTML, the markup langauge, developers are used to anchor tags (i.e. the <a> tag) with an href that begins with a hash "jumping" to that element. Therefore I decided to take that well known semantic and integrate it into HTML, the programming language.

there are multiple examples of loops using this (as well as the <i> "if" conditional) tag that I think show how intuitive this will be for most HTML, the markup language, developers, but of course research is ongoing in this and other matters


I guess I don't really think of HTML as "sequential" but I definitely do think of it as "composed." Meaning I don't often consider siblings elements, but I often do consider parent/child elements. Anchor tags that link to other parts of the doc are relatively rare compared to links to other docs. The only exception is stuff like schema definitions or reusable shapes in SVGs.

Either way, fun project!


research ongoing!


> Genuine question, I don't use stack based langs.

How and why not? What languages do you use?


Common ones like JavaScript, Java, C#, etc. They all have a stack, but aren't stack oriented like Assembly or Forth. The stack in modern languages is abstracted so you don't have to worry about pushing/popping values in a specific order, and you can't explicitly reference it. C and Rust is probably the closest I get with Heap v Stack memory, but even that is not truly stack oriented.

https://en.wikipedia.org/wiki/Stack-oriented_programming


Was literally reading that wikipedia page last night before bed, so this is all very timely for me.


Ah gotcha. Thanks.


Isn’t this just an XML language interpreted by JavaScript that just so happens to look like HTML?

And here I was hoping for someone to have discovered a way to make HTML Turing complete


How am I supposed to complete the LinkedIn quizz for HTML (the programming language) when the documentation states that <bdo> will result in values "anded" together >:(


pushed a fix!


I don't think using <dd> as <add> command when add could be used and a dd tag already exists is a good idea.

Same with sub, ul, ...

The more a I read the page the more it looks like a joke...


Great work! I’d love to see a server-side tempting engine written in HTML, the programming language that can be used to send HTML, the markup language files to clients.



This is awesome! Can’t believe I haven’t seen it before. Reminds me of HTMX in a way. Did this project come before or after it? Can you differentiate them? I’d like to use this in a hobby project but am not sure how it differs from HTMX. They seem to overlap in some areas?


I think the biggest difference is that EHTML works more with JSON API rather than with HTML Server Rendering integration.


HTMX works with JSON too.


could you please give a reference?


...what in the befunge?


Not enough. Wake me up when I can rewrite my C code in XML.


who can i sue over this? im outraged


is there a point to this? While it's fun to the author, it just reinforces a talking point that no experienced engineer take seriously but kept getting parotted by some people, to the detriment of beginners who believe in them.


JavaScript, the Markup Language


  div({ class: 'example' }, [
    p('Hello, ', [
      b('world!)
    ])
  ])


Needs more callbacks.


HTML is nested lists of named nodes with attributes... well.

LISP has done more, with less.


I can't not think about ColdFusion and CFML when I see that...


Yes but how do I use WebAssembly as a markup language?


This is the programming language of the century


This is the best kind of trolling, I love it!


Meme languages are getting out of hand.


Oh my god, they invented a worse XSLT


Super fun! Great work.


"... the html.js file ..."

Jesus. As a lover of plain HTML and a hater of JS, my head just burst and painted the walls.


Is this a dream.


is there any git hub repo for this thing


I thought the s tag was for sarcasm


</sarcasm>


eychtee emel


> This was revealed to me in a dream


Lets keep filling the internet with .....


[flagged]


Hey, would you mind reviewing https://news.ycombinator.com/newsguidelines.html and sticking to those rules when posting here? You broke them with this comment for sure, and it looks like some of your other comments may be breaking them as well; I haven't read closely enough to be sure, but they seem to be written in more of a flamewar/aggressive style than we're trying for on this site.

(p.s. just for clarity - I'm a moderator here.)


I'm really into this HTML web components trend. I built a similar set of primitive HTML components except the focus is to allow interfacing with data from my serverless platform.

See https://github.com/Saasufy/saasufy-components#saasufy-compon...

Actually, the elements from this article could complement my own nicely as they seem to provide more fine-grained control.

My platform is https://saasufy.com/ (you can log in with GitHub)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: