ES4 draft: assert expression

Garrett Smith dhtmlkitchen at gmail.com
Wed Apr 16 11:28:14 PDT 2008


Sometimes errors might happen outside of an assert.

Then the developer would have to try to rely on other things, like
Spidermonkey's error.lineNumber and error.stack, or even
window.onerror, even though it is buggy.

It would be useful to get more error detail for free (w/o having to
predefine an assert()).

Is it a security problem to have a lineNumber and/or stack by default
on Error? If so, could it be addressed in some other way?

I don't have any problems with assert(), however, I would probably use
it mostly during debugging, to try and track down an error. In this
way, adding assert() would be a replacement for inserting
console.log(). I would not put in too many assert()'s in by default
because testing should be thorough and it should be done in another
layer.

I would still want to know about other runtime exceptions that weren't
wrapped in assert().

As for removing assertions, I would do that in my build process, if I
needed to.

Garrett


On Wed, Apr 16, 2008 at 10:08 AM, David Flanagan
<david at davidflanagan.com> wrote:
> David Flanagan wrote:
> [snip[
>
>        David



More information about the Es4-discuss mailing list