realbasic-nug
[Top] [All Lists]

Re: Replacing Me (was Re: Events vs. Methods)

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Replacing Me (was Re: Events vs. Methods)
From: Charles Yeomans <yeomans at desuetude dot com>
Date: Tue, 31 Aug 2004 15:55:46 -0400
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <20040830115204 dot C0643416CC3 at lists dot realsoftware dot com> <B72F25A2-FA88-11D8-B2DE-000A27B1C8AE at elfdata dot com> <9533F3C8-FA95-11D8-8447-0003931D7A4A at ljug dot com> <3307398A-FA97-11D8-8005-000A95DB6C90 at fireyesoftware dot com> <68095260-FA9E-11D8-8447-0003931D7A4A at ljug dot com> <C3F9C1A6-FAA0-11D8-B299-000A95A9544A at shaw dot ca> <3E5D895B-FABB-11D8-826C-003065F2C108 at shaw dot ca> <8B95CFA8-FAEB-11D8-B299-000A95A9544A at shaw dot ca> <p06002005bd598ce1cb53 at [130 dot 116 dot 148 dot 114]> <5DE6A484-FB45-11D8-B23F-000A95880024 at bitjuggler dot com> <96DB6366-FB5B-11D8-8447-0003931D7A4A at ljug dot com> <p06002003bd5a3f6de7fd at [203 dot 34 dot 30 dot 70]> <BE92DE2C-FB63-11D8-8447-0003931D7A4A at ljug dot com> <51F6F210-FB74-11D8-B23F-000A95880024 at bitjuggler dot com>

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>

<Prev in Thread] Current Thread [Next in Thread>