pabloem commented on PR #22134:
URL: https://github.com/apache/beam/pull/22134#issuecomment-1180807383
Well thanks for doing the research and sharing your thoughts:)
On Mon, Jul 11, 2022, 12:45 PM Robert Bradshaw ***@***.***>
wrote:
> To do this one would have to add methods like flatMap to the Promise
> prototype (affecting all Promises across Javascript) or return a subclass
> (well, really a hierarchy of subclasses) of Promise (which I looked into
> and looks pretty sketchy). This would work if Promise could be a proxy
> object to the type it was promising, but it's not.
>
> It looks like another alternative is
>
> lines
> .invoke("map", (s: string) => s.toLowerCase())
> .invoke("flatMap", function* splitWords(line: string) {
> yield* line.split(/[^a-z]+/);
> })
> .invoke("apply", beam.countPerElement())
>
> but this is still a bit icky, and looses type safety.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/beam/pull/22134#issuecomment-1180797546>, or
> unsubscribe
>
<https://github.com/notifications/unsubscribe-auth/AAJ5Z3FKBOP5NE5BJBACZBLVTR2WLANCNFSM52N5F5TA>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***>
>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]