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-Thread: 103376,63fa88e2f1a3ebea X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!newsfeed.stanford.edu!newsfeed.news.ucla.edu!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!news.compaq.com!newsfeed1.sea.pnap.net!newsfeed.pnap.net!brmea-news-1.sun.com!news1nwk.sfbay.sun.com!new-usenet.uk.sun.com!not-for-mail From: Ole-Hjalmar Kristensen Newsgroups: comp.lang.ada Subject: Re: Universal type in Ada Date: 16 Jun 2005 10:18:44 +0200 Organization: Sun Microsystems Message-ID: References: NNTP-Posting-Host: khepri06.norway.sun.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: new-usenet.uk.sun.com 1118910049 488 129.159.112.195 (16 Jun 2005 08:20:49 GMT) X-Complaints-To: usenet@new-usenet.uk.sun.com NNTP-Posting-Date: 16 Jun 2005 08:20:49 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:11405 Date: 2005-06-16T08:20:49+00:00 List-Id: Please do not do this. As someone (may have been John Max Skaller) on comp.lang.c++ said once, "casting is something you do when fishing". Think about what you are trying to do, and try to figure out how this can be accomplished by the tools available to you in Ada, like generics or run-time polymorphism. >>>>> "z" == zw writes: z> Hi, I am trying to create a Universal type in Ada such as "Object" in z> Java so that I could define a function that returns a value in this z> Universal type, then I could lower-cast value in this type to its z> specific type such as String, Float or any user-defined types. Because z> in Java if a method returns an Object, it could be casted to any other z> types that are subtypes of Object. Is there a Universal type in Ada? z> Could anyone tell me how to create such types in Ada, please? -- The Sun also rises