Skip to content

Why not just make it impossible to send values to the first next call in the first place? #5

Description

@benburrill

This proposal in my mind seems to trying to work around an issue that shouldn't exist in the first place. Although there may be some small risk of backwards incompatibility, it seems like it would make more sense if gen.next(x) resulted in an error on newly started generators when x is not undefined. This is the way Python does things with its .send method: gen.send(x) produces TypeError: can't send non-None value to a just-started generator.

If producing an error is too much, browsers could simply output a warning to the console. I just don't think it makes sense to completely change the "correct" way to get values from .next calls by introducing new syntax when the value passed to the first .next call really shouldn't be meaningful anyway.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions