ABL2DB

tamhas

ProgressTalk.com Sponsor
I am considering some issues about future directions for ABL2DB and would like to solicit some input from the community.

In ABL, in procedures, we have
(unqualified)
shared
new shared
new global shared

In classes we have
private
protected
public
+ static

In Proparse we have
Imported
Exported

Something is Imported if it is shared, i.e., originally defined elsewhere.
Something is Exported if it is new shared, new global shared, public, or protected, i.e., defined in that compile unit and available elsewhere.
Definitions in procedures with no qualification and private ones in classes are neither imported or exported.

Now, that makes a certain sense, but it means that from the Symbol (e.g., variable name or whatever) I can only tell Imported or Exported, not what qualifier actually made it that way. To do that I have to parse the actual define node (a bit of a PITA).

In the current ABL2DB schema I have SharedObject, which is all types (TT, WT, variable, query, etc.) and then a table for each type, e.g., SharedVariable. Anything that is Shared in any way is in SharedObject, so there is no field for shared. There is a flag in SharedObject for New. In SharedVariable there is a flag for Global. It is in SharedVariable and some other SharedX and not in SharedObject because not all SharedObjects can be defined as global. Each type of SharedX has fields appropriate to that type of object such as DataType or Like.

So, there are two questions here. One is what I do to support the qualifiers of classes. I would think nothing in a class is Imported except something defined in a superclass ... and I will have to explore what that looks like ... seems to exist in the Parse tree with no definition or Symbol (???). So, public and protected are going to be the equivalent of New shared. So I could:
1. Leave the schema as is and map things like this.
2. Add a flag to distinguish public vs protected.
3. Add a field which recorded the actual qualifier.

The other related question is whether I want to also capture non-shared and private objects. For things like simple variables, this is certainly less interesting than shared ones, but for things like temp-tables and such it seems possibly more interesting. And, even for variables I suppose one could do things like report on variables which are not private to a procedure or method, but referenced in the procedure or method ... although there is nothing wrong with that. Buffers, on the other hand, that might be important. So, choices are:
1. Track only shared things as now, including public and protected.
2. Also track limited other things like buffers (possibly as part of allowing a query to reference more than one buffer)
3. Track anything I can.

Opinions solicited.
 

tamhas

ProgressTalk.com Sponsor
I have recently been exploring the use of Proparse to track the scope of various object types (buffers, variables, etc.). I thought this might also give me the resolution on calls to sub-compile units, but it looks now like that is going to require a different effort. But, in the mean time, this means I have to decide what to do with this information.

In the current version of ABL2DB I am tracking shared objects - browse, buffer, dataset, frame, menu, query, stream, temp-table, variable, and work-table. In a SharedObject table I link a compile unit where it appears to the object and identify whether it is new or not. In a separate table for each object type, I indicate whether it is global, since not all shared objects can be global. In some cases these other tables contain additional information.

Now, I did shared objects because they are of particular interest in refactoring because they couple compile units. I.e., a variable UserName defined as new shared in one compile unit and just shared in another is a dependency link between those compile units. Of course, the same shared variable name may be defined in other compile units and not indicate a dependency because they are not part of the same group of code. I use the name Functional Group to refer to all of the code which can be reached from some main compile unit which is run by a menu selection or batch function. So, usually one will analyze shared object use within a Functional Group.

Non-shared objects are typically going to be of interest only within a single compile unit (with some possible exceptions like TTs passed by reference and the like). One notable exception to this might be things defined LIKE a database object where one might want to see all the instances if one was contemplating a DB change.

So, the question is, should I capture every instance of one of these objects in every compile unit according to the scope in which it is defined or is this level of detail something you are going to go to the code for? Or, would you only want the LIKEs?

There are some interesting database design issues here and I would be interested if anyone had any input. For example, I currently have
CompileUnit
V
SharedObject (Name, Type, IsNew, SharingQualifier)
V
SharedVariable (IsGlobal, DataType, LikePhrase, AssignedTo, AssignedFrom, Variable/Property)

Now, a regular Variable has these same properties with the exception of IsGlobal and it is going to be linked to a Block, not the whole CompileUnit, so does SharedVariable become Variable, and IsGlobal move to an association table? I.e.,

CompileUnit
V
SharedObject (Name, Type, IsNew, SharingQualifier)
V
SharedVariable (IsGlobal)
V
Variable (DataType, LikePhrase, AssignedTo, AssignedFrom, Variable/Property)

and

CompileUnit
V
Block
V
Variable (DataType, LikePhrase, AssignedTo, AssignedFrom, Variable/Property)

And, if so, are shared variables included in this second association and is there a flag or link to indicate that. I guess that since SharedVariable would have a link to Variable that if one started with a Variable and there was a SharedVariable link, then one would know it was Shared.

Note, however, that the name is not in the second set, so it would seem that I would have to move Name into every specific SharedX, even though all SharedX have a name.
 
Top