[Newbies] subclasses detect

Steve Wessels swessels1955 at yahoo.com
Tue Jul 31 20:49:06 UTC 2007

Its returning the actual matched class object.  Not a symbol.

  - Steve

Sent from my iPhone

On Jul 31, 2007, at 3:14 PM, gruntfuttuck <gruntfuttuck at gmail.com> wrote:


In the laser game tutorial by Stephan B Wessels I was intrerested by this

directionFor: aSymbol 
   ^ self subclasses
       detect: [:cls | cls directionSymbol = aSymbol]

The code appears here at the bottom of the page:

What I read this code as doing, in this example is: return an symbol object
which is a sublass instance varable, if it is the same as aSymbol.

What would happen if more than one subclass object had a match?

Also how else can subclasses detect: be used? It looks very interesting.


View this message in context: http://www.nabble.com/subclasses-detect-tf4196202.html#a11934239
Sent from the Squeak - Beginners mailing list archive at Nabble.com.

Beginners mailing list
Beginners at lists.squeakfoundation.org

Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. 

More information about the Beginners mailing list