From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 23 Aug 93 16:03:33 GMT From: cis.ohio-state.edu!pacific.mps.ohio-state.edu!math.ohio-state.edu!howland .reston.ans.net!vixen.cso.uiuc.edu!cs.uiuc.edu!cs.uiuc.edu!rowe@ucbvax.Berkeley .EDU (Kenneth E. Rowe) Subject: Re: Performing I/O on Private Types in Ada 9X (Was Re: OO Preprocessor for Ada) Message-ID: List-Id: I like your example, but let me do a more concrete one. Let's say I want to provide the capabilities of enumeration io for my private type. If type Object is not limited private, then procedure Some_Client_With_Io_Removed can just instantiate enumeration_io: with X; with Text_Io; procedure Some_Client_With_Io_Removed is package X_Io is new Text_Io.Enumeration_Io( Enum=> X.Object, Image=> X.Object'Image, Value=> X.Object'Value); ... end Some_Client_With_Io_Removed; But since X.Object is (tagged) limited private it is not so straight forward. Using your example I need to do the following: with Text_Io; package X.Io is procedure Get(File: in Text_Io.In_File;Item: out Object); procedure Get(Item: out Object); procedure Put(File: in Text_Io.Out_File; Item: in Object; Width: in Integer := 0; Lower_Case: in Boolean := False); procedure Put(Item: in Object; Width: in Integer := 0; Lower_Case: in Boolean := False); end X.Io; with Text_Io; package body X.Io is package Object_Io is new Text_Io.Enumeration_Io( Enum=> X.Object, Image=> X.Object'Image, Value=> X.Object'Value); procedure Get(File: in Text_Io.In_File;Item: out Object) is begin Object_Io.Get(File;Item); end Get; procedure Get(Item: out Object) is begin Object_Io.Get(Item); end Get; procedure Put(File: in Text_Io.Out_File; Item: in Object; Width: in Integer := 0; Lower_Case: in Boolean := False) is begin Object_Io.Put(File; Item; Width; Lower_Case); end Put; procedure Put(Item: in Object; Width: in Integer := 0; Lower_Case: in Boolean := False) is begin Object_Io.Put(Item; Width; Lower_Case); end Put; end X.Io; ------------------------------- What I'd really like to be able to do is with Text_Io; package X.Io is new Text_Io.Enumeration_Io( Enum=> Object, Image=> Object'Image, Value=> Object'Value); end X.Io; ------ (1) Could I have used renames in the long example? (2) Is the "really like to" example legal in 9X? (my feeling is that it isn't). Ken.