onchange event

Patrick Mueller pmuellr at yahoo.com
Mon Mar 9 15:28:05 PDT 2009

On Mar 9, 2009, at 2:40 PM, Juriy Zaytsev wrote:

> It is sometimes unfortunate that Function's Identifier can not be  
> set from a string value, without resorting to `eval`. Descriptive  
> Identifier's make debugging easier. ...

I think this is actually an important use case - debugging.  There is  
a similar problem with folks who build frameworks that eval() code -  
it's difficult, in debuggers like FireBug and Web Inspector, to  
disambiguate these from the places such things show up in lists, since  
the artifacts tend to have the same name like "Program" "eval'd  
source" or whatever.

FireBug added some new behavior to display the first few bytes of the  
eval()'d source, to help disambiguate.  I've now abused this so that I  
put a comment in front of eval()'d code that has an identifying mark.   
Hopefully, the following picture shows what I'm doing:


A nicer approach would be to define some kind of JavaDoc-like comment  
tag that would be used for the name.  This could be used to support  
both eval() and Function().

Another approach, for Function, might be for debuggers to support a  
notion of "debugToString()", which would get invoked in lieu of  
toString() for the debugger's own purposes.

In all the approaches, nothing actually needs to get defined in terms  
of the language, just in terms of additional things debuggers could  
support, that developers could take advantage of. If one of the  
primary use cases for naming is debug, this is probably a better  
approach to go down - extend the debuggers - rather than deal with it  
at a language level.

Patrick Mueller - http://muellerware.org/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20090309/d07fca19/attachment.html>

More information about the Es-discuss mailing list