Is there a way to determine "who" called "me" in a method? Or would doing this just be bad form?
I have a method in an object that creates another object FOR the sender. Rather than pass a parameter, it seemed like it would be nice to just "know" who was asking for the component.
For example, rather than
MyObject>>doSomething
WidgetBuilderSubclass buildComponentForObject: self anObject.
it would be nice to just
MyObject>>doSomething
WidgetBuilderSubclass buildComponent
and have
WidgetBuilderSubclass>>buildComponent
| obj widget |
obj := self thisMessageSender anObject.
...
^widget
I am probably asking a question that shows just how much I don't understand "the Smalltalk way!"
Thanks,
Rob