Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Add more set methods #28

Merged
merged 3 commits into from
Dec 13, 2018
Merged

Add more set methods #28

merged 3 commits into from
Dec 13, 2018

Conversation

gsathya
Copy link
Member

@gsathya gsathya commented May 21, 2018

1. Else, let _otherSet_ be _iterable_.
1. Let _hasCheck_ be ? Get(_otherSet_, "has").
1. If IsCallable(_hasCheck_) is *false*, throw a *TypeError* exception.
1. For each _e_ that is an element of _entries_, do
Copy link
Member

Choose a reason for hiding this comment

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

Nit: eentry (no reason to use single-letter variable names here)

Copy link
Member

Choose a reason for hiding this comment

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

Same goes for the other methods

Copy link
Member Author

Choose a reason for hiding this comment

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

Leaving as such to be consistent with the spec

1. Let _hasCheck_ be ? Get(_otherSet_, "has").
1. If IsCallable(_hasCheck_) is *false*, throw a *TypeError* exception.
1. For each _e_ that is an element of _entries_, do
1. Let _has_ be ? Call(_hasCheck_, _otherSet_, « e »)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: missing .

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -0,0 +1,21 @@
<p>When the `isDisjoint` method is called, the following steps are taken:</p>
Copy link
Member

Choose a reason for hiding this comment

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

Missing “with argument ” — see #27

Copy link
Member

Choose a reason for hiding this comment

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

Same for the other methods

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -119,7 +119,11 @@ Search.prototype.search = function (searchString) {

for (var i = 0; i < this.biblio.length; i++) {
var entry = this.biblio[i];

if (!entry.key) {

Choose a reason for hiding this comment

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

Is there a bug for this on https://github.com/bterlson/ecmarkup?

Copy link
Member Author

Choose a reason for hiding this comment

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

No. Why is this a bug? I'm not sure how ecmarkup generates this output, feel free to file an issue if you think this is incorrect.

spec/index.html Outdated
@@ -39,3 +39,18 @@ <h1>Set.prototype.difference(_iterable_)</h1>
<h1>Set.prototype.symmetricDifference(_iterable_)</h1>
<emu-import href="./set-prototype-symmetric-difference.html"></emu-import>
</emu-clause>

<emu-clause id="Set.prototype.isSubset">
<h1>Set.prototype.isSubset(_iterable_)</h1>

Choose a reason for hiding this comment

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

The name isSubset seems ambiguous. In a.isSubset(b) are you testing whether: a is a subset of b or b is a subset of a? It could be construed either way. I would recommend a name that better indicates the relationship such as:

  • a.isSubsetOf(b) - Indicates a is a subset of b
  • a.hasSubset(b) - Indicates b is a subset of a

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

spec/index.html Outdated
</emu-clause>

<emu-clause id="Set.prototype.isSuperset">
<h1>Set.prototype.isSuperset(_iterable_)</h1>

Choose a reason for hiding this comment

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

As with isSubset, isSuperset seems ambiguous. I would recommend a name that better indicates the relationship such as:

  • a.isSupersetOf(b) - Indicates a is a superset of b
  • a.hasSuperset(b) - Indicates b is a superset of a

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree that isSupersetOf and isSubsetOf are better names.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.

1. Let _entries_ be the List that is _set_.[[SetData]].
1. If Type(_iterable_) is not Object, throw a *TypeError* exception.
1. If _iterable_ does not have [[SetData]] internal slot,
1. Let _otherSet_ be Construct(%Set%, _iterable_).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we use SpeciesConstructor here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see any benefits of using a SpeciesConstructor here.


</emu-alg>

<p>The `length` property of the `isSuperSet` method is *1*.</p>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Inconsistent casing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

spec/index.html Outdated
</emu-clause>

<emu-clause id="Set.prototype.isSuperset">
<h1>Set.prototype.isSuperset(_iterable_)</h1>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree that isSupersetOf and isSubsetOf are better names.

1. Let _entries_ be the List that is _set_.[[SetData]].
1. If Type(_iterable_) is not Object, throw a *TypeError* exception.
1. If _iterable_ does not have [[SetData]] internal slot,
1. Let _otherSet_ be ? Construct(%Set%, _iterable_).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we use SpeciesConstructor?

Copy link
Member Author

Choose a reason for hiding this comment

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

Don't see any benefit here either

1. Else, let _otherSet_ be _iterable_.
1. Let _hasCheck_ be ? Get(_otherSet_, "has").
1. If IsCallable(_hasCheck_) is *false*, throw a *TypeError* exception.
1. For each _e_ that is an element of _entries_, do
Copy link
Collaborator

Choose a reason for hiding this comment

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

It needs to check for empty entries.

Copy link
Member Author

Choose a reason for hiding this comment

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

Why?

@gsathya gsathya force-pushed the more-helper-methods branch from f469885 to be47b44 Compare June 10, 2018 17:22
@Ginden Ginden merged commit be47b44 into tc39:master Dec 13, 2018
<emu-import href="./set-prototype-is-superset-of.html"></emu-import>
</emu-clause>

<emu-clause id="Set.prototype.isDisjointWith">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Small note: I believe "is disjoint from" is significantly more common than "is disjoint with". Googling each phrase gives almost an order of magnitude more results for "is disjoint from", and the first result for "is disjoint with" is someone asking if it's correct (whereas the first result for "is disjoint from" is a math article).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you raise new issue about this?

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

Successfully merging this pull request may close these issues.

5 participants