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,103b407e8b68350b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-20 00:39:39 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!news-out.cwix.com!newsfeed.cwix.com!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!freenix!deine.net!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Anybody in US using ADA ? One silly idea.. Date: Mon, 20 Jan 2003 09:43:40 +0100 Message-ID: <33dn2vkc4r2o2nnl9nmg8udsq6a86otcb6@4ax.com> References: <1042477504.547640@master.nyc.kbcfp.com> <1042651417.215661@master.nyc.kbcfp.com> <1042743579.1165@master.nyc.kbcfp.com> <1042824191.538184@master.nyc.kbcfp.com> <1oyW9.13215$V75.2909@nwrddc02.gnilink.net> 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: fu-berlin.de 1043051978 25987187 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:33228 Date: 2003-01-20T09:43:40+01:00 List-Id: On Sun, 19 Jan 2003 14:13:17 GMT, Hyman Rosen wrote: >Dmitry A. Kazakov wrote: >> Here generics or built-in container types are the only options. > >Well, yes, that's what we've been trying to tell you :-) > >> Anyway array types solve this for one particular case without generics. > >Well, the genericity is there, it's just that the compiler does it for >you without you having to specify it yourself. Generics cannot solve the problem of related containers. The compiler could treat arrays of characters as a subtype of arrays of wide-characters. With generic it is impossible. >> Maybe, there is a more general way to deal with the containers of >> all kinds without generics. I do not know. > >The way it's handled in Java is to hide away the container inside a >class, then cut-and-paste code that does a cast to the desired type >whenever an object is extracted from the container. Horrible. I didn't mean that (:-)) There is an automated cut-and-paste called generics. However, if we could tie the tag of the element with the container's tag, we could solve the problem of specific containers, by deriving a new container type *statically* constrained by the element type. In this case the compiler would know the type of the elements. --- Regards, Dmitry Kazakov www.dmitry-kazakov.de