-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
semantic equivalence of f() <=> f(undefined) and so on #7
Comments
@drsm Can you, please, give me the link to the specification which requires this behavior for every function? |
@xeioex i'll try to find out. but, i think it is a "common behavior", rather than requirement. my point is that if no special care has been taken to differentiate a call without an argument specified and a call with undefined(void) argument provided, then results of both calls should be the same. otherwise there will be inconsistencies between internal and user-defined functions. >> function id(x) { return x; }
undefined
>> id() === id(void 0)
true
>> (function wrapfail(x) { return 2..toString(x); })()
RangeError
at Number.prototype.toString (native)
at anonymous (:1)
at main (native) also, if we want to implement the "default function parameters" feature, let's consider this sample: > function defaults(x = 10) { return x; }
undefined
> defaults() === defaults(void 0)
true and finally, all of [V8, Firefox, JJS] engines demonstrate the same behavior. |
here it is:
|
The subject is broken in many places, i.e. #5 or:
The text was updated successfully, but these errors were encountered: