Skip to content
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

Merged
merged 2 commits into from
Sep 14, 2017
Merged

Conversation

domenic
Copy link
Member

@domenic domenic commented Sep 8, 2017

Closes #775.

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.
Copy link
Collaborator

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).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Collaborator

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.

Copy link
Member Author

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.

Copy link
Collaborator

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.

@domenic domenic merged commit 89d32e2 into master Sep 14, 2017
@domenic domenic deleted the name-properties branch September 14, 2017 05:14
@ricea
Copy link
Collaborator

ricea commented Sep 14, 2017

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants