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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b47b15fda2aeb0b2 X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: Two ideas for the next Ada Standard Date: 1996/09/04 Message-ID: #1/1 X-Deja-AN: 178429912 references: <50aao3$3r88@news-s01.ny.us.ibm.net> <322B5BB0.422E@joy.ericsson.se> <50gelc$2le@goanna.cs.rmit.edu.au> <322C40B1.534A@ehs.ericsson.se> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-09-04T00:00:00+00:00 List-Id: Jonas says "I just state a fact of my own Ada code, it could be that I have not yet learnt how to write good Ada code. In Ada, pointers are distinct types which differs from C/C++, eg: type X1A is access X; type X2A is access X; X1P : X1A; X2P : X2A; To use X1P and X2P together often requires conversions." OK, now we begin to see why you are using so many unnecessary conversions. Why are X1A and X2A here separate types. They should only be separate types if they are conceptually different types. If you have to convert from one to the other at all frequently, this shows that they are NOT conceptually different types, and you should either use a single type, or use subtypes. Did you have a reason for making separate types? Or is it just that you don 't know how subtypes work, or somehow feel that separate types for everything is the Ada way? [it is not!] If you want the effect of only a single access type for a given type, then make a package that declares this type, and with it from everywhere that needs to use this type. Often you can package up a bunch of related types into a single package when following this approach. It definitely sounds like the conversions around your program are your own doing and not something that Ada is forcing on you!