Is [(FillInTheBlankMorph request: ' ) asNumber] on: Error do: []; necessary

stéphane ducasse ducasse at iam.unibe.ch
Fri Dec 31 14:35:12 UTC 2004


may be the alternative is to test whether the string really represent a 
number before converting and
then reask the user if this was not the case.

Because just saying that this was not a number is certainly not helping 
the user :).
I used isAllDigits or something like that in my own code.

Stef

On 30 déc. 04, at 02:49, Thomas Koenig wrote:

> I have a number of places in the code that look something like this:
> [id _ (FillInTheBlankMorph request: 'Enter the id of the post you''d
> like to jump to:' translated) asNumber ]
> 		 on: Error
> 		 do: [ self inform: 'That is not a valid number.'
> translated.
> 		        ^ nil ].
> Yet no mater what I key into the morph I don't trigger an error (don't
> see the error  message.)
> Is there a good argument for keeping the error block?  If so can you
> suggest an test condition that would trigger it.
>
> I'm inclined to remove this code, because it appears to add only
> complexity.
>
>




More information about the Squeak-dev mailing list