Re: Namespaces, or getting function foo.bar() declarations to work
- From: António Marques <m.ap@xxxxxxx>
- Date: Thu, 25 May 2006 16:26:42 +0100
Richard Cornford wrote:
However, in all of these, the functions created are
anonymous. This may make no difference, but I don't
like it and it impacts debugging, when you're trying
to determine their name.
This assumption appears to be the crux of your issue, but
you have not explained or justified it. Most javascript
error reports output line numbers (at minimum) so I don't
see any need to have a name associated with the function
for debugging.
It's not an assumption, they really are anonymous. ...
That was not the assumption. The assumption was that using anonymous
functions would impact debugging. It is an assumption as anonymous
functions are common on non-trivial javascript and if their use really
was a problem when debugging that would have been noticed by now.
I said why it impacts debugging, if no one else is bothered by that is another matter. For all I know, people are tearing their hair off for the short supply of great javascript IDEs. I don't think it would hurt that a name could be determined for every function (if not their own, that of the variable they are assigned to, or that of the scope object).
function foo()
{
function bar()
{
debug('hello', 1, 'a')
}
}
And function debug would output something like
'10:04:55 [foo] hello, 1, a'
The 'hello' got into that output because you put it there, why not put
in the information that tells you what you need in the output, like
something that tells you the context of the debug call?
Only because it would have to be done every time. Given the dynamic nature of javascript, it's even possible that 'bar' is bound to other scope, so maybe something like
'10:04:55 [foo > bar] hello, 1, a'
'10:04:57 [dif > bar] hello, 1, a'
would be even more interesting. The next version of ECMAScript could surely define some more meta- functionality for functions, something that could be put to good use by IDEs.
--
am
laurus : rhodophyta : brezoneg : smalltalk : stargate
.
- References:
- Namespaces, or getting function foo.bar() declarations to work
- From: António Marques
- Re: Namespaces, or getting function foo.bar() declarations to work
- From: Richard Cornford
- Re: Namespaces, or getting function foo.bar() declarations to work
- From: António Marques
- Re: Namespaces, or getting function foo.bar() declarations to work
- From: Richard Cornford
- Namespaces, or getting function foo.bar() declarations to work
- Prev by Date: IE no doing "onload" function?
- Next by Date: multilanguage application
- Previous by thread: Re: Namespaces, or getting function foo.bar() declarations to work
- Next by thread: Re: Namespaces, or getting function foo.bar() declarations to work
- Index(es):
Relevant Pages
|