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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bd1d347880390e54,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-13 03:34:22 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Type conversions on pool-specific access types Date: Mon, 13 Oct 2003 12:34:41 +0200 Message-ID: <7kukov45dif9p7u2ohu6ml29mu9cgu621o@4ax.com> NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1066041261 22454355 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:774 Date: 2003-10-13T12:34:41+02:00 List-Id: Hi all! Who knows any reason why conversions between pool-specific access types are not allowed, provided that the storage pools are same? Isn't storage pool statically known? It is a real pain to use Unchecked_Conversion for: type Base is new Ada.Limited_Controlled with ..; type Base_Ptr is access Base'Class; for Base_Ptr'Storage_Pool use ...; procedure Foo (Object : Base_Ptr); ... type Derived is new Base with ..; type Derived_Ptr is access Derived'Class; for Derived_Ptr'Storage_Pool use Base_Ptr'Storage_Pool; ... declare Ptr : Derived_Ptr := new Derived; begin Foo (Base_Ptr (Ptr)); -- ILLEGAL! I do not understand why. ---------------- Another thing is initialization / finalization of controlled objects allocated on some specific storage pool. It could be a great problem if a pool-specific pointer is required: type Base_Specific_Ptr is access Base; for Base_Specific_Ptr'Storage_Pool use ...; ... procedure Finalize (Object : in out Base) is begin -- How to get a Base_Specific_Ptr to Object? -- We know that it is in the pool, but the compiler does not! This requires general to pool-specific conversion. Which could probably be non-portable, if Unchecked_Conversion is used to Object'Unchecked_Access to Base_Specific_Ptr. (?) --- Regards, Dmitry Kazakov www.dmitry-kazakov.de