[GAP] Strange OO behaviour when using private primitive subprograms

Diego Alonso Cáceres diego.alonso at upct.es
Tue Jun 5 12:34:22 CEST 2007


Dear all Ada enthusiasts,

last week I was trying to find a way to make Java-like protected methods using the new OO features of Ada'05 and I found that the compiler behaves in a strange way. I have attached a small project with all the files and I have compiled them with GPS 4.0.2 (20061211) in both Linux a Windows machines.

So, let's focus on the problem. The package P_Parent has a tagged type T and two primitive operations, one defined in the public part and the other in the private one. I have also declared two types that inherit from T, one in a child package P_Parent-Child  (TT) and one in a normal package P_Child (U). I was surprised I was able to do T.Private_Op but not Private_Op(T). Even more, TT.Private_Op also worked but U.Private_Op did not!

This two examples are kind of confusing because they show you don't get the same results using the new dot-notation and the old one. It also shows that private primitive operations do not work well, and that they are not equally inherited by all child classes. It depends wheter the child tagged type is declared in a child package or not. Any explanation about this behaviour?

Happy hacking! 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/gap/attachments/20070605/2fc4f71b/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: inheritanceIncoherence.zip
Type: application/x-zip
Size: 2460 bytes
Desc: not available
Url : /pipermail/gap/attachments/20070605/2fc4f71b/attachment.bin 


More information about the GAP mailing list