Where HTML Beats C
HTML-код
- Опубликовано: 31 май 2023
- Recorded live on twitch, GET IN
/ theprimeagen
Legend's Original: • Where HTML beats C? - ...
Legend's Channel: / @computerphile
MY MAIN YT CHANNEL: Has well edited engineering videos
/ theprimeagen
Discord
/ discord
Have something for me to read or react to?: / theprimeagenreact Наука
The Guy In Computerphile Video is 21 years old he just work in HTML a lot
He doesn't nest his p's but he does nest his years.
That makes sense, I can feel the time dilation whenever I have to write some HTML.
HTML was originally designed to mimic real life printed documents and was founded in traditional typography and printing rules. With real documents there's no such concept as a nested paragraph. You can't write a paragraph inside a paragraph in real life. It's the same reason you can't have a inside of a , because the idea of writing a heading inside a heading on an actual document just doesn't make any sense. Whereas s are intentional generic, they're not a thing that exist in typography and are used for anything you want them for in HTML, so the rules for them are lax. It just seems odd from a programmer's perspective, but from a typography perspective it makes a lot of sense
fun fact, you can render your head and script tags on the page by simply setting their display to block
@@soniablanche5672 fun fact, you can just leave out your head and body and html tags on the page and it will still be valid. (in most cases)
((Are you kidding me (You can't write a paragraph inside a paragraph in real life)) I totally can)
@@cameron7374 the browser will add them for you
@@soniablanche5672 Yes, because the HTML spec says it has to.
Computerphile and Numberphile are indeed fantastic channels. They have their speakers write on paper for pedagogical reasons. These are teaching channels -- and because of that, the pace is deliberately slowed down. Typing in an editor tempts the speaker to go too fast -- and can easily turn a video from a "teaching" session into a "showing" session.
This is one of the those explanations that is probably totally made up but makes perfect sense 😂. I buy it.
@@pistonsoup3749 It's what I learned in the 1st year of a 15-year stint teaching physics, math, and programming at university level.
@@Impatient_Ape nice!
until -1/12 comes up 😅
It's also a way better editor than vim or emacs is
They didn't design html to tolerate mistakes, what happened is that it was faster/easier to ship early html interpreters with less validation. And as people started publishing websites with mistakes and interpreter interpreted it in some undocumented ways they had to keep whole mess for years to maintain backwards compatibility. Lack of validation in it's early phase then over time became the html spec. I cannot believe that someone now is trying to spin this into "yeah that's how html was designed to be".
... maybe the did plan this all along by making it without validation...
It’s the faster information over the wire with a tolerate protocol. Think how difficult is to transfer ham radio to become digital data that is usable on a computer. Their is a lot underline abstractions that goes on
Wouldn't be surprised if its the same story with javascript, I mean we got 50 different ways just to loop over something in it
@@ThePrimeTimeagen It's not a bug, it's a feature.
Bruh, this is exactly the kind of shit that gets us in trouble. This makes the angular 1 version break make sense.
In the old HTML spec P actually has an optional closing tag. On top of that, the spec says that P cannot contain a P, so if you do that, most browsers will just take the inner P and push it on to be the next sibling of the outer P so that the DOM meets spec.
it's not just p inside p, any block element will be hoisted outside the p
Ok, Mr. p!
Idea of optional closing of p came later. The first 1990s version of html didn't even talk about idea of a closing tag as well as some other tags like , , as composition of different tags at the time was very limited. As html grew in complexity and as they had to introduce more compositional features (nesting stuff inside ) they had to introduce all the closing tags yet at same time they had to keep it backwards compatible so closing had to be optional.
Yeah closing p tag is still optional. Likely will always be optional. In xhtml , closing tags were much more required. In fact, tags like "br" were written like . For awhile, people were producing files that were neither valid html nor valid xhtml . They added xhtml-isms to html that the browser parsers didn't completely barf on, because most html were forgiving tag-soup parsers
@zz zip I think my earlier reply got erased because I used links... The whatwg specs directly refute your assertions. span is a phrasing element and can nest with itself and other phrasing elements. the end tag for a span is mandatory. You can get away with not having the mandatory closing tag because the parsers in browsers are forgiving. I also recommend the W3C Markup Validation Service
P are paragraphs, and you can look in all your books, paragraphs are never nested.
when you say it that way... it makes perfect sense
Hahaha I actually started laughing out loud when he starts freaking out about the p tag.
ITS NEW TO ME.... OK
The reason why can't be nested while can be is purely because is a signal for accessibility readers to treat the block of text within it as a paragraph. That way, the ones using these readers can "skip" paragraphs the way we visually "skip" paragraphs. Hence why has to be in sequence and not nested. It makes no sense to nest paragraphs (which no one does it visually either). Both are block elements but both serve different purposes. Div on the other hand has no semantic value for an accessibility reader and as per specification should only be used as a last resort (when no other tag can give semantic meaning). Accessibility readers will just ignore the tag altogether (unless the tag is enhanced with ARIA attributes). Note: I said accessibility readers will ignore the tag itself but not the text within it. The text within it will render for accessibility readers as "StaticText"
I think you are hiiiiighly overestimating the competence and forethought of the people who made html at the time that they made it
@@BusinessWolf1 This isn’t a huge jump. Why would a paragraph be nested? I’d make the same decision if I were designing a markup language.
@@gaafts Legend says that the physicists in the office next door are still annoyed at the HTML designers for procrastinating from programming the detectors in CERN
Primeagen: I'm ready to get promiscuous, boys!
Prime's wife: What's that, dear?
i am in trouble...
Please do more Computerphile videos! The channel is amazing, the sister channels are great too, and this professor is far and away my favorite.
Computerphile and Prim is the Crossover ive been waiting for 😂😂😂
I don't always code in HTML, but when I do, I choose XHTML... which is blazingly fwast ♥
SMH, XHTML instead of HTMX
@@AlbrechtProud1 JS 🤮
XML >>
you know Tom already knew this, Tom is a genius.
Yep, it's Tom who invented HTML...
You can see from the syntax highlighting in Vim that you can't nest the tags. The second closing tag at 8:40 isn't highlighted like the other one because it isn't matching to anything. The first gets closed implicitly when you open the second one. Then you close the second one with one , and the second does nothing.
As someone named Sean, I am deeply offended :(
And how is Ghislaine pronounced? And the classic: Hermione? How many spellings and pronunciations for...George? Giorgi? Jorje? Georg? But it is never pronounced...GEOrge. My condolences Shawn, i mean, Sean, but this name is in fact, the worst offender of script mismatching the pronounciation
Seen
I'd say I hope he sees you, but we all know you've been sean
Bean, cream, dean, jeans, lean and mean. Bro. You should be offended, at least my Shaun the sheep knows how to spell his name
How is Hugh pronounced? And might I ask...why? How is Richard shortened to duck? Did you know that Harry is short for Henry?
The "21 years" part was just hilarious 🤣🤣
Prime, I've hooked several people on your videos. I almost got kicked out of a standup because i didn't stop repeating how blazingly fast my algorithm was
He hittin the algo hard
because the responsability of a is to hold a paragraph only. And paragraphs in a document are always sequential. but a is for holding anything even other divs.
It is weird, but kinda makes sense too. A is a paragraph, and it makes no sense to have nested paragraphs, semantically it is only one
Remember to floss your HTML programs regularly by parsing them with regular expressions. It keeps the ` ` s moist.
As a British person I believe I can help you out with the Java JavaR situation. The following word he was going to say was "or", instead of pausing between the two words, it is easier to buffer the "r" from the "or" and then continue. Don't ask me why we do it, it just feels right 😅
If you want to read more about it in linguistics it's called linking R and intrusive R and it's not a mistake, it's just how a lot of British English is spoken and a lot of other varieties with silent R like Australian. It originally happened because the silent R at the end of words jumps over to the next word, but because some words without an R are pronounced the same you get an "intrusive R". The hypothetical word "Javar" would be pronounced the same with that dialect so it's only natural to pronounce it that way.
Yeah it's like, we lost the R except before words with vowels, and then we forgot which words originally had an R, so now we use it everywhere.
If he struggles with Javar, imagine what he'd make of Bristollian, which has a tendency to insert an 'L' all over the place. As in "alright my lovel", and "in the areal".
Turns out a properly declared XHTML document will allow nested tags. So that's cool.
HTML was based on SGML. The thing about SGML is that it was designed in a time where harddrive space and network bandwidth were at a premium, so when you designed an SGML schema, you could choose to designate certain tags as having optional end tags by not allowing them to nest themselves. This meant you could ommit closing your , (because there's only one of each), , , and a few others, where it doesn't make sense to have two nested paragraphs inside themselves, or two list items nested inside each other (without declaring a whole list around the inner list item first) This isn't a case of HTML tolerating your mistakes, but trying to allow you to be terse in your representation.
The DailyWTF blog had a programming contest years ago where we were supposed to write a working desktop calculator application, using the worst possible programming methods and approaches. My calculator app had a service oriented architecture, with fault-tolerance. If the programmer had made a mistake in the client part of the application, and was attempting to invoke a backend method, but they misspelled the method name, it would take their request and use Soundex to find the closest matching function name, and call that. So for example, if there was a function called squareRoot, and the developer tried to call "skwareRoot" it would (probably) do the right thing.
Hellish, unholy C.
@@eriksilva631 My entry was not even close to the winner. The winner if I recall, did some crazy thing where they overrode the placement new() operator.
html is best programming lang
best lang always
^ never tried jdsl
@@David_Box jdsl uber alles
No one got fired for using HTML 😂
We need Tom to make HTMLDSL
About the default styling added to paragraphs: it's browser specific. Each user agent (=browser most of the time) is expected to come with a default CSS stylesheet. The styles from this sheet are applied if they are not overwritten by styling from author or user defined styles (using the infamous cascading rules from CSS).
The bit makes sense if you consider that it stands for paragraph. Nested paragraphs don't exist in natural language, so why should they in HTML (which initially was designed for document markup)?
Freaking out, how'd he know my name?!!
Bro where are you? cops all around the world is searching you!
@@aayush_karna ARRGGGHHH DOXXXED!!!!
I've only had 19 years experience with HTML and I knew you can't nest s.
3:26 pretty sure your college vibes are on point. As I recall the computerphile channel is mostly filmed at a university in the UK
Yes the professor in the video lectures at Nottingham University.
This college vibe is consistent across the world 😂. Why do we write on paper?
The cut on the ending is absolutely masterful.
The most refreshing video I have seen today. My YT recommendations can't get enough of this guy and I am all here for it!!! let's goooooooo..
you know what I mean ;)
^^
I know basically nothing about frontend, as I'm mostly an enterprise, ML, and systems guy, but I somehow knew about the serial thing from my time building static pages when I was five.
You don't need to close tags either
is the same. I literally used an editor back in the day that omitted ending tags and lists looked like this when you clicked the add list button:
Item 1
Item 2
Item 3
Then of course came XHTML and you had to put ending tags even inside starting tags: ,
Sean is the Irish word for John. The anglicised versions Shaun/Shawn would probably get reasonable approval from an English speaker for their spelling.
And another irish name.... Saoirse, pronounced sear-sha
👍
Actually it's 100% logical !
stands for "paragraph". Why would you want to nest a paragraph inside another? It doesn't even make sense.
A is just a container and it's logical to have containers nested inside other containers...
Please do more computerphile reactions! That channel is really good!
In the HTML 5 standard and don't require a closing tag. And anyone who omits the closing tag is far worse than those who spell Sean as Sean.
It does actually closed it, `p > p` transforms into `p, p, p` (last one is empty and only apperears if you don't miss any closing tags). And CSS styles are also applied as if `p`'s weren't nested
Got schooled, son! 😂
But, seriously Computerphile's an amazing channel. Pls feat more videos from them.
Imagine the will be used as non-nesting block element
I hope this gets fixed.
I could be wrong but p only accepts inline elements. it will close immediately when you add blocks, like div, p, h's etc
Its reassuring there is a delta in experience from 20 to 21 years of programming.
Means that the journey never ends!
open up any book or article ever written and try to find a paragraph inside a paragraph, you can't, that's why you cant nest the p's and HTML is smart enough to know it
Putting your P inside a P considered harmful.
I learned it when svelte did not allow me to do so, however it has never been tempting to me because I have conceptualized the P tag as an "ordinary paragraph of a text document" like in LaTeX (but marked on the begining, not at the end).
Watches video from a university based channel with a professor:
"Why am I getting college vibes"
Computerphile is an awesome channel.
When is the last time you read a book with nested paragraphs?
15:28 It has simple answer i think. How we write paragraphs for example in books? One after another. Thats it. It is based on how text formating works anywhere else. That is why paragraph elements are not nested but others are.
8:50 This is such quality content. 😂 Loving it
Did you look at the _kind_ of paper he is writing on? I get yellow nicotine stains and unsolicited printer-troubleshooting-tattoos just from looking at that !
Thats how you know the primeagen is a true html dev, when didn't work he went straight to screaming WhY dOeS iT nOt WoRk
I take minor exception to him saying it's ambiguous... It makes parsing more complicated, but you just need an algorithm to deterministically choose one parse-tree over the alternatives... Which, whatwg and others ended up having to do so that all the tag-soup parsers could have same parse when given less-than ideal html.
{{ 9:53 nesting sequencing then you must put your end tags in if you want to be
9:58 unambiguous otherwise how can it be repaired }}
I think you should do a stream where your program with old time paper and a sharpie marker
Why don't you use picom for the screen tearing? I'm using picom with xorg and i3, and it works just fine. I don't stream though, so I don't know if it causes problems with streaming software. It may be less of a jump than i3 -> sway.
"Where is your indenting, sir?" 😂😂😂 That crushed me 😂
Because P is semantically a paragraph of text it is treated sequentially. Printed writing generally doesn’t have nested paragraphs either so I guess the idea was to emulate that.
I love how computerphile manages to impress everyone that watches them because there's always something you don't know
Might be wrong but as far as I recall react raises a warning if you nest 's and nextjs failes ssr if you nests 's no clue why haha.
10:15 "And I am not going to try and be clever."
No, that's exactly what it's doing.
Div is a layout block element, P is not a layout block, simple as that.
Hell in your div in div exmaple the text in your div gets converted to a p because screen readers look for p tags as information that needs to be read to the user while not caring about layout blocks outside of how it defines ordering or the data blocks
Dope reaction so far from Mr PrimeAgen 🤣🤣🤣🔥
back in the old days, people used to use tags like tags. So that's why it works like that.
You do it with P vs DIV because they are semantically different. A DIV is a division of the page and be broken up however you see fit. A P is a paragraph and a paragraph inside another paragraph makes no sense in a book/content sense. It would be like nesting 2 video players inside each other. You can have them next to each other in a sequence, but doesn't make sense to nest them. It's the same with P tag.
I love how frustrated u got from learning about the auto-closing behavior of certain tags in quirks mode of HMTL
Professor Brailsford is a treasure. And he even taught Prime something new.
My father used to have like half a ton of these papers stored in his office drawers and cabinets.
I have it on good information that Tom never closes his paragraph tags.
The Screen tearing ❤🤌😍
HTML has a lot of defaults.
I wonder how good that is.
It does allow new developers to get started quickly.
But it also means there's a lot of magic involved.
Magic is bad in the long run imo.
"I guess you need _21_ years of experience doing HTML" was the chef's kiss comment on this one😆
You know prime, the concept of ps being serialized makes them a lot of sense. How many times have you read a book with text in it where you have multiple paragraphs nested inside of one another. The entire point of the p-tag is to format text, I'm sure there are more than a few front-end designers who have used them for other things but the general specification is just to format blocks of text.
You've gotta have a really big P not to worry about the end of it.
I'm always running in to the end of my P when I use it.
Same thing will happen to a or h1 as they are meant to represent a link or heading respectively and nothing else. Not like div which is a generic container to contain any thing..
It doesn't make sense to nest . That would be like nesting
It's about semantics. A paragraph should just be a paragraph. DIVs and many other block level elements make sense to nest, but it doesn't make sense to nest a block level element within a paragraph, so it assumes you forgot the ending paragraph tag when it encounters a block element within it.
List items are similar. You can skip the closing tag if it won't cause any nesting issues.
Love the guy that said "netflix btw" when they proofed him wrong on the p tags
Well how many times would come up that would make you think nesting Ps within Ps would be an option
If there is a computer, there is also a bug.
@ThePrimeTime did you just accidentally advocate for whitespace controlled nesting
Probably is some dark alley, it wouldn't dare to do that in public.
It is on one hand impressive that html does fix mistakes on its own, on the other hand its a security nightmare we've spent 20+ years trying to avoid
6:45 Wrong, it just assumes that it is nesting, and just continues that as long as they are not all closed.
The nice thing is that it isn't strict about if it can end without you closing all the tags
Sean isn't an English name, it's Irish Gaelic. The Gaelic languages are friggin' psycho in terms of spelling. Don't even look at Welsh, it's nightmare fuel.
damn fuel of nightmares
👍
The P truly broke him this time, guys.
Paragraphs don't nest the way you would think. I actually knew something you didn't for once.
The thing is that P is for a document, academic document, so why would get a typewriter and "nest" paragraphs?
CHECK MATE
you can make mistake in html, but never an error
He will never switch to sway 😭😂
I think that block nesting elements is forbiden due to accessibility concerns. HTML is not just code, but data with metadata embed, and screen readers or bots can make use of it to make semantic sense from the tags used (semantic HTML). Allowing p tag nesting (same for h1, h2, etc...) has no semantic meaning. A real world paragraph will never have another paragraph inside itself because that is part of what a real world paragraph is. And the same for titles h1, h2, and so on...
I never expected that trying to learn programming would involve this guy screaming pee several times
It does make sense, what is a paragraph of a paragraph? And what is a division of division?
And in a short wile you realize it doesn't make sense to think about all of it if it does nest by default.
Mr. Paulson's bewilderment at how smart browsers are is baffling.
I also use xorg so it's just double screen tear goodness
Do all linux distros have screen tearing?
By treating p in a specific way mean that then Ps and Ds be interchangable. If so wouldn't that then mean the intentions of symantics are just a facade of confusion.
lil bro is a 10x dev, works at netflix btw, but cant fix his screen tearing since dinosaurs were around
This is the best video 😂
"Once you start messing with the pee, then everything gets screwed up"