RobG said:
Thomas said:
RobG said:
UnaCoder wrote:
Well I thought there was and I researched java script to see if you can
invoke a string containing java script code. the solution that seemed
intuitive would be to do something like:
function Tunnel() {
function_name= arguments[0];
arguments.shift(); args = arguments.join();
eval function_name + "(" + args + ");";
}
I didn't put any error checking in there, or test that code, but
as far as I know that should work =)
Arguments is not an array, it's just a list
s/list/(Object) object/
Yes, a list Object.
There is no such thing.
The way I read the spec was that arguments shares the Object prototype,
You misunderstood it.
| 10.1.8 Arguments Object
| [...]
| * The value of the internal [[Prototype]] property of the arguments object
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| is the original Object prototype object, the one that is the initial
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| value of Object.prototype (section 15.2.3.1).
That means essentially that `arguments' is an Object object, as it
inherits directly from Object.prototype through the prototype chain.
Which makes it possible to augment Object.prototype and call its
methods with `arguments' as caller.
And since there are is no constraint for `arguments' regarding this,
it is possible, as with any Object object, to augment it directly.
Since it has been pointed out that Array.prototype.join and other
methods of Array.prototype are generic, direct augmentation is
indeed of practical value:
function x()
{
arguments.join = Array.prototype.join;
alert(arguments.join(","));
}
Only the current `arguments' object would be affected by it then,
not other Object objects. (Think about iterating through their
properties with `for..in'.)
No, fortunately it is not
There would not be such nice properties
as `constructor' and methods as toString() otherwise. You are confusing
the prototype object and its [[Prototype]] property:
| 15.2.3.1 Object.prototype
|
| The initial value of Object.prototype is the Object prototype object
| (section 15.2.4).
|
| This property has the attributes { DontEnum, DontDelete, ReadOnly }.
The last attribute means essentially that you cannot overwrite the value of
Object.prototype with a reference to another object as that would break the
prototype chain mechanism preserved by the following:
| 15.2.4 Properties of the Object Prototype Object
|
| The value of the internal [[Prototype]] property of the Object prototype
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| object is null [...]
Hopefully this helps (you) to see the difference:
arguments.[[Prototype]] --> Object.prototype
Object.prototype --> {constructor: ..., toString: ..., ...}
Object.prototype.[[Prototype]] --> null
I'll run the test in your other post later on a few Mac OS browsers.
Thanks in advance.
Regards,
PointedEars