[ENH][Refactoring] cannotInterpret
Stephane Ducasse
ducasse at iam.unibe.ch
Sun Apr 13 13:26:20 UTC 2003
Hi marcus
I have a question regarding the second refactorings. I was always
hesitating about changing the code like that because of lack of clear
idea ;)
When I have a code that use the internal representation directly I
prefer to use a public method this way subclasses may redefine it
without copy and paste. Example:
whichClassIncludesSelector: aSymbol
(self includesSelector: aSymbol)
ifTrue: [^ self].
superclass == nil
ifTrue: [^ nil].
^ superclass whichClassIncludesSelector: aSymbol
versus
whichClassIncludesSelector: aSymbol
(self methodDict includeKey: aSymbol)
ifTrue: [^ self].
superclass == nil
ifTrue: [^ nil].
^ superclass whichClassIncludesSelector: aSymbol
Now for == nil ifFalse I do not know. I always have the impression
(Wrong I guess too) that for really small images this could have
incident but I'm not sure because inlining a method instead of calling
it will certainly take more space.
Any hints about that.
Stef
On Sunday, April 13, 2003, at 03:08 PM, Marcus Denker wrote:
> "Change Set: removeCannotInterp
> Date: 13 April 2003
> Author: Marcus Denker
>
> 1) removes Object>>cannotInterpret:
>
> This method is identical to the one allready defined in
> ProtoObject, and thus not needed
>
> 2) refactors ProtoObject>>cannotInterpret: to use ifNotNil:
> instead of '== nil ifFalse' and
> ifNotNil:ifNil instead of 'notNil ifTrue:ifFalse' "!
>
> --
> Marcus Denker marcus at ira.uka.de -- Squeak! http://squeak.de
>
> <removeCannotInterp.1.cs.gz>
>
Prof. Dr. Stéphane DUCASSE
http://www.iam.unibe.ch/~ducasse/
"if you knew today was your last day on earth, what would you do
different? ... especially if,
by doing something different, today might not be your last day on
earth" Calvin&Hobbes
"The best way to predict the future is to invent it..." Alan Kay.
Open Source Smalltalks: http://www.squeak.org,
http://www.gnu.org/software/smalltalk/smalltalk.html
Free books for Universities at
http://www.esug.org/sponsoring/promotionProgram.html
Free Online Book at
http://www.iam.unibe.ch/~ducasse/WebPages/FreeBooks.html
More information about the Squeak-dev
mailing list
|