4 ms·
the proposal is for type annotations, which are to be treated as comments. i want type checking to be done in the browser, whether it's before the javascript is
by asddubs 4y ago
the proposal is for type annotations, which are to be treated as comments. i want type checking to be done in the browser, whether it's before the javascript is run or at runtime isn't important, the point is that i want the browser to explicitly be forced to do it. and then if I'm sure my types are correct and I want to speed things up, I can strip out the type annotations. but this means that for smaller scripts, or in general during development, you don't need an extra compilation step at all.
I want the browser to reject feeding a string into a number parameter of a function, at which point it does this isn't important to me as much as that it should be more than just a comment that is ignored completely.
- shadowgovt 4y agoIf it's static analysis, then the browser can always execute it and throw it out after execution, that's the nature of static analysis. There would absolutely have to be an escape hatch, or configuring one's browser in this way would make most of the web fail to work (and unfortunately, the golden rule for features in browsers is "if it breaks most existing sites, you can't add it because most users aren't savvy enough to understand what is happening and will uninstall your browser in response"). But I can't actually see anything stopping a given user agent from choosing to offer that as a development feature for a specific domain, which would be pretty swell.