Discussions related to Visual Prolog
sbishop61
Posts: 20
Joined: 9 May 2021 9:55

inherited facts not shown in the browse information page

Post by sbishop61 »

If a class implementation (aa), has a facts section, that is shown in the browse information page for the class aa.
If a second class (bb) inherits the class, while the aa predicates are shown in the browse information page for the class bb, the aa facts are not. As a a sub object (class aa) will be created for every object (Class bb) shouldn't the facts section be shown for class bb in the browse information page?

Code: Select all

interface aa predicates     p1 : (integer X). end interface aa   class aa : aa end class aa   implement aa facts     class_aa_objectFact : integer := 7. clauses  p1(X)........ end implement aa   interface cc predicates     p2 : (integer X). end interface cc   class bb : cc end class bb   implement bb inherits aa clauses  p2(X)........ end implement bb
Martin Meyer
VIP Member
Posts: 358
Joined: 14 Nov 2002 0:01

Re: inherited facts not shown in the browse information page

Post by Martin Meyer »

Thomas may correct me, but I think the answer is

no, the fact in the inherited class aa should not be displayed in the project tree in the class implementation of bb. This is because the fact in class aa is not accessible in the implementation of class bb.

The project tree displays for inherited classes only their public contents. The fact in class aa is declared but only locally inside aa.

I extend your example with two points: 1) The property class_aa_objectFact in the interface of aa, which makes the fact accessible from outside. 2) The predicate local_p1 in the implementation of aa. The example then is:

Code: Select all

interface aa   predicates     p1 : (integer X).   properties     class_aa_objectFact : integer.   end interface aa   %-   class aa : aa end class aa   %-   implement aa   facts     class_aa_objectFact : integer := 7.   clauses     p1(X) :-         class_aa_objectFact := X, % just some code to suppresses "unused"-warnings         local_p1(class_aa_objectFact).   predicates     local_p1 : (integer X). clauses     local_p1(_X).   end implement aa   %===   interface cc   predicates     p2 : (integer X).   end interface cc   %---   class bb : cc end class bb   %-   implement bb inherits aa   clauses     p2(_X).   end implement bb
In the project tree you see: 1) The property class_aa_objectFact, which is public in aa, is displayed in the class implementation of bb. 2) The predicate local_p1, which is only declared locally in aa, is not displayed in the class implementation of bb.

ProjectTree.jpg
You do not have the required permissions to view the files attached to this post.
Regards Martin
sbishop61
Posts: 20
Joined: 9 May 2021 9:55

Re: inherited facts not shown in the browse information page

Post by sbishop61 »

Thank you Martin, that makes sense.
Perhaps we could have filter or another tab; so we can chose to see private facts etc?