473,698 Members | 2,302 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

arguments-object prototype

hi,
in section 10.1.8 (Arguments Object) it is stated that the "internal
[[Prototype]] property of the arguments object is the orginal Object
prototype object, the one that is the *initial* [emphasize mine] value of
Object.prototyp e".
Furthermore the Object.prototyp e property has attributes [DontEnum,
DontDelete, *ReadOnly*].
My question now: what does the "initial" refer to? To the untouched
prototype-object, or to the current Object.prototyp e? In the latter case:
why would the write "initial", if it can't be changed anyways (ReadOnly)?
Example:
===
Object.prototyp e.x = "prototype-x";
function f()
{
alert(arguments .x);
}
f(); // "prototype-x" or undefined ?
===
I'm aware, that all existing implementations I tested this example on
(Mozilla, Rhino, Konqueror), print "prototype-x". (but unfortunately they
aren't always right either...)
// florian

Jul 23 '05 #1
7 1249
Florian Loitsch wrote:
[T]he "internal [[Prototype]] property of the arguments object is
the orginal Object prototype object, the one that is the *initial*
[emphasize mine] value of Object.prototyp e".

Furthermore the Object.prototyp e property has attributes [DontEnum,
DontDelete, *ReadOnly*].

My question now: what does the "initial" refer to? To the untouched
prototype-object, or to the current Object.prototyp e?
The former: the value that is present before any user code is
executed, and therefore any alterations that might be made.
In the latter case: why would the write "initial", if it can't be
changed anyways (ReadOnly)?
The ReadOnly attribute only applies to the particular property. In
this case, Object.prototyp e. It means that the prototype object cannot
be completely replaced...

/* Will silently fail: */
Object.prototyp e = {
myMethod : function() {}
};

....but the properties of the prototype object are not automatically
read-only. They too must have their individual attributes set.
Example:
===
Object.prototyp e.x = "prototype-x";
function f()
{
alert(arguments .x);
}
f(); // "prototype-x" or undefined ?
===


It should be undefined, however it's not likely to be a specification
violation. In section 2 - Conformance, it is stated that a conforming
implementation must provide the types and semantics within the
specification, but it does go on to say that an implementation may
provide extensions.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2
Michael Winter wrote:
[snip]
It should be undefined, however it's not likely to be a specification
violation. In section 2 - Conformance, it is stated that a conforming
implementation must provide the types and semantics within the
specification, but it does go on to say that an implementation may
provide extensions.

not trying to bitch, but how can this not be a violation? If it's explicitly
stated in the spec, and the implementation provides something different, it
must be a violation as it violates the semantics (IMHO).
// florian
Jul 23 '05 #3
Florian Loitsch wrote:

[snip]
not trying to bitch,
Bitch all you want. :)
but how can this not be a violation?
I didn't say it wasn't, and perhaps "not likely" was saying too much.
Actually, my first draft implied that it was a violation, but some
self-doubt changed it to what I posted. Having read section 2 about
six more times since then, I'm inclined to believe that it is a violation.

Even if this is the case, that doesn't really mean much unless the
implementation is described as "conforming " when it isn't. Then either
the current behaviour should be labelled a bug and corrected in a
future release, or "conforming " should be removed from the description.
If it's explicitly stated in the spec, and the implementation
provides something different, it must be a violation as it violates
the semantics (IMHO).


It depends whether differing, but in most ways similar, semantics are
classed as an acceptable extension. Going back to my original
thoughts, I don't think they are.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #4
On Tue, 15 Mar 2005 16:25:00 +0100, Florian Loitsch
<ne**@florian.l oitsch.com> wrote:
Michael Winter wrote:
[snip]
It should be undefined, however it's not likely to be a specification
violation. In section 2 - Conformance, it is stated that a conforming
implementation must provide the types and semantics within the
specification, but it does go on to say that an implementation may
provide extensions.

not trying to bitch, but how can this not be a violation? If it's explicitly
stated in the spec, and the implementation provides something different, it
must be a violation as it violates the semantics (IMHO).


Not really, the ECMAScript ed. 3 spec is extremely open about
extensions, adding new functionality is almost always allowed.

Jim.
Jul 23 '05 #5
rh
Michael Winter wrote:
Florian Loitsch wrote:
[T]he "internal [[Prototype]] property of the arguments object is
the orginal Object prototype object, the one that is the *initial*
[emphasize mine] value of Object.prototyp e".

Furthermore the Object.prototyp e property has attributes [DontEnum,
DontDelete, *ReadOnly*].

My question now: what does the "initial" refer to? To the untouched
prototype-object, or to the current Object.prototyp e?


The former: the value that is present before any user code is
executed, and therefore any alterations that might be made.
In the latter case: why would the write "initial", if it can't be
changed anyways (ReadOnly)?


<..>
Example:
===
Object.prototyp e.x = "prototype-x";
function f()
{
alert(arguments .x);
}
f(); // "prototype-x" or undefined ?
> ===


It should be undefined,


Seems to me it should be "prototype-x".

"arguments" is an object that has constructor "Object". arguments will
therefore inherit from the prototype, Object.prototyp e.

<..>

../rh

Jul 23 '05 #6
rh wrote:
Florian Loitsch wrote:
[T]he "internal [[Prototype]] property of the arguments object
is the orginal Object prototype object, the one that is the
*initial* [emphasize mine] value of Object.prototyp e".
[snip]
Object.prototyp e.x = "prototype-x";
function f()
{
alert(arguments .x);
}
f(); // "prototype-x" or undefined ?

[snip]
Seems to me it should be "prototype-x".

"arguments" is an object that has constructor "Object". arguments
will therefore inherit from the prototype, Object.prototyp e.


Is that after your interpretation of the first paragraph you quoted,
written by Florian? I'm certain that no additional properties should
be present, but I'm happy to be proved wrong.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #7
rh
Michael Winter wrote:
rh wrote:


<..>
Seems to me it should be "prototype-x".

"arguments" is an object that has constructor "Object". arguments
will therefore inherit from the prototype, Object.prototyp e.


Is that after your interpretation of the first paragraph you quoted,
written by Florian? I'm certain that no additional properties should
be present, but I'm happy to be proved wrong.


Well, perhaps it was after my mis-interpretation of that paragraph. In
reading it with more care, and ignoring much contrasting browser
behaviour, I think your take is the correct one.

../rh

Jul 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2433
by: Chuck Anderson | last post by:
I have a function with 7 inputs. The last three have default values. I want to call that function specifying the first four, skip two and then specify the last. I thought I could write this as : $retval = myfunction(arg1, arg2, arg3, arg4,,,arg7); .... but Php does not seem to want to let me do this. I get a parse
14
5266
by: Edward Diener | last post by:
In the tutorial on functions there are sections on default arguments and keyword arguments, yet I don't see the syntactic difference between them. For default arguments the tutorial shows: def ask_ok(prompt, retries=4, complaint='Yes or no, please!'): while for keyword arguments the tutorial shows: def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):
2
8215
by: Steven D'Aprano | last post by:
I'm trying to keep an open mind, but I am perplexed about something in Python that strikes me as a poor design. py> def func(a,b): py> print a,b py> func(1) Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: func() takes exactly 2 arguments (1 given)
10
3281
by: Agent Mulder | last post by:
Hi group, Almost 3 weeks ago I posted a short question here and in comp.std.c++ and I got exactly 1 respons, from Kevin Goodsell. He said he didn't want it. I post it here again, this time in a thread named 'Empty arguments', because that is what I got from you. Can you spare a minute and try to see my point? struct Room { Room(bool a=true,bool b=true,bool c=true):Chair(a),Table(b),Bed(c){} bool Chair,Table,Bed;
7
5983
by: A. Saksena | last post by:
Hi all, Is it possible to write a function or a macro in C++, which is capable of accepting any number of arguments. To give an example, the following should be possible: - connect(arg1,arg2);
6
4016
by: Melkor Ainur | last post by:
Hello, I'm attempting to build an interpreter for a pascal-like language. Currently, I don't generate any assembly. Instead, I just build an abstract syntax tree representing what I've parsed from a user's program and use a C backend to evaluate the tree. I'm using Lex, Yacc and C. Now, there are some functions that are built into this language and others which are not. The problem I'm having is that I haven't found a way to represent...
2
2565
by: Colmag | last post by:
I'm running a console application (ghostscript) by starting it as a process with arguments. The problem i'm having is that it's falling over when I pass a file containing spaces in the filename or filepath. Anyone know how to get around this? (i've tried putting the file in quotes, but it doesn't seem to work e.g. -sPDFname#"filename")
26
2817
by: Martin Jørgensen | last post by:
Hi, I'm learning C-programming. I have a program which I would like to modify so it takes arguments from the commandline. Let call the program: program.exe. Could somebody shortly explain how I get this behaviour: C:>program -help or C:>program -h printf("\nBla. bla. Here is some help and arguments\n").... etc.
2
12546
ADezii
by: ADezii | last post by:
When a call is made to a Sub or Function Procedure, you can supply Arguments in the exact order they appear in the Procedure's definition, or you can supply them in any position by name. To illustrate this point, I'll use a fictitious Function called fCalculateInterest() which accepts 3 Arguments (Currency, Single, and Long) and returns a value of type Currency. Public Function fCalculateInterest(curPrincipal As Currency, sngRate As Single,...
9
5271
by: oldyork90 | last post by:
I'm going thru code and have never seen this before http://www.webreference.com/programming/javascript/mk/column2/3.html Look at function CreateDragContainer() on line 25. It has no arguments defined and depends on a function property named arguments to process its input. I poked around and found this is deprecated. How do you pass an unknown number of arguments to a function? Put them in an array?
0
8674
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8604
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8895
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.