(Integer readFrom: 'abc' readStream) = 0

nicolas cellier ncellier at ifrance.com
Tue Jan 8 20:43:21 UTC 2008


Zulq Alam a écrit :
> What's the reasoning behind this?
> 
None.

Historically, readFrom: was mainly used from Parser (or Scanner) to read 
literal Number and only triggered by the presence of a digit character, 
  in this context, reading from 'abc' would never have happened.

Syntax error would have been handled by Smalltalk Compiler too (Parser), 
so no care was ever taken at readFrom: level.


That's all what is behind.
Our expectations and usage of readFrom: has evolved.

However, I always preferred the power of Compiler evaluate: to its very 
restricted avatar Number readFrom:

example of non smart readFrom:
	Number readFrom: '1+1'.
	Number readFrom: 'Float pi / 5 sin * 30'.

Of course, you gotta trust your users then, not very secure...

Nicolas




More information about the Squeak-dev mailing list