logoalt Hacker News

radicalethicstoday at 2:04 PM3 repliesview on HN

What happens if I simply add an iterator mechanism to HTML (well, I guess we need variables too)? Is it no longer a markup language here (I won't add anything else):

<for i=0; i<1; i++> <html> </html> </for>

Better question, why don't we upgrade XML to do that?


Replies

mimasamatoday at 3:01 PM

> Better question, why don't we upgrade XML to do that?

XSLT which is an application of XML allows you to do a for-each: https://developer.mozilla.org/en-US/docs/Web/XML/XSLT/Refere...

direwolf20today at 2:50 PM

That's basically the design of PHP with different syntax. <?for($i=0;$i<1;$i++){?> <html></html> <?}?>

Nobody uses PHP this way any more though — people treat it like Python or Node and write the entire codebase inside a big <? block

JSP is similar with different syntax again — nobody uses JSP either

I think ASP too but I never used that

show 2 replies
jraphtoday at 2:07 PM

That's not technically HTML anymore.

But if you disagree with this, or somehow work around this statement by replacing your for element with some "for-loop" custom element (it is valid HTML to add custom tags with dashes in their names), my stronger argument is at https://news.ycombinator.com/item?id=46743219#46743554