PackageDescription: IamMyOwnClass


Iam My Own Class

Last published: January 10, 2007 by 'michael'

Defines 0 Classes
Extends 1 Classes


This package provides a proof-of-concept that you can make an object that has no class and is its own class/behavior provider. This is meant to be impossible, but this package demonstrates how you can make objects that have their own behavior and you can modify their behavior too.

"Demonstrates that the class of fakeInstance is itself"
| fakeClass fakeInstance |
fakeClass := BareBehavior new.
fakeInstance := fakeClass create.
fakeInstance class == fakeInstance.

"Demonstrates that we can add new behavior to fakeInstance and then call it"
| fakeClass fakeInstance |
fakeClass := BareBehavior new.
fakeInstance := fakeClass create.
fakeInstance methodAt: #yourself put: (Object compiledMethodAt: #yourself).
fakeInstance yourself class == fakeInstance