[ENH] Empty return expression

Jarvis, Robert P. Jarvisb at timken.com
Mon Sep 27 13:56:15 UTC 1999


I don't like this because IMO it obfuscates what's going on without adding
value.  If you want to answer self in this situation, then type

	^self

This requires four keystrokes, and it's clear.  Besides, if the method is
going to answer 'nothing returned' shouldn't it answer nil instead of self?

Bob Jarvis
The Timken Company

> -----Original Message-----
> From:	Bert Freudenberg [SMTP:bert at isgnw.CS.Uni-Magdeburg.De]
> Sent:	Monday, September 27, 1999 4:36 AM
> To:	squeak at cs.uiuc.edu
> Subject:	[ENH] Empty return expression
> 
> Parser patch to allow empty returns that indicate 'nothing returned' like 
> 	foo ifTrue: [self doSomething. ^]
> instead of the currently often (mis-)used
> 	foo ifTrue: [^self doSomething]
> as short form of
> 	foo ifTrue: [self doSomething. ^self]
> 
> Discussion: 
> This syntax matches the implicit return of self at the end of
> a method. It makes the "void" return type of a method explicit, which is
> good for self-documenting code. It's backwards compatible. It's a minor
> change in the parser. So why not?
> 
> It's not compatible to other Smalltalks - but then, the brace constructs
> are even more different.
> 
>   /bert << File:  >> 





More information about the Squeak-dev mailing list