Test case:
Color fromString: 'yellow' used to return yellow. Now it returns a very dark gray. The culprit is in #asNumber: '16rYE' asNumber used to raise an error. Now it silently returns 16. I can't imagine why this would be desirable? - Bert - |
On Wed, 8 Dec 2010, Bert Freudenberg wrote:
> Test case: > > Color fromString: 'yellow' > > used to return yellow. Now it returns a very dark gray. > > The culprit is in #asNumber: > > '16rYE' asNumber > > used to raise an error. Now it silently returns 16. It returns 0 since Squeak 3.9. Relying on such an error is bad idea and fixing this method is easy. Though it may have been hard to track the problem down. I wonder why is ColorNames an OrderedCollection instead of an IdentitySet. Levente > > I can't imagine why this would be desirable? > > - Bert - > > > > |
On 08.12.2010, at 15:36, Levente Uzonyi wrote: > On Wed, 8 Dec 2010, Bert Freudenberg wrote: > >> Test case: >> >> Color fromString: 'yellow' >> >> used to return yellow. Now it returns a very dark gray. >> >> The culprit is in #asNumber: >> >> '16rYE' asNumber >> >> used to raise an error. Now it silently returns 16. > > It returns 0 since Squeak 3.9. No, it returns 16 now. It ignores everything after the "6". > Relying on such an error is bad idea and fixing this method is easy. Agreed. > Though it may have been hard to track the problem down. Not *that* hard, fortunately ;) > I wonder why is ColorNames an OrderedCollection instead of an IdentitySet. No idea. Historical I guess. - Bert - > Levente > >> >> I can't imagine why this would be desirable? >> >> - Bert - >> >> >> >> > |
On Wed, 8 Dec 2010, Bert Freudenberg wrote:
> > On 08.12.2010, at 15:36, Levente Uzonyi wrote: > >> On Wed, 8 Dec 2010, Bert Freudenberg wrote: >> >>> Test case: >>> >>> Color fromString: 'yellow' >>> >>> used to return yellow. Now it returns a very dark gray. >>> >>> The culprit is in #asNumber: >>> >>> '16rYE' asNumber >>> >>> used to raise an error. Now it silently returns 16. >> >> It returns 0 since Squeak 3.9. > > No, it returns 16 now. It ignores everything after the "6". I see. It did return 0 in Squeak 3.9. Seems like ExtendedNumberParser is not fully backwards compatible, but this is an edge case. > >> Relying on such an error is bad idea and fixing this method is easy. > > Agreed. > >> Though it may have been hard to track the problem down. > > Not *that* hard, fortunately ;) > >> I wonder why is ColorNames an OrderedCollection instead of an IdentitySet. > > No idea. Historical I guess. Okay, I'll change it. :) Levente > > - Bert - > >> Levente >> >>> >>> I can't imagine why this would be desirable? >>> >>> - Bert - >>> >>> >>> >>> >> > > > > |
On 08.12.2010, at 16:36, Levente Uzonyi wrote: > On Wed, 8 Dec 2010, Bert Freudenberg wrote: > >> >> On 08.12.2010, at 15:36, Levente Uzonyi wrote: >> >>> On Wed, 8 Dec 2010, Bert Freudenberg wrote: >>> >>>> Test case: >>>> >>>> Color fromString: 'yellow' >>>> >>>> used to return yellow. Now it returns a very dark gray. >>>> >>>> The culprit is in #asNumber: >>>> >>>> '16rYE' asNumber >>>> >>>> used to raise an error. Now it silently returns 16. >>> >>> It returns 0 since Squeak 3.9. >> >> No, it returns 16 now. It ignores everything after the "6". > > I see. It did return 0 in Squeak 3.9. Seems like ExtendedNumberParser is not fully backwards compatible, but this is an edge case. > >> >>> Relying on such an error is bad idea and fixing this method is easy. >> >> Agreed. >> >>> Though it may have been hard to track the problem down. >> >> Not *that* hard, fortunately ;) >> >>> I wonder why is ColorNames an OrderedCollection instead of an IdentitySet. >> >> No idea. Historical I guess. > > Okay, I'll change it. :) Set should be fine, no? - Bert - |
On Wed, 8 Dec 2010, Bert Freudenberg wrote:
> > On 08.12.2010, at 16:36, Levente Uzonyi wrote: > >> On Wed, 8 Dec 2010, Bert Freudenberg wrote: >> >>> >>> On 08.12.2010, at 15:36, Levente Uzonyi wrote: >>> >>>> On Wed, 8 Dec 2010, Bert Freudenberg wrote: >>>> >>>>> Test case: >>>>> >>>>> Color fromString: 'yellow' >>>>> >>>>> used to return yellow. Now it returns a very dark gray. >>>>> >>>>> The culprit is in #asNumber: >>>>> >>>>> '16rYE' asNumber >>>>> >>>>> used to raise an error. Now it silently returns 16. >>>> >>>> It returns 0 since Squeak 3.9. >>> >>> No, it returns 16 now. It ignores everything after the "6". >> >> I see. It did return 0 in Squeak 3.9. Seems like ExtendedNumberParser is not fully backwards compatible, but this is an edge case. >> >>> >>>> Relying on such an error is bad idea and fixing this method is easy. >>> >>> Agreed. >>> >>>> Though it may have been hard to track the problem down. >>> >>> Not *that* hard, fortunately ;) >>> >>>> I wonder why is ColorNames an OrderedCollection instead of an IdentitySet. >>> >>> No idea. Historical I guess. >> >> Okay, I'll change it. :) > > Set should be fine, no? Color names are Symbols, so it's the best to keep them in an IdentitySet if performance matters (and there are not too many Symbols to store). But in this case a Set is better, because we can (ab)use the fact that Strings and Symbols can be equal. Levente > > - Bert - > > > > |
Free forum by Nabble | Edit this page |