[squeak-dev] EncodedCharSet class>charsetAt:

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Tue Oct 1 21:40:38 UTC 2013


Good idea, or just ^Unicode.


2013/10/1 tim Rowledge <tim at rowledge.org>

>
> On 01-10-2013, at 2:19 PM, Nicolas Cellier <
> nicolas.cellier.aka.nice at gmail.com> wrote:
>
> > (1 to: 30) collect: [:i | EncodedCharSet charsetAt: i]
>
> Well that is interesting. The code uses at:ifAbsent:, clearly intending to
> prevent a nil result - and as I mentioned all but two senders rely on a
> 'proper' answer. Oh, here we are - SequenceableCollection>at:ifAbsent:
> *only* treats outside the 1..size range as absent, not a nil. I'm thinking
> the original code was predicated on a Dictionary and then the collection
> was changed to an Array.
>
> So I'd suggest
> charsetAt: encoding
>
>         ^ (EncodedCharSets at: encoding + 1) ifNil: [EncodedCharSets at:
> 1].
> … assuming we prefer
>
> (1 to: 30) collect: [:i | EncodedCharSet charsetAt: i]
> --> {JISX0208 . GB2312 . KSX1001 . JISX0208 . JapaneseEnvironment .
> SimplifiedChineseEnvironment . KoreanEnvironment . GB2312 . Unicode .
> Unicode . Unicode . KSX1001 . Unicode . Unicode . Unicode . Unicode .
> Unicode . Unicode . Unicode . Unicode . Unicode . Unicode . Unicode .
> Unicode . Unicode . Unicode . Unicode . Unicode . Unicode . Unicode}
>
> At least it isn't {Developers. Developers. Developers. Developers.
> Developers. Developers. Developers. } ;-)
>
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> Implementation is the sincerest form of flattery.
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20131001/b52d396c/attachment.htm


More information about the Squeak-dev mailing list