Ada ‘95 does not provide for a constructor mechanism with parameters for initializing newly created objects. The package Ada.Finalization provides an initialize procedure which is automatically called at object creation time, but that procedure takes only one argument, i.e. the object being operated upon. This is hardly useful, since initialization of any kind usually requires additional information, which needs to be supplied through arguments. One way to get around the parameter problem is to specify a tagged type with discriminants that is derived from the limited_controlled type. The parameters that are meant to be given to the initialize procedure are then given as discriminants to the tagged record object. We describe this technique with a concrete example and explore its limitations and implications.
Zeki O. Bayram