[squeak-dev] Re: The Trunk: TrueType-nice.13.mcz

Eliot Miranda eliot.miranda at gmail.com
Tue Jan 19 17:31:47 UTC 2010


On Mon, Jan 18, 2010 at 8:59 PM, Colin Putney <cputney at wiresong.ca> wrote:

>
> On 2010-01-18, at 8:23 PM, Andreas Raab wrote:
>
> > It's not. Check the comment:
> >
> >       ['true' asByteArray] -> ["Version 1.0 TTF file"
> >               "
> http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6.html
> >               The values 'true' (0x74727565) and 0x00010000 are
> recognized by the Mac OS
> >               as referring to TrueType fonts."
> >               ^Array with: 0 "only one font"
> >       ].
> >
> > Since this code has no performance implication whatsoever, I find 'true'
> asByteArray vastly more readable and intention revealing than  #[116 114 117
> 101].
>
> It's more intention revealing, yes. What I don't like is that it relies on
> the unspecified semantics of #asByteArray. If the implementation of String
> changes (and it's happened once in recent history, so it's not just a
> "theoretical" worry), then you may not get the bytes you were expecting.
>
> The code above specifies the intention, but not the actual bytes required.
> The exact byte sequence is important though, enough so that the author felt
> the need to specify it in the comment. I'd rather see the exact bytes in the
> code, and the intention in the comment.
>
> Colin
>

I agree, and hence why not:

       [#[ 16r74 "t" 16r72 "r" 16r75 "u" 16r65 "e" ] -> ["Version 1.0 TTF
file"
               "
http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6.html
               The values 'true' (16r74727565 in ascii) and 16r00010000 are
recognized by the Mac OS
               as referring to TrueType fonts."
               ^Array with: 0 "only one font"
       ].

?  Use of 16r is to be preferred to 0x because this is a comment to be read
by Smalltalk programmers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20100119/a35b9aa5/attachment.htm


More information about the Squeak-dev mailing list