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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,38fc011071df5a27 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-31 03:15:31 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!dialin-145-254-039-252.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ideas for Ada 200X Date: Sat, 31 May 2003 12:17:46 +0200 Organization: At home Message-ID: References: <6a90b886.0305262344.1d558079@posting.google.com> <3ED41344.7090105@spam.com> <3ED46D81.FF62C34F@0.0> <3ED46E07.4340CABC@0.0> <3ED4F3FD.A0EF7079@alfred-hilscher.de> <3ED4ECFC.5060000@cogeco.ca> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-039-252.arcor-ip.net (145.254.39.252) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: fu-berlin.de 1054376129 7721320 145.254.39.252 (16 [77047]) User-Agent: KNode/0.7.1 Xref: archiver1.google.com comp.lang.ada:38193 Date: 2003-05-31T12:17:46+02:00 List-Id: Robert A Duff wrote: > Lutz Donnerhacke writes: > >> * Larry Kilgallen wrote: >> > In article , Lutz Donnerhacke >> > writes: >> >> * Dmitry A. Kazakov wrote: >> >>> So, let's make all types "tagged"! I think it could be done little or >> >>> no compatibility impact. >> >> >> >> What about the representation clauses? If you do not use Ada for >> >> system programming, don't try to make Ada200x unusable for this >> >> purpose. >> > >> > Let's allow representation clause support for the tags and tagged types >> > ! >> >> Please show me a representation clause which leave out the tag >> completely. > > Tags are not needed for tagged objects. Tags are needed for class-wide > objects. If all types were tagged, then a reasonable run-time model > would *not* store the tag in every (tagged) object, but only in > pointer-to-classwide and the like. Or, one could give the programmer a > choice of whether to store the tag with the object -- it's more > efficient if you're going to use class-wide types a lot, and less > efficient if you're not. Exactly. I would also like to have this dope-strategy (presently used for array types) for discriminants as well. Actually, type tag is a specialized discriminant. I wish that we could ensure (for some types) that discriminants do not contaminate the value if statically known. The most interesting cases are: 1. Dimensioned values: type Dimensioned (Unit : SI) is record Value : Float; end record; subtype Speed is Dimensioned (Velocity); -- Discriminant removed type Vector (Unit : SI) is array (...) of Dimensioned (Unit); 2. Interval arithmetics: type Interval (From : Integer, To : Integer) is null record; 3. Dynamically constrained numerics: type My_Word (Range : Integer) is mod Range; type My_Integer (Min, Max : Integer) is range Min..Max; subtype Int_8 is My_Integer (-128, 127); procedure Get (X : in out My_Integer) is begin Put ("Enter a value in ["); Put (Integer'Image (X.Min) & ".." & Integer'Image (X.Max)); Put ("]"); ... -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de