Please also use (String new: (self size * 2)) writeStream instead of  
'' writeStream.
In this case it won't lead to any noticeable performance increases,  
but it's good practice anyways :)

I'd also argue the expected returnvalue of "hex" might not be clear as  
something like "asHexString" when applied to a collection (hex  
previously only implemented on single values), but that's a minor issue.

When looking around, I also noticed WriteStream nextPut: does an  
unnecessary check for ByteStrings which is pretty ugly (plus, it  
decreases nextPut: performance for all ByteString writeStreams), filed  
as Issue 1065.

Cheers,
Henry


  Issue 1065
On Aug 13, 2009, at 10:32 19AM, Stéphane Ducasse wrote:

> add a nice method comment and a couple of tests!
>
> Stef
>
> On Aug 13, 2009, at 1:26 AM, Mariano Martinez Peck wrote:
>
>> Hi folks: Me and the rest of the team is developing SqueakDBX which
>> is a driver to talk with major databases. However, I think the most
>> persistence alternatives pharo has, the best. There is no better
>> solution for every escenario. So, I am also trying to get the
>> PostgreSQL native driver to work in Pharo. This package depends on
>> Cryptography because of MD5. I know that there were added to Pharo
>> packages like System-Hashing-core,  System-Hashing-SHA1 and System-
>> Hashing-MD5. However, the driver doesn't work yet. But adding this
>> single method:
>>
>> ByteArray>>hex
>>    | stream |
>>    stream _ '' writeStream.
>>    self do: [ :each |
>>        stream
>>            nextPut: ('0123456789ABCDEF' at: each // 16 + 1);
>>            nextPut: ('0123456789ABCDEF' at: each \\ 16 + 1)].
>>    ^ stream contents
>>
>> The driver works like a charm in Pharo without needing Cryptography
>> package. As far as I remember there were no MIT problem with this
>> package. Because of this those packages ( System-Hashing-core,
>> System-Hashing-SHA1 and System-Hashing-MD5) were integrated in Pharo.
>>
>> So, can I add it?
>>
>> Thanks
>>
>> Mariano
>> _______________________________________________
>> Pharo-project mailing list
>> [email protected]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>


_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to