dmd 2.029 release

grauzone none at example.net
Thu Apr 23 07:48:59 PDT 2009


Andrei Alexandrescu wrote:
> grauzone wrote:
>> Andrei Alexandrescu wrote:
>>> grauzone wrote:
>>>>> Yes. The way it should be is not with sink, but with the standard 
>>>>> output iterator method put().
>>>>>
>>>>> void streamOut(T, R)(T object, R range)
>>>>> {
>>>>>     foreach(x; a) range.put(x);
>>>>>     range.put(b);
>>>>>     range.put(c);
>>>>> }
>>>>
>>>> Eh. Is a sink callback too simple and easy to use or what?
>>>
>>> ?
>>
>> Why make it more complicated than it has to be?
> 
> I am making it simpler.

How is it simpler?

sink(): simple delegate with the signature void delegate(char[] data);
output range: um what...? yeah, I know it has a put() method that 
takes... something. What exactly is it supposed to take in your example? 
Is streamOut() a method of the object to be dumped? What exact types to 
T and R have? (You need the exact type if streamOut is supposed to be a 
member function, and thus has to be virtual, so that you can it use like 
the Object.toString method.)

>> Also, I don't know ranges, but your example doesn't seem to make much 
>> sense.
> 
> s/but/consequently/

Probably. Just imagine you had to explain it to someone who's new to D. 
Actually, I _am_ new to D2.0.

So, um... what is a b c and T object?

> 
> Andrei


More information about the Digitalmars-d-announce mailing list