"S�bastien" wrote in message news:g0fash$73v$1@registered.motzarella.org... > Hi, > > I'm trying to create a generic procedure with some instance in the same > package. > > package MyPack is > > generic > type Toto is limited private; > procedure MyProc; > > procedure MyProcInt is new MyProc(Toto => Integer); > procedure MyProcStr is new MyProc(Toto => String); > > end MyPack; > > package body MyPack is > > procedure MyProc is > begin > -- Some stuff > end MyProc; > > end MyPack; > > I don't how to do this because: > 1) The compiler refuse the instance of MyProc because it doesn't have the > MyProc body > 2) If I put the body of MyProc in the package spec, the compiler refuses > it because it's not the right place. > > Thanks by advance for any help You can't do this. The language doesn't allow it because the body of the instances would have to be elaborated before the body of the generic unit. That wouldn't be a major problem for a subprogram, but for a generic package, that could lead to all kinds of havoc (specifically, accessing objects that don't yet exist). To be consistent, it raises Program_Error in all cases. (GNAT rejects some of these cases at compile-time by default, which is not standard Ada behavior. But it still wouldn't work.) And, as you've found out, the only way to put a body into a specification is via an instance. You'll have to put the instances in a separate unit from the generic unit. That's usually preferable anyway (especially in larger projects), but you don't have any choice in this case. Randy.