From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Generic formal type with 'Image Date: Wed, 6 Jun 2018 17:34:58 +0200 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 6 Jun 2018 15:34:59 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="23e84d1c0628dd789a0f101917042218"; logging-data="30564"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX193+2b1piUDsZ4lju1pmz6HSvgSyuBlxUk=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 Cancel-Lock: sha1:AD5imR1DbX6Gd0jJatnye6kPPnI= In-Reply-To: Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:52958 Date: 2018-06-06T17:34:58+02:00 List-Id: On 06/06/2018 03:03 PM, Alejandro R. Mosteo wrote: > I'm pretty sure the answer is "no", but just in case: You're right; as things are now, you can't do it. You have to do generic -- Name    type Printable is private;    with function Image (P : Printable) return String is <>; package Name is procedure Proc (P : in Printable); function Func (P : Printable) return Boolean; end Name; You can then, if you like, do things like generic -- Name_Discrete type Discrete is (<>); package Name_Discrete is procedure Proc (P : in Discrete); function Func (P : Discrete) return Boolean; end Name_Discrete; with Name; package body Name_Discrete is package Internal is new Name (Printable => Discrete, Image => Discrete'Image); procedure Proc (P : in Discrete) renames Internal.Proc; function Func (P : Discrete) return Boolean renames Internal.Func; end Name_Discrete; -- Jeff Carter "You me on the head hitted." Never Give a Sucker an Even Break 108