Solved TD-12844: Compiler calls the wrong LateBound-Methode

Report bugs and possible workarounds for ANSI TD versions
tojak

TD-12844: Compiler calls the wrong LateBound-Methode

Post by tojak » 11 Aug 2010, 08:26

We face the following issue with the td compiler:

it seems that in some cases the compiler calls the wrong latebound-methode, if a form window and a child table window on that form have the same latebound-methode.
See the attached sample. You simply have to click on the table to see the different behaviour.

hope this can be fixed soon.

tojak
You do not have the required permissions to view the files attached to this post.

Jeff Luther

Re: TD-12844: Compiler calls the wrong LateBound-Methode

Post by Jeff Luther » 11 Aug 2010, 22:48

Looks to me like 'circular' coding on the "not working" side. I've set a breakpoint on the line when you click in the row:

Code: Select all

Child Table Class: ctbl1
   On SAM_Click
      !
      Call .._LateBound( ) -- located below...

MyForm_Layer3.Tbl2._LateBound()
It calls:
    Call SalMessageBox( 'Late Bound has been called at the table.', 'Message', 0 )
    ! this...
    Call __TBL2_Clicked(  ) -- LOCATED in the form class below...

MyForm_Layer3.__TBL2_Clicked
It calls:
    Call LateBound () -- LOCATED below...

MyForm_Layer1.LateBound 
It calls:
    Call .._LateBound(  ) -- which calls MyForm_Layer3.Tbl2._LateBound() above, so round-and-round we go, in a loop.
I think you believe that it should be calling MyForm_Layer1._LateBound ??

If so, I am not sure I agree. Here's why: your original MyForm_Layer3.Tbl2._LateBound() was called via the SAM_Click above so the context (in terms or resolving late-bound references) is still in the table window and it looks as if it finds the first late-bound reference beginning there. That's why your Layer1.LateBound call to ".._LateBound()" finds the one in the table window first -- not the one 'local' to the form class -- again because that's the current context.

On the other hand, maybe the 'context' begins at the entry point for the function calls:
* Non-working/circular begins on SAM_Click in ctbl1
* Working first call instance frmWorking.__TBL1_Clicked() all the way to class MyForm_Layer2._LateBound() and that doesn't have that 2nd call to loop back again.

(Note that MyForm_Layer1.LateBound() has: Call .._LateBound( ) and it too calls non-local function; instead it calls MyForm_Layer2._LateBound() )

I took some time to analyze this and think it's a coding error, not a 'wrong' late-bound method. If you disagree, I have a question:

What do you think the correct series of method calls should be for form you have labeled "Not working window" ?? Be specific and describe as I've done above what each step is, starting with SAM_Click, and the fully-qualified name of the methods that you are referring to.

tojak

Re: TD-12844: Compiler calls the wrong LateBound-Methode

Post by tojak » 12 Aug 2010, 07:42

thanks for the reply and the time you spend on this issue.

the infinite loop is a result of the wrong called late-bound methode.
and you are right: I expect the late-bound at the window to be called and not the one at the child table.

In my opinion latebound methodes in a class (functional class, form window class, ...) can only be called by its base/parent class.
So if you call a latebound-methode at a form window class, it cannot be "received" at a child table.
A late bound "received" at a child table can only be called by its parent Child Table Class.


And why is there a difference if the child table is placed on a class "Form Window Class: MyFormXY" (the wrong late bound is called) or if it is placed on the "real" form window "MyFormXY: frmXY" (it works correct).

again thanks for the reply and the time you spend on this issue.
may some other developers can comment on this issue?!?

tojak

tojak

Re: TD-12844: Compiler calls the wrong LateBound-Methode

Post by tojak » 12 Aug 2010, 12:34

Now we are sure that something is not working correctly:

in the sample we renamed the child tables-latebound-methode name and now td completely crashes.
I guess that is not a feature?!? and cannot be correct.

We need an urgent fix.
You do not have the required permissions to view the files attached to this post.

Jeff Luther

Re: TD-12844: Compiler calls the wrong LateBound-Methode

Post by Jeff Luther » 12 Aug 2010, 18:17

Yes: Good, bad or indifferent TD should not crash. I have added TD defect: TD-12844
for this issue.

Return to “Bug Reports (TD 4.2 and older)”

Who is online

Users browsing this forum: [Ccbot] and 0 guests