473,387 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Non-deprecated arguments

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
9 3316
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: klaus triendl | last post by:
hi, recently i discovered a memory leak in our code; after some investigation i could reduce it to the following problem: return objects of functions are handled as temporary objects, hence...
3
by: Mario | last post by:
Hello, I couldn't find a solution to the following problem (tried google and dejanews), maybe I'm using the wrong keywords? Is there a way to open a file (a linux fifo pipe actually) in...
25
by: Yves Glodt | last post by:
Hello, if I do this: for row in sqlsth: ________pkcolumns.append(row.strip()) ________etc without a prior:
32
by: Adrian Herscu | last post by:
Hi all, In which circumstances it is appropriate to declare methods as non-virtual? Thanx, Adrian.
8
by: Bern McCarty | last post by:
Is it at all possible to leverage mixed-mode assemblies from AppDomains other than the default AppDomain? Is there any means at all of doing this? Mixed-mode is incredibly convenient, but if I...
14
by: Patrick Kowalzick | last post by:
Dear all, I have an existing piece of code with a struct with some PODs. struct A { int x; int y; };
11
by: ypjofficial | last post by:
Hello All, So far I have been reading that in case of a polymorphic class ( having at least one virtual function in it), the virtual function call get resolved at run time and during that the...
2
by: Ian825 | last post by:
I need help writing a function for a program that is based upon the various operations of a matrix and I keep getting a "non-aggregate type" error. My guess is that I need to dereference my...
399
by: =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= | last post by:
PEP 1 specifies that PEP authors need to collect feedback from the community. As the author of PEP 3131, I'd like to encourage comments to the PEP included below, either here (comp.lang.python), or...
12
by: puzzlecracker | last post by:
is it even possible or/and there is a better alternative to accept input in a nonblocking manner?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.