-
Notifications
You must be signed in to change notification settings - Fork 6
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
Suggestion: use yield.sent
instead of function.sent
#1
Comments
yield.initial
instead of function.sent
yield.sent
instead of function.sent
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
A complication is that It's bad enough that |
@allenwb Welp... 😦 Problem is, there's not really a lot of decent options... Keep in mind,
Agreed, hence my reservations now. :-\ |
If we take the point of view that non-strict mode is supposed to be mostly a backward-compatibility mode, and that new code are encouraged (and even forced in some cases) to be strict, that concern about non-strict mode should be less important. |
I see a great opportunity to use We could imagine something more generic like this: function * it() {
let i = 0;
while (true) {
i += yield.last; // get absolute last value sent with next()
yield i; // we don't update *i* here
}
}
const _it = it();
_it.next(1); // 1
_it.next(2); // 3 |
Revisiting this, I feel |
All names of
I feel no any single issue is fatal, but there are too many potential ambiguity so maybe we should first consider alternatives of |
I don't think we have to worry about the font; anything can be unreadable with the wrong font. Adding parens to things causes different semantics all over the place; i don't think that's a concern either - similarly, However, your last point is compelling; it'd be great to find another alternative. |
@ljharb Could you explain more about that? I don't know other case which have different semantics between
Do you have any options? 😀 |
No suggestions yet. |
@ljharb What I mean is member access (or similar, like metaproperty) chaining 😅
So I don't think these two cases are comparable to
Actually this case seems weird at first glance, and there were several issues and discussions about that. IMO |
I have some thought about the name. The real meaning of I feel if we use Here are the names go to my mind:
|
@hax What about |
@isiahmeadows Oh, I forgot to add it. Added now. Currently I slightly prefer I also slightly worry about What do you think of these names? |
I remain concerned about using |
maybe |
Though |
For me the best would be something able to retrieve every values sent though
I agree with @ljharb ,
I personally prefer |
Note: I do agree with @allenwb that |
I'm not convinced that the fact Although I do think the difference between |
I am considering maybe
|
I strongly agree with |
I strongly disagree with |
It IMHO explains itself a little better, and it looks more generator specific than
function.sent
(which looks like it would belong in any function, not just any generator).The text was updated successfully, but these errors were encountered: