[squeak-dev] Should you override #doesNotUnderstand: and #respondsTo: together?

Tobias Pape Das.Linux at gmx.de
Fri Jan 31 09:30:20 UTC 2020


> On 31.01.2020, at 10:14, Thiede, Christoph <Christoph.Thiede at student.hpi.uni-potsdam.de> wrote:
> 
> Hi all,
> 
> just struggled over the fact that Json objects provide access to their keys via #doesNotUnderstand:, but they do not override #respondsTo:. Example:
> 
> json := Json readFromString: '{"foo": 42}'.
> json foo. "42"
> json respondsTo: #foo. "false"
> 
> Question: Is this discrepancy indeed desired behavior? Or should we rather always try to override #doesNotUnderstand: and #respondsTo: together?

This is actually done very seldom, IIRC.
But maybe a good pattern, tho. Question is, should X class>>canUnderstand: be overwritten, too?

Best regards
	-Tobias

> 
> Best,
> Christoph




More information about the Squeak-dev mailing list