tee()
Talden
talden at gmail.com
Wed Jan 30 13:04:44 PST 2013
In my JDK8-stream-like API my tee() takes a Block and I pass in a no-op
block when we're not debugging (which since the debugging one logs output
is decided by the level of the logger intended for this fine level of
logging).
Given another opportunity I'd name it peek() in my API (it's really the
only way in which it's useful) but I certainly wouldn't remove it - the
debugging has proven very useful.
It's only used in some very specific circumstances where other debugging
would not be detailed enough - most stream usage doesn't use it... you
still need the tool in the toolbox occasionally though - I certainly don't
want the debugging to break the streaminess of the operation by forcing
full stream evaluation.
--
Aaron Scott-Boddendijk
On Thu, Jan 31, 2013 at 9:27 AM, Howard Lovatt <howard.lovatt at gmail.com>wrote:
> In my own stream library I have a toString method that forces evaluation.
> For debugging I use the equivalent of (neglecting generics):
>
> Stream s = collection.stream();
> Stream f = s.filter( ... );
> Stream r = f.reduce( ... );
>
> Then when debugging I step over each line and examine the intermediate
> stages (usually by hovering over the variable which causes my non-lazy
> toString to be called).
>
> Not ideal, but the best I have come up with and no need for tee().
>
> -- Howard Lovatt +61 419 971 263 (sent from my PDA)
>
> On 25/01/2013, at 12:11 PM, Doug Lea <dl at cs.oswego.edu> wrote:
>
> > On 01/24/13 20:00, Joe Bowbeer wrote:
> >> I'm OK with peek() even though it has other meanings on IO streams.
> >>
> >> Is the name leak() is more to your liking?
> >
> > I can't think of a good name for the the little idiom of
> > ....map(x -> { use(x); return x; })...
> >
> > Which seems more like an IDE thing than an API thing anyway.
> >
> > But then again, I don't like practically all of the
> > convenience methods, so discount my vote accordingly.
> >
> > -Doug
> >
> >
> >
> >>
> >> Joe
> >>
> >>
> >> On Thu, Jan 24, 2013 at 4:47 PM, Doug Lea <dl at cs.oswego.edu
> >> <mailto:dl at cs.oswego.edu>> wrote:
> >>
> >> On 01/24/13 15:43, Kevin Bourrillion wrote:
> >>
> >> If it really must stay, I think I do like "peek" or "observe" over
> >> "tee". But I
> >> would love to drop it.
> >>
> >>
> >> In case it is not too late to vote to drop this, I vote to drop it.
> >> And if too late, I vote to name it something other than any of these.
> >>
> >> -Doug
> >
>
More information about the lambda-libs-spec-observers
mailing list