std.compress
John Colvin
john.loughran.colvin at gmail.com
Tue Jun 4 11:04:09 PDT 2013
On Tuesday, 4 June 2013 at 17:50:47 UTC, Walter Bright wrote:
> On 6/4/2013 9:33 AM, John Colvin wrote:
>> On Tuesday, 4 June 2013 at 16:09:09 UTC, Walter Bright wrote:
>>> On 6/4/2013 6:34 AM, Jacob Carlborg wrote:
>>>> I'm wondering if (un)compress can take the compressing
>>>> algorithm as a template
>>>> parameter. Does that make sense?
>>>>
>>>> Something like:
>>>>
>>>> auto result = data.compress!(LZW);
>>>>
>>>> Then we could pass different compressing algorithms to the
>>>> compress function.
>>>
>>> I don't see the point. Furthermore, it requires that the
>>> compress template
>>> know about all the compression algorithms available, which
>>> limits future
>>> expansion.
>>
>> Not necessarily. If the compression algorithms were free
>> functions in the module
>> you could just be passing an alias to one, which compress
>> would then call.
>> (which would also allow people to specify their own algorithms)
>
> What value does a function which just passes an alias to
> another one add?
A unified interface called "compress" that takes a compression
function as an alias (with e.g. lzwCompress as a default) seems
like a nicer way of working, seeing as people don't necessarily
care/know about which algorithm they're using, they just want to
compress something a bit.
Also, it would be cool if a range could remember which algorithm
it was compressed with (as it's type? I.e. LzwRange), so a
generic function "expand" could call the appropriate ***Expand
More information about the Digitalmars-d
mailing list