j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
I agree, my prop was low level, yours is higher level (extensible)
Nicolas
Diego Fernandez:
My proposition is:
Number>>readFrom: aStringOrStream ^self readFrom: aStringOrStream ifFail: [^self error: 'cannot read a number']
If nil is what you want, you will have to write: value := Number readFrom: aStream ifFail: [nil]. A little longer than your proposition: value := Number readfrom: aStream.
The mine is: Number>>readFrom: aStringOrStream ^NumberParser new parse: aStringOrStream
NumberParser>>parse: aStringOrStream "on failure" NumberParsingException signal "or just ParseException"
I think that #readFrom: must be an extension of Number. So if you want more control of the parsing you can configure an instance of NumberParser. (may be you can have a FortranNumberParser :)).
________________________________________________________________________ iFRANCE, exprimez-vous ! http://web.ifrance.com
Attachments:
squeak-dev@lists.squeakfoundation.org