Re: get object name from within object
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: get object name from within object

From: Lasse Reichstein Nielsen <lrn@hotpop.com>
Date: Sat Jul 23 2005 - 12:57:20 CEST

"Richard Cornford" <Richard@litotes.demon.co.uk> writes:

> Which means that the only circumstances where arguments.callee would be
> necessary is when the function is anonymous (the result of an anonymous
> function expression or the use of the Function constructor, but only
> sometimes),

... in which case there is no name to find ...

> or when the author has (rather stupidly)

(probably why I didn't even consider it :)

> re-used the function's name as a formal parameter, local variable or
> inner function name and so masked the property on the scope chain
> that refers to the function itself.

But still, the original poster's question went to the name of the
function, not the function itself, so going through "callee" is
more work than is normally needed.

I would pass the function name as a parameter to the PHP function that
generates the JS function. It's much safer than trying to deduce it on
the client.

/L

-- 
Lasse Reichstein Nielsen  -  lrn@hotpop.com
 DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
  'Faith without judgement merely degrades the spirit divine.'
Received on Tue Oct 18 03:00:18 2005