- From: Dão Gottwald <dao@design-noir.de>
- Date: Wed, 02 May 2007 01:00:22 +0200
- To: Maciej Stachowiak <mjs@apple.com>
- CC: "T.V Raman" <raman@google.com>, public-html@w3.org
Maciej Stachowiak schrieb: > > > On May 1, 2007, at 10:33 AM, T.V Raman wrote: > >> Somehow this this "does not compute". >> >> Why aren't we defining Javascript the same way as what you >> describe --i.e. make every failing program "somehow work". > > JavaScript clearly defines error handling rules which are largely > interoperable with legacy practice. Bad syntax or other errors require > an exception to be thrown. It is also quite lenient compared to compiled > languages like C. For example, calling a function with the wrong number > of arguments is not an error. That has hardly something to do with error handling, as there's no "wrong" number of arguments. > Furthermore, JavaScript content is often > split into multiple scripts and event handlers. An error in one does not > make the others fail. However, HTML/XML documents are usually a single > unit, so truly strict error handling would lead to catastrophic failure. And a script has distinct states. Apart from syntax errors, if a flawed line isn't reached anyway, there's no point in making the whole script fail. If that line is only broken under certain circumstances, the interpreter can't even tell it's broken at the first glance (as opposed to HTML and CSS). >> Why aren't we even defining CSS that way i.e. "somehow make every >> CSS rule parse and mean something." > > Actually, the CSS clearly defines error handling. An erroneous CSS > stylesheet will still be processed with fallback rather than resulting > in a catastrophic error. That doesn't mean that all invalid CSS is > accepted as part of the language, just that there are requirements on > consumers for how to handle invalid content. > >> Why is HTML special? > > It's not special. We'd like it to have defined error-handling rules, > just like CSS and JavaScript. Compared to Javascript I think HTML is special. Ignoring a broken Javascript statement, i.e. going on regardless of the exception, would result in loads of more, uncontrollable errors and completely unexpected behaviour. This is not the case with HTML (and CSS), where you don't define linear "scripts". Faults can be isolated and thus handled separately and laxly. --Dao
Received on Tuesday, 1 May 2007 23:00:31 UTC