HI,
   First of all I'm completly new so if I'm doing somethig wrong please tell me.
 
I'm working in something we may call a "framework".
The idea is to made a platform which can be used in many different applications. This is based in the idea of passing procedures (or access to procedures) as parameters.
 
Now here are the problems, let's suppose this package:
 
ADS:
 
Package ProcTry is
 
    type PtrProc is access procedure;
 
    Procedure TeEjecuto (Proc : PtrProc);
 
end ProcTry;
 
ADB:
 
Package body ProcTry is
 
Procedure TeEjecuto (Proc : PtrProc) is
begin
Proc.all;
end;
 
end ProcTry;
 
MAIN.ADB
 
With Text_IO; Use Text_IO;
With ProcTry; Use ProcTry;
 
procedure main is
 
procedure KBHandler is
begin
Put_Line("HI");
end KBHandler;
 
C : Character;
 
begin
TeEjecuto(KBHandler'Access);
Get_Immediate(C);
While (C/='A') loop
TeEjecuto(KBHandler'Access);
Get_Immediate(C);
end loop;
 
end main;
 
When I compile this, I get this:
 
TeEjecuto(KBHandler'Access);
                |
                |
 Subprogram must not be deeper than access type
 
What does this means??
 
Now if I change de definition of teh access to private:
 
Package ProcTry is
 
    type PtrProc is Private; 
    Procedure TeEjecuto (Proc : PtrProc);
Private
    type PtrProc is access procedure;
end ProcTry;
 
This is what I get:
 
TeEjecuto(KBHandler'Access);
                |
                |
Expected private type "PtrProc" defined at proctry:4
Found type access to "KBHandler" defined at line 14
 
How do I "tell the compiler" that KBHandler is actually of PtrProc type ???
 
The only thing I could get to work is this:
 
ADS
 
Generic type PtrProc is access procedure;
   
    Package ProcTry is
    Procedure TeEjecuto (Proc : PtrProc);
 
end ProcTry;
 
ADB
 
Package body ProcTry is
 
Procedure TeEjecuto (Proc : PtrProc) is
begin
Proc.all;
end;
 
end ProcTry;
 
MAIN.ADB
 
With Text_IO; Use Text_IO;
With ProcTry;
 
procedure main is
 
type w is access procedure;
Package S is new ProcTry(w); use s;
 
procedure KBHandler is
begin
Put_Line("HI");
end KBHandler;
 
C : Character;
 
begin
TeEjecuto(KBHandler'Access);
Get_Immediate(C);
While (C/='A') loop
TeEjecuto(KBHandler'Access);
Get_Immediate(C);
end loop;
 
end main;
 
But is going to be pretty confusing to redefine the types in every app. that uses it.
 
thanks in advance,
                  Chalito