[Newbie] Dolphin Smalltalk Tutorial

Richard A. O'Keefe ok at atlas.otago.ac.nz
Thu Apr 20 04:22:19 UTC 2000


I asked about the method finder
	>How does it know that given the example
	>	'a'. 'b'. 'b'
	>('a' become: 'b') is not a sensible thing to try?

Bob Arning replied
	One method that shows up is methodFinder>>noteDangerous

Looking at that method, I note two things:
(1) It is a _fixed set_ of method names.
    A stylised method comment like "...[dangerous]..." or
    "...[dangerous:  Reason]..." would let people adding new classes
    with new method names say which of them should not be tried.
    I _think_ that you're allowed expressions in the method finder.
    I tried "Smalltalk. Smalltalk class" just now, and it wasn't
    rejected.  On the other hand, it's taking a very long time.
    Whoops!  Notifier popped up with "Space is low".
    Expressions _are_ allowed:  "1+1. 1. 3" worked.
    So people might try method finder with receivers of new classes.

(2) It is a fixed set of _method names_.  These names are not associated
    with classes.  If I introduceed
	class Animal
	  method species => Linnean species name
	  class Dog
	    method species => ^'Canis familiaris'
    then "Dog new. 'Canis familiaris'" in a method finder would get me
    nowhere.  From background reading, I thought species was only used
    in Collections.  Why is it in Object now?  The implementors are
    Interval, MappedCollection, ShortRunArray, Symbol, and WeakRegistry,
    which are kinds of collections, and also Object.  Why, for example,
    does AppleScriptInstance>>printOn:  write (self species asString)
    rather than (self class asString)?  Why does Date>>= aData ask
    whether (self species == aData species)?  Are there plans to have
    specialisations of dates that report Date as their species when that
    is not their class?





More information about the Squeak-dev mailing list