When is eval not an option due to memory leaks and bugs..? And in what
browsers?
True, eval is powerful, and the slowest function in JS, but I've only been
able to find one bug with it, a major one, and that was in Netscape 4.
(I'd explain it, because it's sooo freaky, and it has to do with prototype
inheritance from _within_ a function)
I have done tests with f= new Function("..."), and it seems that it has
roughly the same speed as evaling does, meaning that it either uses eval, or
native eval functionality, as does eval and setTimeout, setInterval.


----- Original Message -----
From: "Stephan Tolksdorf" <[EMAIL PROTECTED]>
To: "Daniel LaLiberte" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, October 18, 2001 12:06 AM
Subject: Re: [Dynapi-Dev] strings and functions


> Hi Daniel,
>
> thanks for your tips concerning concatening strings before writing.
> But this method is not applicable for the algorithm in question. The
> whole <script></script> is already written in one chunk.
> Combining multiple <script>-tags is not only not possible in our case,
> it is also pretty dangerous because Netscape 4's behaviour would be
> unpredictable.
>
> And there are other document.write bugs, especially in Ns4. Just
> search on groups.google.com and you'll find an endless list of error
> reports. Just one example:
> http://groups.google.com/groups?hl=de&selm=3B46E03D.1060503%40bioshop.de
>
> >  didn't follow why there is a need for eval, but changing to use of
> > anonymous function literals (e.g. f = function () {}) does NOT use eval
> > when the function is called; it merely makes the function anonymous in
> > that the function itself doesn't know its name.
>
> You didn't understand me. I meant the need to use function literals
> within evals because eval("function myFunction () {}") wouldn't affect
> the global namespace. The only way to define global functions in an
> eval statement is - as Michael pointed out - to assign a function
> literal, e.g. eval("window.myFunction = function () {}").
>
> Anyway, due to memory leaks and some other bugs in different browsers
> eval is not an alternative.
>
> Cheers,
>   Stephan
>
>
> _______________________________________________
> Dynapi-Dev mailing list
> [EMAIL PROTECTED]
> http://www.mail-archive.com/dynapi-dev@lists.sourceforge.net/
>


_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/dynapi-dev@lists.sourceforge.net/

Reply via email to