On Jul 27, 4:03 pm, johnjbarton <[email protected]> wrote:
> I can't figure out what you are proposing, but as you have figured out
> Firebug does not use Firefox's functionName, it's pretty worthless.

What I propose is that you allow a developer to add a property to any
function (call the prop firebugFnName, for example), and firebug will
use this explicit name for the function whenever it requires a
function name.  This is not a heuristic since it just allows a user to
explicitly give a function name before Firebug goes muddling around.
It makes sense in situations where the heuristics fail, but debugging
is a pain without function names.

> Instead Firebug has a totally hacky heuristic solution to look around
> in the source for a name. While I welcome suggestions, I am reluctant
> to hack on the hack, since we don't know what we are doing.  We don't
> have test cases for a heuristic solution for example.
>
> The entire enterprise is somewhat confusing. I finally concluded that
> function names don't actually make any sense in javascript anyway.
> Functions are properties of objects, that is what is important.  It's
> much more important to know "what properties of what objects point to
> this function?".

I take your point and do very much agree that function names are not
ideal, but they have served many other languages well for debugging
stack traces.  Even in languages like Javascript and Lisp, where
anonymous functions are commonplace, it is useful to have names
associated with functions on the call stack to give some context about
how an exceptional situation arose.

>  For example,
>
> function handleOnload(event) {..}
> window.addEventListener('load', handleOnLoad, true);
>
> What is important here? The string "handleOnload" helps us navigate
> from the addEventListener line to the function, but it has no
> significance.  We could write:
>
> function bizantyneFix13(event) {..}
> window.addEventListener('load', bizantyneFix13, true);
>
> just as well, and
>
> window.addEventListener('load', function(event){...}, true);
>
> On the other hand, if you can tell me what function is in
> window.onload property, now we're talking.
>
> Nevertheless I am interested in any incremental suggestions about
> function names.

My suggestion is to inspect the function object for an explicit, user-
defined name.

>
> jjb

Red

>
> On Jul 27, 3:19 pm, reddaly <[email protected]> wrote:
>
> > Hi,
>
> > Firebug does not detect the names of many of my functions as I wish
> > they would.  Many, many functions are labeled "anonymous."  Could I
> > assign a property to these lambda functions that will override the
> > default provided by firefox?  the relevant code to modify looks like
> > it's in lib.js in the function getFunctionDescription: function
> > (script, context, frame)
>
> > maybe a modification like this would work, but it is untested:
>
> >         if (frame)
> >         {
> >             var fnc = script.functionObject.getWrappedValue();
> >             var name = (fnc && fnc.fbName) || frame.name;
> >             var args = FBL.getFunctionArgValues(fnc, frame);
> >         }
> >         else
> >         {
> >             var fnc = script.functionObject.getWrappedValue();
> >             var name = (fnc && fnc.fbName) || script.functionName;
> >             var args = [];
> >         }
>
> > Best regards,
> > Red Daly
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Firebug" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/firebug?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to