[phobos] std.base64 replacement

Shin Fujishiro rsinfu at gmail.com
Thu Oct 14 15:57:18 PDT 2010


Daniel Murphy <yebblies at gmail.com> wrote:
> Ranges typically model one iteration of an algorithm, and this works best if
> each iteration reads N items and outputs 1.  Is this along the right lines?
> I understand that pushing converted data is part of the conversion process,
> but that is not the only way to do it.
> 
> The conversion function approach works when you want to convert the data,
> then use it.  I'd assume this is the common case.
> useConvertedData( convert( originalData ) );
> or
> convert(originalData, buffer);
> 
> The range approach works better when you want to do something with your data
> as if it was the converted data.
> 
> find( converter(originalData), something );
> auto n = calculateChecksum( converter(originalData) );
> 
> Both are forms of conversion and each is most useful in different
> situations.

Agreed, I can see the usefulness and correctness in both usages.  Now
Masahiro said that his API would support both functions and ranges, so
let's wait for the new base64 module.

Oh, and the nocache decorator range: I was surprised that was
possible!  Though the range still has a state, I think it's a clever
solution.


Shin


More information about the phobos mailing list