On Aug 31, 2004, at 1:36 PM, Thomas Reed wrote:
On Aug 31, 2004, at 11:38 AM, Brady Duga wrote:
The possibility would exist for class Foo to have an Action event
handler for some random Timer. In that case, we would have the same
problem. Code in the scope of Foo might want to change the period of
some timer from the action event triggered by the timer, and would
have to obtain a reference to the object that triggered the event.
Ahh, but this case is *not* the same! In the case of "self" referring
to the containing window, we know exactly what kind of object "self"
represents. It is a window, pure and simple. We can easily say
things like "self.Visible = false" because of this.
You may recall that self somehow takes on the type of the window;
presumably such voodoo could be done more generally.
Now, if we were at some hypothetical point in the future to be given
the ability to link any two objects with a similar container-type
relationship, the question becomes, what type of object is the
container? Suppose, to take your example, that the Timer's Action
event needs to make some change to its container. Can it just do
something like "container.SomeProperty = 1" (where container would be
a keyword that returned the object Foo)? How could it know that its
container would have such a property, without the cumbersome addition
of "if container isa FooType then"?
A Timer doesn't know how its Action event is implemented.
I think this idea is interesting, but it will also require some
complex additions to the language. And, frankly, I'm not sure how
excited I am about it, given that you can achieve the same thing by
simply subclassing Timer and giving the subclass knowledge of its
relationship with another object.
Such a trick would provide a drag-n-drop way of creating something like
a subclass, just as with controls and non-controls in windows. This is
a really good idea; Brady raised it earlier this year.
--------------
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>
|