robertwb commented on PR #22134:
URL: https://github.com/apache/beam/pull/22134#issuecomment-1180771391
I did consider this, but it would make chaining much more verbose. E.g.
instead of
```
lines
.map((s: string) => s.toLowerCase())
.flatMap(function* splitWords(line: string) {
yield* line.split(/[^a-z]+/);
})
.apply(beam.countPerElement())
```
one would have to write
```
(await
(await
(await lines
.map((s: string) => s.toLowerCase())
).flatMap(function* splitWords(line: string) {
yield* line.split(/[^a-z]+/);
})
).apply(beam.countPerElement()))
```
or
```
lines
.map((s: string) => s.toLowerCase())
.then((result) => {
return result.flatMap(function* splitWords(line: string) {
yield* line.split(/[^a-z]+/);
})
})
.then((result) => {
return result.apply(beam.countPerElement());
})
```
which gets really painful. (Note that the future here is Javascript's
Promise, which is a kind of special builtin).
--
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]