Why should this not work?

Robert Hawley rhawley at plymouth.ac.uk
Sun Feb 25 16:49:37 UTC 2007


Hi Andreas

... that's the fix, but my question is "why not?".  Why should morphs not be able to move forward without having to fiddle with the player?  ... why should this not be a morph functionality?  ...  why should assuredPlayer be a coding inconvenience when it is not so for scripts?  It seems very odd and idocyncratic - particularly when morphs are also such a fundamental of computation independantly of eToys.  

>From the point of view of teaching initial programming (as opposed to using scripts) in Smalltalk, this is an arbitary separation - clumsy and artifactual - for example, liftPen and lowerPen assure the player for themselves, so why not for forward: ?.  Also, if I implement a script it associates with a player, but if I want to call it using the code as code why should the morph not know to check whether the player implements it?  There are probably good reasons for the way morphs and players have been implemented - I am not clear whether these are stylistic, driven by efficiency issues, or what.

I have a fix that makes this issues transparent - effectively it gives multiple inheritance from either morph or player.  Are there reasons why this is not a good idea? 

doesNotUnderstand: aMessage
	(self hasExtension not or: [self player isNil]) ifTrue: [
		(Player includesSelector: aMessage selector)
			ifTrue: [^self assuredPlayer perform: aMessage selector withArguments: aMessage arguments]
			ifFalse: [^super doesNotUnderstand: aMessage]].
	^self player perform: aMessage selector withArguments: aMessage arguments

Yours

Bob


-----Original Message-----
From: Andreas Raab [mailto:andreas.raab at gmx.de]
Sent: Sun 25/02/2007 5:21 AM
To: The general-purpose Squeak developers list
Subject: Re: Why should this not work?
 
Because scripts control players not morphs. Try this instead:

X := StarMorph new.
X openInWorld.
player := X assuredPlayer.
player turn: 135.
player forward: 100.


Robert Hawley wrote:
> X := StarMorph new.
> X openInWorld.
> X turn: 135.
> X forward: 100.
> 
> You can do it with scripts, so why not for code?
> 
> 






More information about the Squeak-dev mailing list