One more pass on flatMap/mapMulti (original) (raw)

Brian Goetz brian.goetz at oracle.com
Thu Jan 10 07:52:50 PST 2013


The idea behind "Downstream" is that it represents sending results downstream. Multifunction and mapMulti conjures up the image that I'm mapping a single element to an aggregate, which makes people expect Function<T,Collection> (or to Stream). But that's not what's going on here. Instead, you get an element, and you get to send zero or more results downstream. I think "explode" conjures up more an image of "send fragments in this direction", which is more like what's going on here.

On 1/10/2013 10:45 AM, Tim Peierls wrote:

On Thu, Jan 10, 2013 at 10:10 AM, Brian Goetz <brian.goetz at oracle.com_ _<mailto:brian.goetz at oracle.com>> wrote:

One more simplification: we don't really need a custom type SAM for Multifunction. We can rewrite mapMulti as: mapMulti(BiBlock<Downstream, T>))_ and move the Downstream class declaration to Stream, and XxxMultifunction go away. mapMulti is still not a great name. How about "explode" ?

Um, the not-greatness is in the names BiBlock and Downstream. I have the vague idea that BiBlock is a void procedure taking 2 arguments, and I know you renamed something to Downstream, but the combination of these two into the signature above is impenetrable. mapMulti itself isn't so bad. I can guess at what that might be. --tim



More information about the lambda-libs-spec-observers mailing list