On 5/24/04 4:41 AM, "Joseph J. Strout" <joe at realsoftware dot com> wrote:
>> 2) Joe, you say that Alfred's hack is wrong. It can not work with
>> subclasses. I can easy see why it will not work.
>> (although I have not understand, it seems Alfred have told
>> that he have test and it still works.
>> may be exist some side-effect which make that hack safe?
>> and you do not see that side effect?
>> please clarify this.
>
> I'm sorry, I don't quite understand what you're asking here. But let
> me try to summarize. What Alfred suggested was not really a hack,
> just a dangerous optimization: caching the function pointer across
> objects. The problem is that different objects your code sees may
> actually be different subclasses, and so they might have different
> function pointers for the same method.
In case subclass OVERRIDE method of PARENT class.
Alfread, this is why you probably see that you can call subclass method.
You have forget to OVERRIDE method in subclass.
I think if you will use 2 classes where subclass OVERRIDE parent's method
then you will see that it not works.
BTW, anybody (Alfread?) can prepare small simple EXAMPLE on this approach.
> If you cache the first one
> you see, you can end up calling the wrong method later.
> What's especially dangerous about this problem is that the bug will
> only rarely cause a problem -- you are likely to not notice anything
> wrong at first, and then when your app starts blowing up six months
> later, have no idea why.
Agree.
--
Best regards,
Ruslan Zasukhin [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft dot com
web: http://www.paradigmasoft.com
To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------
_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|