D as a prototyping language (for C/C++ projects)

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Feb 28 07:51:02 PST 2013


On 2/28/13 10:49 AM, Andrei Alexandrescu wrote:
> On 2/28/13 10:24 AM, Jacob Carlborg wrote:
>> On 2013-02-28 16:18, Andrei Alexandrescu wrote:
>>
>>> I think it belongs to std.range.
>>>
>>> 1. tap!fun(r) returns a new range (of a new type R1 distinct from
>>> typeof(r)). Upon the first call to .front without an intervening
>>> popFront, fun(r.front) is called.
>>>
>>> 2. tap!(fun1, fun2)(r) also returns a new range, calls fun1 as described
>>> above, and fun2 whenever popFront() gets called without the front()
>>> being looked at. So fun1 tracks the looked-at data and fun2 tracks the
>>> ignored data.
>>
>> That is not my idea of "tap". This is my idea of "tap":
>>
>> Object (func) (Object o)
>> {
>> func(o);
>> return o;
>> }
>
> I know. I think my tap is better than your tap.

... and closer in intent to Ruby's tap as I understand it from reading 
http://ruby-doc.org/core-2.0/Object.html#method-i-tap

No?

Andrei


More information about the Digitalmars-d mailing list