Newcomer Trying to Learn Squeak
Jeffrey T. Read
bitwize at snet.net
Tue Dec 21 04:40:56 UTC 2004
Hi,
On Dec 20, 2004, at 9:21 PM, Rob Rothwell wrote:
>
> when fileNamed: is a method belonging to FileDirectory and not to
> FileStream?
>
Um, just because a method is associated with one class does not mean at
all that you can't have another class with the same method name.
In fact, Smalltalk (and by extension, Squeak) use messaging to achieve
method calls. This means that fileNamed: is a message that you send to
the object to get back a response (a new stream in this case). You can
send ANY object ANY message. Squeak is strongly typed but this type
checking is not done at compile time (unlike C++ and Java). The object
knows which messages it has a method for and which it doesn't, and will
raise an exception if it receives a message it doesn't understand.
Hope this helps.
--Jeff
More information about the Squeak-dev
mailing list
|