Where would you put the return?

Joshua 'Schwa' Gargus schwa at cc.gatech.edu
Mon May 19 18:27:33 UTC 2003


I noticed that there were several changes in KCP that make exactly
the sort of change that you suggest, just not for that particular 
method.

Joshua

On Mon, May 19, 2003 at 09:53:40AM -0700, Benoit St-Jean wrote:
> While we're in KCP mode, I was wondering if there was
> any good reason for the following code in
> Object>>#isKindOf:
> 
> isKindOf: aClass 
> 	"Answer whether the class, aClass, is a superclass or
> class of the 
> 	receiver. "
> 	self class == aClass
> 		ifTrue: [^ true]
> 		ifFalse: [^ self class inheritsFrom: aClass].
> 
> 
> Why isn't it written like that:
> 
> ^self class == aClass
> 		ifTrue: [true]
> 		ifFalse: [self class inheritsFrom: aClass].
> 
> Just curious.  You can find similar "multiple returns"
> in a few places in the image...  Not really important
> but I prefer the "cleaner" version...
> 
> My 2 cents.
> 
> 
> =====
> -----------------
> Benoit St-Jean
> Yahoo! Messenger: bstjean
> A standpoint is an intellectual horizon of radius zero. -- Albert Einstein



More information about the Squeak-dev mailing list