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

Editorial: Remove ! from IsCallable invocation, be consistent with others. #2612

Closed
wants to merge 2 commits into from

Conversation

zhangenming
Copy link
Contributor

@zhangenming zhangenming commented Jan 8, 2022

NOW, I'm just wondering why other methods(forEach/map...) don't have this.
Should it be consistent ?
THANKS...

@jmdyck
Copy link
Collaborator

jmdyck commented Jan 8, 2022

Hi. Normally, the opening comment in a PR should have a bit more explanation. For instance, in this case, it would be good to point out that IsCallable can't return an abrupt completion, so it's unnecessary to put ! before an invocation of IsCallable.

Also the title "fix flatMap" is somewhat misleading, because flatMap isn't 'broken': although the ! is unnecessary, it isn't causing flatMap to have incoherent or incorrect semantics. My suggestion for title would be "Remove ! from IsCallable invocation", as it gives a better idea of the nature of the PR's change.

Note that the spec's only other occurrence of ! IsCallable is 34 lines up, in FlattenIntoArray, so you might want to include that in this PR.

@zhangenming zhangenming changed the title Editorial: fix flatMap. Editorial: Remove ! from IsCallable invocation, be consistent with others. Jan 8, 2022
@zhangenming
Copy link
Contributor Author

zhangenming commented Jan 8, 2022

Thank you for your patient instruction : )

I'm just wondering why other methods(forEach/map...) don't have this
I'm not familiar with spec
I thought the ! means js Logical NOT.
so I made the mistake of thinking it was a mistake
thank you

@jmdyck
Copy link
Collaborator

jmdyck commented Jan 8, 2022

I thought the ! means js Logical NOT.

Ah! That's why it's good to explain your thinking. The ! and ? prefixes are defined in 5.2.3.4 ReturnIfAbrupt Shorthands.

@claudepache
Copy link
Contributor

About !: see also #568

@ljharb
Copy link
Member

ljharb commented Jan 8, 2022

Currently, every AO call whose return value isn't an introspected Completion Record has a ? or a !. However, the editors have avoided adding them to predicates (like IsCallable), and #1796 will alter the conventions around Completion Records.

There are no plans I'm aware of to change the ! and ? notation.

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

Successfully merging this pull request may close these issues.

4 participants