I think I did something similar in Squeak, but can't remember exactly...

http://source.squeak.org/trunk/Compression-nice.43.diff
http://source.squeak.org/trunk/Compression-nice.44.diff

ByteString zipped should better return a ByteArray because the zipped thing is all but a String (it is encoded...)
But if we do this then what happens to WideString zipped ??? what should it be ??? Are we sure that we can unzip it back to a WideString ?

My answer was that ByteString zipped -> ByteArray -> ByteString and WideString zipped -> ByteArray -> WideString, but it supposes that the zipped byte array has a length multiple of 4... Then I don't remember if it really works for WideString...

But String is just a facade, all the effective job is performed in ByteArray.


2015-02-25 16:52 GMT+01:00 Juraj Kubelka <juraj.kubelka@gmail.com>:

> 25. 2. 2015 v 12:28, Sven Van Caekenberghe <sven@stfx.eu>:
>
> This seems related to adding 'easy of use' methods to String.
>
> There are many different compression schemes (zip, bzip, bzip2, gzip, ...), are we going to add them all ?
>
> How much do we want to couple different parts of the system ?

I prefer to couple the compression schemes with String and ByteArray. Methods like #zipped, #unzipped are not that simple and it is not well apparent how to use that compression scheme.

Cheers,
Juraj

>
>> On 25 Feb 2015, at 16:23, Juraj Kubelka <juraj.kubelka@gmail.com> wrote:
>>
>> Can I add ByteArray>>#zipped and #unzipped methods the way it is for String? I want to compress bytes before sending through internet, for example.
>>
>> Do you agree?
>> Thanks,
>> Juraj
>
>