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 [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Indeed it may be useful to have the same verification.
stef On May 27, 2009, at 1:51 PM, Alexandre Bergel wrote: > 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 > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Alexandre Bergel-4
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 <[hidden email]>
_______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
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 .... -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Please remove the upper limit, I think this was a
pre-internationalization method which should have been updated but was not because not used. For the lower limit, (CharacterTable at: anInteger + 1) in #value: already does the job of signalling the out of bound error, but yes, translation of the codePoint with this + 1 might be troubling. My POV is this one: Since #value: is responsible of possible mis-interpretation, #value: should handle disambiguation of the Error. That is a kind of encapsulation. I suggest error report be moved in #value:, not in every sender of #value: On the other hand, the test could eventually be omitted for efficiency reasons. Though, if efficiency really matters, I would rather see Character becoming immediate. Nicolas 2009/5/27 Alexandre Bergel <[hidden email]>: > 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 <[hidden email]> > 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 > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > -- > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > Alexandre Bergel http://www.bergel.eu > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > > > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
> 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 <[hidden email]>: >> 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 <[hidden email]> >> 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 >> [hidden email] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> >> _______________________________________________ >> Pharo-project mailing list >> [hidden email] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> >> -- >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >> Alexandre Bergel http://www.bergel.eu >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> >> >> >> >> >> _______________________________________________ >> Pharo-project mailing list >> [hidden email] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
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 <[hidden email]> wrote:
_______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
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 > <[hidden email]> 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 <[hidden email]>: > >> 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 <[hidden email]> > >> 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 > >> [hidden email] > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > >> > >> _______________________________________________ > >> Pharo-project mailing list > >> [hidden email] > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > >> > >> -- > >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > >> Alexandre Bergel http://www.bergel.eu > >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > >> > >> > >> > >> > >> > >> _______________________________________________ > >> Pharo-project mailing list > >> [hidden email] > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > >> > > > > _______________________________________________ > > Pharo-project mailing list > > [hidden email] > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > > > -- > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > Alexandre Bergel http://www.bergel.eu > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > > > > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
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. Thanks for the help, Gabriel On Wed, May 27, 2009 at 6:33 PM, Alexandre Bergel <[hidden email]> wrote: I agree with what has been previously said. However, I think there is _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
2009/5/28 Gabriel Cotelli <[hidden email]>:
> 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 <[hidden email]> > 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 >> > <[hidden email]> 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 <[hidden email]>: >> > >> 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 <[hidden email]> >> > >> 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 >> > >> [hidden email] >> > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > >> >> > >> _______________________________________________ >> > >> Pharo-project mailing list >> > >> [hidden email] >> > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > >> >> > >> -- >> > >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >> > >> Alexandre Bergel http://www.bergel.eu >> > >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> _______________________________________________ >> > >> Pharo-project mailing list >> > >> [hidden email] >> > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > >> >> > > >> > > _______________________________________________ >> > > Pharo-project mailing list >> > > [hidden email] >> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > > >> > >> > -- >> > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >> > Alexandre Bergel http://www.bergel.eu >> > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> > >> > >> > >> > >> > >> > >> > _______________________________________________ >> > Pharo-project mailing list >> > [hidden email] >> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > >> > _______________________________________________ >> > Pharo-project mailing list >> > [hidden email] >> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> >> -- >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >> Alexandre Bergel http://www.bergel.eu >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> >> >> >> >> >> >> _______________________________________________ >> Pharo-project mailing list >> [hidden email] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by gcotelli
I agree Character class>>value: accepts values above 256, we were
talking about codePoint: however. Maybe codePoint is obsolete and should be removed. There is sender in a last Pharo + Mondrian + Moose + other stuffs. Side node. This is very strange, using a DejaVu font, I can printIt "Character value: 300". But printint-It "Character value: 257" takes forever. I am the only one? If not, then I open a ticket. > The <0 assertion must be done. An error saying that character values cannot be negative would be helpful. > 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... Looks good to me. > Thanks for the help, Glad it helped Alexandre > > On Wed, May 27, 2009 at 6:33 PM, Alexandre Bergel > <[hidden email]> 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 > > <[hidden email]> 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 <[hidden email]>: > > >> 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 <[hidden email]> > > >> 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 > > >> [hidden email] > > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > >> > > >> _______________________________________________ > > >> Pharo-project mailing list > > >> [hidden email] > > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > >> > > >> -- > > >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > > >> Alexandre Bergel http://www.bergel.eu > > >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > >> > > >> > > >> > > >> > > >> > > >> _______________________________________________ > > >> Pharo-project mailing list > > >> [hidden email] > > >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > >> > > > > > > _______________________________________________ > > > Pharo-project mailing list > > > [hidden email] > > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo- > project > > > > > > > -- > > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > > Alexandre Bergel http://www.bergel.eu > > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > > > > > > > > > > > > > _______________________________________________ > > Pharo-project mailing list > > [hidden email] > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > > > _______________________________________________ > > Pharo-project mailing list > > [hidden email] > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > -- > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > Alexandre Bergel http://www.bergel.eu > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > > > > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
> Maybe codePoint is obsolete and should be removed. There is sender in
> a last Pharo + Mondrian + Moose + other stuffs. No, It is part of ANSI. The following invariant must hold for all values of the character set: (Character codePoint: anInteger) codePoint = anInteger Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
I am aware this is part of ANSI. My thought behind my email was that
if nobody uses it, then this method could be moved into a package ANSI that can be separately loaded. I think this goes along the goal to remove junk from the base image. However, if there are users of this method, then it fully deserves to stay in Core. Cheers, Alexandre On 28 May 2009, at 11:48, Lukas Renggli wrote: >> Maybe codePoint is obsolete and should be removed. There is sender in >> a last Pharo + Mondrian + Moose + other stuffs. > > No, It is part of ANSI. > > The following invariant must hold for all values of the character set: > > (Character codePoint: anInteger) codePoint = anInteger > > Lukas > > -- > Lukas Renggli > http://www.lukas-renggli.ch > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
> I am aware this is part of ANSI. My thought behind my email was that
> if nobody uses it, then this method could be moved into a package ANSI > that can be separately loaded. Cool, then we also get rid of OrderedCollection? Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
On May 28, 2009, at 18:16 , Lukas Renggli wrote: >> I am aware this is part of ANSI. My thought behind my email was that >> if nobody uses it, then this method could be moved into a package >> ANSI >> that can be separately loaded. > > Cool, then we also get rid of OrderedCollection? So you are saying that nobody is using OrderedCollection? But seriously, this sort of mails are unhelpful. Adrian _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Well I think a statement of direction is required. Is *all* ANSI specific logic going to be in the base Pharo? Is base Pharo going to be ANSI compliant ?
I don't think people want to load chunks of it from here and there, assuming they know they need to do that.
On Thu, May 28, 2009 at 12:30 PM, Adrian Lienhard <[hidden email]> wrote: -- =========================================================================== John M. McIntosh <[hidden email]> Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com =========================================================================== _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
On May 28, 2009, at 21:41 , John McIntosh wrote: > Well I think a statement of direction is required. Is *all* ANSI > specific > logic going to be in the base Pharo? Is base Pharo going to be > ANSI compliant ? > I don't think people want to load chunks of it from here and there, > assuming > they know they need to do that. I see it like this: - keep already existing ANSI compliant behavior - where appropriate, fix semantics to be compliant - where appropriate, add new ANSI behavior Full compliance, on the other hand, is not a primary goal. Cheers, Adrian _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Yes.
The key problem with lot of packages is that they can rot and be forgotten. I think that at one point we should arrive to a system where lot of code is in package but we work on a system where they are automatically/ easily loadable. Stef On May 28, 2009, at 10:02 PM, Adrian Lienhard wrote: > > On May 28, 2009, at 21:41 , John McIntosh wrote: > >> Well I think a statement of direction is required. Is *all* ANSI >> specific >> logic going to be in the base Pharo? Is base Pharo going to be >> ANSI compliant ? >> I don't think people want to load chunks of it from here and there, >> assuming >> they know they need to do that. > > I see it like this: > > - keep already existing ANSI compliant behavior > - where appropriate, fix semantics to be compliant > - where appropriate, add new ANSI behavior > > Full compliance, on the other hand, is not a primary goal. > > Cheers, > Adrian > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Adrian Lienhard
> Full compliance, on the other hand, is not a primary goal.
ANSI Smalltalk is nominal. Too minimal for many tasks, and still people build their frameworks on these foundations to keep their code portable across platforms. If you undermine the Smalltalk standard, Pharo simply can't be the choice for open-source development anymore. Full ANSI compliance must a primary goal. Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
<OT>
> Full ANSI compliance must a primary goal. I politely disagree. ANSI is the least common denominator, the worst of all possible solutions. Just look at German pre-election politics right now and what you get is ANSI. it should be a loadable package, but not be driving design decisions. Just MTM (my two marks, when it still was worth something, like the Swiss Franks back then ;-) ) michael _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Free forum by Nabble | Edit this page |