Instance-Specific Behavior 
Author Message
 Instance-Specific Behavior

I was reading Kent Beck's "Guide to Better Smalltalk" recently and ran
across an article on instance-specific behavior. It seemed like a lot of
fun and something to oh and ah the java folks. Anyway, I typed the
following in a workspace:

| b md inst |
b:=Behavior new.
b instanceSpec: Object instanceSpec.
b methodDictionary: MethodDictionary new.
b superclass: Object.

b basicCompile: 'dodo ^''la la'''.
b inspect.

Now, if I select and "Evaluate It". I get an inspector on my new Behavior
object. There are no methods in his method dictionary at all! Is this
right? Anyway, I replaced Behavior with ClassDescription and re-did it.
This time, I get a message in my inspectors that #name is the subclasses
responsibility. OK, So I implemented a TempClassDescription with #name
implemented to return 'foo'. And re-ran with my TempClassDescription and
I still get no methods in my method dictionary! Alright, I change
TempClassDescription to Class and re-ran it. Still no methods, so I then
used Metaclass and my methods appeared (even though they showed their
class as nil) and creating a new instance worked and responded to: #dodo.
But, this seems a little much since Metaclass should be a soleInstance.

Anyway, how I should go about getting instance specific behavior in
Dolphin. I also tried this in Squeak and got some interesting results as

The code above is pretty much taken from Kent's article, but made simpler
for my excursions...Anyway, I was just playing around with this
stuff....=) Seemed cool to me....

Blaine Buxton

Sat, 30 Oct 2004 11:15:49 GMT  
 Instance-Specific Behavior

Sorry, I just realized (thanks to your e-mail) that the
Object>>allowPerInstanceBehavior method is not shipped in the standard D5
product. I've uploaded the package to our website:

Stick this in %

Best Regards,

Andy Bower
Dolphin Support
Are you trying too hard?

Sat, 30 Oct 2004 21:05:34 GMT  
 [ 3 post ] 

 Relevant Pages 

1. Instance-specific behavior in VisualWorks

2. Instance-specific behavior in VisualWorks

3. case ~= instance specific behavior

4. ActiveX Object references - casting to a specific instance

5. Finding a Specific Class's Instance in a List

6. instance-specific methods

7. Strange instance class valiable behavior

8. Instance-Epecific Behavior

9. Unexpected behavior with class and instance variables...

10. How to change class instances behavior via reload?

11. Can4t add instance Var. to Behavior

12. Instance variables in Behavior


Powered by phpBB® Forum Software