[squeak-dev] ByteArray>>at:put:

Bob Arning arning315 at comcast.net
Thu Apr 26 13:14:27 UTC 2018


it got some notice last year:


On 7/29/17 3:15 PM, tim Rowledge wrote:
> We recently changed ByteArray>at:put: to remove the backup conversion of the value to integer, for what seemed like decent reasons.
>
> It’s broken my WeatherStation code a little because there are places where I use
> {my byte stream} nextPutAll: (aString squeakToUtf8)
> or similar. #squeakToUtf8 returns a bytestring, and of course when the #nextPutAll: loop does its thing each character is pulled out as a Character (even though we know at this point it’s a byte value) - and we’ve just made it impossible to stick a character into a byte array.
>
> Clearly I could fix it reasonably trivially with a few #asByteArray type messages scattered around but it feels a bit tacky somehow. I see some faintly similar code with plausibly similar issues in WebSocket classes too, which would need some care. Not that I can see a lot of usage of that code…
>
> Performance isn’t a colossal issue for MQTT packets but it just rankles a bit to have a known byte valued string and then have to convert it to write it into a byte valued stream collection. KnowWhadIMean?
>
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> Never write software that anthropomorphizes the machine. They hate that.
>
>
>

On 4/26/18 8:41 AM, Levente Uzonyi wrote:
> When was the last time this worked?
>
> Levente
>
> On Thu, 26 Apr 2018, marcel.taeumel wrote:
>
>> Hi, there.
>>
>> I cannot put a ByteString into a ByteArray via a WriteStream anymore:
>>
>> | s |
>> s := WriteStream on: ByteArray new.
>> s nextPutAll: 'hello'.
>>
>> You need to do:
>>
>> | s |
>> s := WriteStream on: ByteArray new.
>> s nextPutAll: 'hello' asByteArray.
>>
>> This breaks code.
>>
>> Best,
>> Marcel
>>
>>
>>
>> -- 
>> Sent from: http://forum.world.st/Squeak-Dev-f45488.html
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20180426/6b9c7152/attachment.html>


More information about the Squeak-dev mailing list