nevin at smalltalkpro.com
Thu Jan 22 13:29:13 UTC 2004
Wolfgang Eder wrote:
> Michael Roberts wrote:
> (lots snipped)
>> so how tight should the semantics be? We have both conversion and
>> 'sub-string' behaviour.
> I personally vote for a more rigid, conversion behavior.
> I even lean towards that '123abc' asInteger should raise an error.
> The "substring" seems still useful, it could be named like
> extractInteger, parseInteger, findInteger or something similar.
> Just my humble 2c
*By far* the most common use of #asInteger (for me) has always been for
extracting an integer from a GUI text field. Fumble fingered users
*quite commonly* hit other keys when they are entering numbers. And, I
don't *ever* remember a time when I found raising an error when
extracting a number from a string to be useful, with any Smalltalk (VA,
VW, or Squeak). It has always been real annoying to have to wrap the
converter in an error handler.
More information about the Squeak-dev