[squeak-dev] any objections if I make TextConverter>>decodeString: consume unsigned integer arrays (ByteArray et al) also?

Tobias Pape Das.Linux at gmx.de
Mon Nov 21 21:46:19 UTC 2022


Hi


> On 21. Nov 2022, at 21:17, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> 
> Hi All,
> 
>     in porting the ClipboardExtendedPlugin to Windows and starting using it I want to do UTF-16 => string conversion on ByteArray.  The innards of textConverter>>decodeString: et al are specific for characters for no good reason I can see.  If I don't break the tests does anyone object my adding this polymorphism?
> _,,,^..^,,,_
> best, Eliot
> 

I often have the "make it right" glasses on. I know thats not really pragmatic, but hear me out a second:

_Decoding_ should always work bytes/number -> Characters/string
_encoding_ should always work characters/strings -> bytes/numbers

I know that's not very light hearted.

That said, making TextConverter consume bytes is a good thing in my book.
I don't think #decodeString is a good message name when it can _consume_ strings but only when it can _produce_ strings.
But that was not the question :D

Best regards
	-Tobias


More information about the Squeak-dev mailing list