Question about RoundTable and compiling derived CLS?

Posted by jquerijero on 29-Sep-2009 14:44

Does it use the .r of the Base CLS or the uncompiled cls file?

All Replies

Posted by Admin on 29-Sep-2009 15:08

Do you think roundtable does anything different than running the COMPILE statement? AFAIK that's the only way of compiling source code.

The online help says:

"For more information about compiling class definition files, see OpenEdge Getting Started: Object-oriented Programming."

Posted by jquerijero on 29-Sep-2009 15:14

I'm rephrasing my question, how does Rountable compile a CLS file that is dependent on another CLS through inheritance? Does the base class need to be compiled first before compiling derived CLS file, or Roundtable merges the base and derived CLS files then compile?

Posted by Shelley Chase on 29-Sep-2009 18:55

I do not know specifically what Roundtable does but I can comment on the behavior of the compiler. All classes in a hierarchy are compiled whether or not r code already exists. There is no timestamp checking it just always recompiles up the hierarchy even if its not saved to disk.

-Shelley

Posted by jquerijero on 30-Sep-2009 08:50

If I'm reading your post correctly. Given the following

Class A (a.cls)

Class B(b.cls) Inherits Class A

It will compile a.cls first then b.cls all the time.

Posted by Admin on 30-Sep-2009 08:56

A compile time message (&MESSAGE) in the base class may shed some light...

I've just tested that. Shelly, is it expected, that I see the &MESSAGE in the base class constructor twice while compiling the child class? The base class itself has another base class and that inherits System.Component.

Posted by Shelley Chase on 30-Sep-2009 08:57

Logically you are correct. What actually happens is that Pass 1 of the compiler runs on Class B and determines its dependencies. It then goes and compiles Pass1 on those classes, once it hits Progress.Lang.Object it runs Pass 2 of the compiler (what you think of as a compile) from the top down. So in your case the following would happen:

Pass1 on Class A

Pass1 on Class B

Pass2 on Class B

Pass2 on Class A

However I am only giving this detail because of your original question. You can simply think that Class B is compiled before Class A.

-Shelley

Posted by jquerijero on 30-Sep-2009 09:01

As long as class B is compiled against un-compiled class A. What I want is class B being compiled against the latest class A.

Posted by Jeff Ledbetter on 30-Sep-2009 09:04

If a parent class is modified, Roundtable will compile all subclasses of that modified class. Since we store all the necessary xref data, we know which classes inherit from the parent class.

The OE compiler will automatically recompile a parent class when a subclass is recompiled. It will not automatically recompile all the subclasses which is why we do it for you.

From the OE Object Oriented programming guide:

Caution: When you compile a class, although ABL automatically compiles all super classes in its class hierarchy, it does not know about and cannot automatically compile anyof the subclasses of the class you are compiling. Thus, when you change a superclass, you must compile the class and all subclasses of the class to ensure that allobjects with this class in their hierarchy inherit the updated state or behavior. ABL,by itself, has no knowledge of these subclasses, so you must keep track of themmanually or by using  configuration management tools.

Posted by Shelley Chase on 30-Sep-2009 10:31

The compiler always recompiles up the hierarchy so it always picks up the latest. It does not matter if the super class has been compiled or not. That is the reason for the MULTI-COMPILE flag which tells the compiler if it has already compiled a class during this session to use the one in memory rather than recompile each time the same class is used as a super class.

-Shelley

This thread is closed