Where would you put the return?

Stephane Ducasse ducasse at iam.unibe.ch
Mon May 19 20:34:41 UTC 2003


You are right. Your solution is better, especially in presence of true 
block closures as closure with returns
are not treated the same way as others. The doc of VW explained it 
better than I.

Stef

On Monday, May 19, 2003, at 06:53 PM, 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