Object: Identity vs. Environment
Nevin Pratt
nevin at smalltalkpro.com
Thu Jun 12 01:19:52 UTC 2003
Your quoting of the ANSI standard, plus the defacto historical
background of every dialect for #respondsTo:, is what has swayed me that
what my understanding of the responsibility of #respondsTo: is, and what
the *actual* responsibility is, are two different things.
Learn something every day.
Nevin
Richard A. O'Keefe wrote:
<...snip...>
>Well, *this* is what *I* call unfortunate.
>It's the implementation of #resondsTo: in GNU Smalltalk.
>
>respondsTo: aSymbol
> "Returns true if the receiver understands the given selector"
> ^self class canUnderstand: aSymbol
>
>You'll notice that it's the same *implementation* as the traditional
>one, but the comment now describes what you seem to say is the actual
>responsibility. The two disagree. Someone wanting to know whether
>they can use #respondsTo: will stop reading here, having been assured
>that yes, they can. But they can't. To find out that they can't,
>they'd have to go on and read #canUnderstand:.
>
>What *is* "the actual responsibility of the method"?
>The only reasonably authoritative source available to me is the
>ANSI Smalltalk standard.
>
> 5.3.1.15
> A message to perform a selector, <code>selector</code>',
> for a given receiver will result in a "message not understood"
> condition if and only if the value of
> <code>receiver respondsTo: selector</code>
> is <i>false</i>.
>
> 5.3.1.19 Message: respondsTo: selector
> Definition: <Object>
> Return <i>true</i> if the receiver has a method in its
> behavior that has the message selector <code>selector</code>
> Otherwise return <i>false</i>.
>
>That is, according to the ANSI Smalltalk standard,
>"the actual responsibility of the method" is EXACTLY WHAT THE COMMENT
>IN SQUEAK SAYS IT IS.
>
>
>
<...snip...>
More information about the Squeak-dev
mailing list
|