[comp.lang.ada] Exceptions as Generic Formal Parameters

vitro@NEMS.ARPA (Ronald Wonisch) (07/02/87)

     As a solution to your desire to trap an exception within a
generic unit, it is suggested that you put your procedure within a
package such as:

          package print is

             Printing_Error : Exception;

             generic

                type T is private;
                with procedure Try_to_Print_T (A_T : T);
             procedure Print_with_Caption (A_T : T; caption : string);

          end print;

     Here, Printing_Error is exported as the exception that
Try_to_Print_T should raise for any printing error.

     I do not think there are any cases where this method (or slight
variations there of ) would not only work, and also be more readable
than if exceptions were passed as generic parameters.

                                  D.E. White
                                  vitro@nems.arpa
-------