-
Notifications
You must be signed in to change notification settings - Fork 161
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
Clarify some of the ECMAScript conventions applied #790
Conversation
index.bs
Outdated
default property descriptor values. | ||
|
||
We also depart from the [[!ECMASCRIPT]] conventions in the following ways, mostly for brevity. It is hoped (and vaguely | ||
planned) that the conventions of ECMAScript itself will evolve in these ways. | ||
|
||
<ul> | ||
<li> We use destructuring notation in function and method declarations, and assume that the destructuring assignment | ||
procedure was performed before the algorithm starts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we say "algorithm" rather than procedure? I was surprised when I was trying to reimplement it for #777 that there are some subtleties involved. (I have since abandoned the approach of trying to reimplement it in spec language).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do better; we'll just link to https://tc39.github.io/ecma262/#sec-runtime-semantics-destructuringassignmentevaluation
index.bs
Outdated
default property descriptor values. | ||
|
||
We also depart from the [[!ECMASCRIPT]] conventions in the following ways, mostly for brevity. It is hoped (and vaguely | ||
planned) that the conventions of ECMAScript itself will evolve in these ways. | ||
|
||
<ul> | ||
<li> We use destructuring notation in function and method declarations, and assume that the destructuring assignment | ||
procedure was performed before the algorithm starts. | ||
<li> We similarly use the default argument notation <code>= {}</code> in a couple of cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe link to the algorithm? I found the interaction in the TransformStream constructor surprising when I looked at it. ie. writableStrategy and readableStrategy are defaulted to undefined, which is not an acceptable value for destructuring assignment, and then when the {Readable,Writable}Stream constructors are called those undefined values are converted to {} by the default arguments there, making the destructuring assignment work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one isn't as easy to link to... I think it's buried in https://tc39.github.io/ecma262/#sec-functiondeclarationinstantiation . Maybe I'll just expand on it.
index.bs
Outdated
as <a href="https://tc39.github.io/ecma262/#sec-ecmascript-standard-built-in-objects">built-in objects</a>. For example, | ||
their <code>name</code> and <code>length</code> properties are derived as described by that specification, as are the | ||
default property descriptor values. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be nice to explicitly mention the fact that missing and surplus arguments are treated as per ECMASCRIPT function conventions. Although this is implied, it clearly surprises some people.
Nice! |
Closes #775.