added IEnumerable<T>.Intersect

#27 Declined
Repository
remy_settier
Branch
feature/intersect
Repository
sglienke
Branch
develop
Author
  1. Rémy Settier
Reviewers
Description
No description

Comments (3)

    1. Stefan Glienke repo owner

      Yes, that totally makes sense - in fact TEnumerable is missing quite a few operators that currently are just accessible by manually creating an instance from Spring.Collections.Extensions.

      However since using the static TEnumerable methods is very clunky (the code is very ass backwards) I was considering a similar approach to what I did in the ReactiveX prototype. Adding those functions not directly to the interface but to some type exposed via some method (in RX I called it _). That will then enable code like this:

      for x in a.Where(something).Take(5)._.Intersect<TFoo>(b) do

      instead of the following where the actual program flow is forth and back:

      for x in TEnumerable.Intersect<TFoo>(a.Where(something).Take(5), b) do

      That approach will not cause compilation of any iterator extension classes unless you really call one of those methods because the methods don't exist behind some interface (plus it enabled chaining methods that require another generic parameter, like for Select or GroupBy). What I don't like though is that you need to repeat the generic parameters as the type returned by _ must not be a generic type - otherwise you get "funny" things like this: https://quality.embarcadero.com/browse/RSP-17809