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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8ca14c11fd6d2e56 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!proxad.net!usenet-fr.net!news.enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Christoph Grein Newsgroups: comp.lang.ada Subject: Re: generic parameter Copy for primitifs types. Date: Mon, 27 Jun 2005 06:28:17 +0200 Organization: Cuivre, Argent, Or Message-ID: References: <1119544911.159343.288010@g43g2000cwa.googlegroups.com> Reply-To: Christoph.Grein@eurocopter.com NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Content-Transfer-Encoding: 7BIT X-Trace: melchior.cuivre.fr.eu.org 1119847371 23223 212.85.156.195 (27 Jun 2005 04:42:51 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Mon, 27 Jun 2005 04:42:51 +0000 (UTC) Cc: comp.lang.ada@ada-france.org Return-Path: X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.0.1) Gecko/20020920 Netscape/7.0 X-OriginalArrivalTime: 27 Jun 2005 04:42:23.0800 (UTC) FILETIME=[9C8AF380:01C57AD2] X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:11678 Date: 2005-06-27T06:28:17+02:00 nblanpain@hotmail.com wrote: >Hello, > >this is my problem : > >----- >generic >type T_Item is private; >with procedure Copy (Left : in out T_Item; Right : in T_Item); >package Toto is >... >end Toto; >------ > >At instanciation, for T_Item = Integer for example, is there a methode >to take for Copy => ":=". Must I redefined Copy ? Can I say that, by >default, take ":=" ? > As you should know by now from all the answers there is no way to avoid defining Copy. As also others have pointed out, T_Item should probably be limited private. As it stands, Toto has := and Copy: package body Toto is ... X := Y; -- Do you really want both? Copy (X, Y); -- which to use? If T_Item is limited private, := is no longer available in Toto. What you perhaps don't know is that the actual type for a limited formal type need not be limited. If you say generic type T_Item is limited private; then you can take any definite type as actual.