Show HN: HyTags – HTML as a Programming Language
69 points| lassejansen | 1 month ago |hytags.org
It started as a way to write full-stack web apps in Swift without a separate frontend, but grew into a small language with control flow, functions, and async handling via HTML tags. The result is backend language-agnostic and can be generated from any server that can produce HTML via templates or DSLs.
velcrovan|1 month ago
The example from the link's main page is equivalent to:
[apparently HN strips all emoji but you get the idea]dragonwriter|1 month ago
No, its not. If it was, the attribute vs. child element distinction would not exist. HTML (and HTML-inspired XML) syntax is not a trivial alternative to S-expression syntax, it is more complex with additional distinctions.
A simplified subset of (HT|X)ML that uses only elements and no attributes is pretty much directyl equivalent to S-expressions, sure.
SkiFire13|1 month ago
chajath|1 month ago
lassejansen|1 month ago
radarsat1|1 month ago
Eric_WVGG|1 month ago
sedatk|1 month ago
scatbot|1 month ago
lassejansen|1 month ago
antomal|1 month ago
lassejansen|1 month ago
With hyTags one can do a lot of things without server calls and without resorting to javascript (e.g. inserting and deleting new rows, showing a loading indicator, validating input, animations, ...).
bdcravens|1 month ago
akhil08agrawal|1 month ago
But that said, this could unlock some interesting use cases where security isn't the primary concern. Like few internal tools, prototypes, small side projects where the tradeoff might be worth it.
lassejansen|1 month ago
doterobcn|1 month ago
css_apologist|1 month ago
- thoughts as i was reading this -
ok, so we're programming via an AST vs syntax
I think this is interesting, however there's notable downsides - verbosity, dom bloat & debugging
A potential upside to this is very odd but interesting meta programming capabilities, since the code should be able to inspect & modify itself fairly easily by inspecting the dom
I am inclined to distrust the claim that this reduces complexity as most of the actions are mutation heavy directly to the dom, and the stack based programming is something i struggle to practical examples where it is a significant improvement to mainstream strategies
lassejansen|1 month ago
You certainly must get used to the stack based approach. I tried to make it more approachable by making stack lookups type based (automatic search for value with matching type) and by using type-prefixed commands, e.g.
givan|1 month ago
iterateoften|1 month ago
catapart|1 month ago
I'm a little too enamored with web components to give it more consideration/testing, but it looks like it could be great for blue sky/green field projects.
replwoacause|1 month ago