Path: ...!news.mixmin.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: fr.comp.lang.ada Subject: =?UTF-8?B?UmU6IFF1ZXN0aW9uIGRlIGfDqW7DqXJpY2l0w6k=?= Date: Sat, 2 Sep 2023 09:18:08 +0200 Organization: Adalog Lines: 22 Message-ID: References: <26366041-5cd3-4ccf-b1ac-a937a1c53f3en@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sat, 2 Sep 2023 07:18:06 -0000 (UTC) Injection-Info: dont-email.me; posting-host="c2b4540e4888ab4f0e0812ec5d1db919"; logging-data="367037"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1874bhHFmC3M8yR5T5kqBgM" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Cancel-Lock: sha1:TRs200/a5Jtv2p/KMWbrjCuV97E= In-Reply-To: Content-Language: en-US, fr Bytes: 2224 Le 01/09/2023 à 16:52, DrPi a écrit : > Ce qui me pose problème, c'est que j'aimerais que la fonction > "To_TW_STR" renvoie un type entièrement contraint. > EN reprenant les définitions de départ / >    subtype t_TW_STR32  is char_array (1 ..  34); >    subtype t_TW_STR64  is char_array (1 ..  66); >    subtype t_TW_STR128 is char_array (1 .. 130); >    subtype t_TW_STR255 is char_array (1 .. 256); > > J'aimerais pouvoir instancier une fonction qui retourne "t_TW_STR32", > une qui retourne "t_TW_STR64"... En Ada, l'homonymie et la résolution des surcharges est basée sur les types, jamais sur les sous-types. Pourquoi? Parce que le type est connu à la compilation, mais qu'un sous-type peut être dynamique. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX https://www.adalog.fr https://www.adacontrol.fr