Eloquently sums up my feelings about the disadvantages of dynamic typing

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Oct 16 13:55:32 PDT 2013


On Wed, Oct 16, 2013 at 09:14:14PM +0200, Jacob Carlborg wrote:
> On 2013-10-16 19:26, H. S. Teoh wrote:
> 
> >Yeah, this is exactly what makes Javascript a royal pain in the neck
> >to work with.  I have the dubious pleasure of having to work on a
> >large non-trivial JS codebase at work, and it has a reputation of
> >simply displaying a blank page when something goes wrong. Worse yet,
> >there is some default error handler somewhere that swallows all JS
> >errors, so no errors get logged to the browser's JS console at all --
> >you have to debug the entire 50k or so lines of JS with a blank page
> >as your only clue as to what blew up.
> 
> Yeah, you really need to use the browser's developer tools to have any
> chance when working with JavaScript.

Even *with* developer tools, where would you even start? I mean, the
blank page could have resulted from any one point of about 5kloc worth
of JS initialization code (which BTW dynamically loads in a whole bunch
of other JS code, each of which need to run their own initialization
which includes talking to a remote backend server and processing the
response data, all before anything even gets displayed on the page --
don't ask me why it was designed this way, this is what happens when you
take the browser-as-a-platform concept too far). I think (relatively)
recently Opera's Dragonfly added a feature to break into the debugger as
soon as an error is thrown (rather than only when it's unhandled), but
even that doesn't seem to catch all of the errors.


> >(And don't get me started on IE6, which used to be the de facto
> >standard demanded by every customer some years ago, which doesn't
> >even *have* an error console. Fortunately, the world has moved on
> >since.)
> 
> Actually, just a couple of weeks ago I found Firebug Lite. It's like
> Firebug but it's a booklet in pure JavaScript (ironically). That
> means you can use it in any browser, include IE6 (yes it works in
> IE6), iOS and other browsers missing developer tools.
[...]

Nice! I'll have to keep that in mind when I next have to deal with that
horrendous JS code.


T

-- 
Political correctness: socially-sanctioned hypocrisy.


More information about the Digitalmars-d mailing list