2009/5/28 Gabriel Cotelli <[email protected]>: > Hi Alexandre, > > I agree that it's better to get the exact error. So I think the negative > check is necessary, however Character class>>value: works in my image for > values greater than 255 (Character value: 257) = $? ... I don't known if > there's un upper limit to this or if depends on the character set... > > Character class>>value: already checks for > 255 and in that case don't use > the table.... > > The <0 assertion must be done. > > So if it's ok I want to do this: > > Retain Character class>>codePoint: anInteger > ^self value: anInteger > > And change Character class>>value: anInteger > > to perform the negative check and raise a better error in that case... > the >255 case don't raises an error (at least not always) so I open to > suggestions... > > Any comments are welcome. >
Yes, that is exactly what I tried to explain :) Nicolas > Thanks for the help, > Gabriel > > On Wed, May 27, 2009 at 6:33 PM, Alexandre Bergel <[email protected]> > wrote: >> >> I agree with what has been previously said. However, I think there is >> a fundamental difference between getting en error: 'Character code >> point ranges between 1 and 256 only' and 'subscript is out of bound'. >> Currently, CharacterTable has 256 slots. Maybe an initialization has >> to be done or something, but if you provide a value > 255, then you >> will get an error. >> >> Alexandre >> >> >> On 27 May 2009, at 17:26, Gabriel Cotelli wrote: >> >> > Yes, but if "value:" cannot lookup in the table uses some extended >> > character set... >> > >> > I think the negative check mut be done... about the > 255 I'm not >> > sure... >> > >> > On Wed, May 27, 2009 at 3:42 PM, Alexandre Bergel >> > <[email protected]> wrote: >> > > Please remove the upper limit, I think this was a >> > > pre-internationalization method which should have been updated but >> > was >> > > not because not used. >> > >> > But CharacterTable is an array of 256 characters long. >> > >> > Alexandre >> > >> > > >> > > >> > > 2009/5/27 Alexandre Bergel <[email protected]>: >> > >> Yes, with a negative argument. >> > >> Adding the check: >> > >> (0 > integer or: [255 < integer]) >> > >> ifTrue: [self error: 'parameter out of range 0..255']. >> > >> is probably enough. >> > >> Alexandre >> > >> >> > >> >> > >> On 27 May 2009, at 08:27, Gabriel Cotelli wrote: >> > >> >> > >> The ANSI Specification doesn't mention anything about that the >> > >> integer must >> > >> be in some range... the only thing that expects is that (Character >> > >> codePoint: x) codePoint = x .... >> > >> >> > >> anyway... I can add the verification... but that's not specified in >> > >> the >> > >> ANSI... anybody knowns some senders of this? I checked Pharo-Dev >> > >> and found >> > >> none.. maybe in the Web Image? >> > >> >> > >> Alexandre, how you obtain an error using value: ? given a negative >> > >> argument? >> > >> I tried with values greater than 255 and works in my image... >> > >> >> > >> Tonight I check that >> > >> >> > >> 2009/5/27 Alexandre Bergel <[email protected]> >> > >> I went through all the changes proposed by this slice. I am not >> > >> sure how >> > >> should I review the code, but here is my try: >> > >> - the new version of Character class>>codePoint: anInteger seems to >> > >> have a >> > >> different behavior: >> > >> The old (current) code is >> > >> codePoint: integer >> > >> "Return a character whose encoding value is integer." >> > >> #Fundmntl. >> > >> (0 > integer or: [255 < integer]) >> > >> ifTrue: [self error: 'parameter out of range 0..255']. >> > >> ^ CharacterTable at: integer + 1 >> > >> The new one is: >> > >> codePoint: anInteger >> > >> "Just for ANSI Compliance" >> > >> ^self value: anInteger >> > >> value: anInteger >> > >> "Answer the Character whose value is anInteger." >> > >> anInteger > 255 ifTrue: [^self basicNew setValue: anInteger]. >> > >> ^ CharacterTable at: anInteger + 1. >> > >> At the end an error is raised, but this is not the same. >> > >> Was this review useful? >> > >> Cheers, >> > >> Alexandre >> > >> -- >> > >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >> > >> Alexandre Bergel http://www.bergel.eu >> > >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> _______________________________________________ >> > >> Pharo-project mailing list >> > >> [email protected] >> > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > >> >> > >> _______________________________________________ >> > >> Pharo-project mailing list >> > >> [email protected] >> > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > >> >> > >> -- >> > >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >> > >> Alexandre Bergel http://www.bergel.eu >> > >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> _______________________________________________ >> > >> Pharo-project mailing list >> > >> [email protected] >> > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > >> >> > > >> > > _______________________________________________ >> > > Pharo-project mailing list >> > > [email protected] >> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > > >> > >> > -- >> > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >> > Alexandre Bergel http://www.bergel.eu >> > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> > >> > >> > >> > >> > >> > >> > _______________________________________________ >> > Pharo-project mailing list >> > [email protected] >> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > >> > _______________________________________________ >> > Pharo-project mailing list >> > [email protected] >> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> >> -- >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >> Alexandre Bergel http://www.bergel.eu >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> >> >> >> >> >> >> _______________________________________________ >> Pharo-project mailing list >> [email protected] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
