By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,598 Members | 1,894 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,598 IT Pros & Developers. It's quick & easy.

Non-deprecated arguments

P: n/a
Hi,

Currently I am using
argument.callee.caller.arguments
to get the arguments of the caller function, but Firefox complains that
arguments (of Function) is deprecated.

Is there a way to get the arguments of the calling function in a
non-deprecated way?

I use this to do type-safe validation of the parameters by calling a
special validate function at the beginning of some javascript functions
and it really helped me. And now I just noticed it gave deprecated
warnings in my Firefox in strict javascript mode.
Of course I can pass the local arguments to the validate function, but I
want to keep each call to validate as easy to use as possible.

Thanks for any comments.

Robert.
Sep 29 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
post some code and results
"idiot"
"Robert" <ro****@noreply.x> wrote in message
news:43***********************@news.xs4all.nl...
Hi,

Currently I am using
argument.callee.caller.arguments
to get the arguments of the caller function, but Firefox complains that
arguments (of Function) is deprecated.

Is there a way to get the arguments of the calling function in a
non-deprecated way?

I use this to do type-safe validation of the parameters by calling a
special validate function at the beginning of some javascript functions
and it really helped me. And now I just noticed it gave deprecated
warnings in my Firefox in strict javascript mode.
Of course I can pass the local arguments to the validate function, but I
want to keep each call to validate as easy to use as possible.

Thanks for any comments.

Robert.


Sep 29 '05 #2

P: n/a
commercial wrote:
"Robert" <ro****@noreply.x> wrote in message
Is there a way to get the arguments of the calling function in a
non-deprecated way? post some code and results


I posted all the code that is relevant to my question

argument.callee.caller.arguments
"idiot"


Interesting signature.
Sep 29 '05 #3

P: n/a
I am no expert on this, but you could try emulating the arguments
property of Function:-

function f1(a)
{
arguments.callee.arguments=arguments;
f2();
}

function f2()
{
alert(arguments.callee.caller.arguments[0]);
}

Sep 29 '05 #4

P: n/a
commercial said the following on 9/29/2005 4:05 AM:
post some code and results
Learn to read and no code is needed for that question.
"idiot"


Talking about one's self is not a sign of intelligence.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Sep 29 '05 #5

P: n/a
Robert wrote:
Hi,

Currently I am using
argument.callee.caller.arguments
to get the arguments of the caller function, but Firefox
complains that arguments (of Function) is deprecated.
But doesn't tell you that the - caller - property is a JavaScript(tm)
feature, non-standardised and certainly not cross-browser?
Is there a way to get the arguments of the calling function
in a non-deprecated way?
No, a function's arguments are only exposed inside the function by ECMA
262, and there is no - caller - property of either the function or its
arguments.

<snip> ... . And now I just noticed it gave deprecated
warnings in my Firefox in strict javascript mode.

<snip>

Switch strict warnings off. There are not suitable for general browser
scripting and some are irrational and/or factually incorrect.

Richard.
Sep 29 '05 #6

P: n/a
Richard Cornford said the following on 9/29/2005 4:51 PM:
Robert wrote:
Hi,
<snip>
Is there a way to get the arguments of the calling function
in a non-deprecated way?

No, a function's arguments are only exposed inside the function by ECMA
262, and there is no - caller - property of either the function or its
arguments.


Whether or not ECMA says it should be exposed or not is irrelevant. If
Mozilla based browsers expose it, then it exposes it. If IE exposes it,
then it exposes it. If they don't, then they don't. And it has nothing
to do with ECMA.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Sep 30 '05 #7

P: n/a
Richard Cornford wrote:
Robert wrote:
Hi,

Currently I am using
argument.callee.caller.arguments
to get the arguments of the caller function, but Firefox
complains that arguments (of Function) is deprecated.

But doesn't tell you that the - caller - property is a JavaScript(tm)
feature, non-standardised and certainly not cross-browser?


That's right. It does not tell me this.
Is there a way to get the arguments of the calling function
in a non-deprecated way?

No,


Well that's too bad. I don't mind that some things get deprecated, but
why deprecate something without any means to achieve the same
functionality in another way....

Robert.
Sep 30 '05 #8

P: n/a
Robert wrote:
Richard Cornford wrote:
Robert wrote: <snip>
Is there a way to get the arguments of the calling
function in a non-deprecated way?


No,


Well that's too bad. I don't mind that some things get
deprecated, but why deprecate something without any means
to achieve the same functionality in another way....


There is nothing stopping you passing the - arguments - of one function
as an argument to another. So where you call a function that then
attempts to access it's callers arguments you can instead pass those
arguments to the function you call.

Richard.
Oct 6 '05 #9

P: n/a
They are called the blessing of standardization.
And do not even dare say or mildly argue they could be less than
absolutely perfect, welcome, magnificent, and brilliant! :-)

Alberto
http://www.unitedscripters.com/spell...texplorer.html

Oct 6 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.