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

Reply via email to