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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: non record limited type Date: Wed, 21 Feb 2018 19:29:46 -0600 Organization: JSA Research & Innovation Message-ID: References: <3a2e91d4-f563-4843-9c80-5a76732626d3@googlegroups.com> Injection-Date: Thu, 22 Feb 2018 01:29:48 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="22241"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:50535 Date: 2018-02-21T19:29:46-06:00 List-Id: "Mehdi Saada" <00120260a@gmail.com> wrote in message news:3a2e91d4-f563-4843-9c80-5a76732626d3@googlegroups.com... >I saw by trying it, that one could give a limited view, of a non-limited >non-record type like > type FOO is limited private; > private > type FOO is new INTEGER; > , which I wasn't sure of just by reading the RM. That's a cool feature > indeed, but > why isn't it possible to write also > type FOO is limited range 1..5; ? ? Is it by reference or copy, when such copy are made in the body ? I would guess by copy, but I prefer to ask The "limited private" rules stem from Ada 83, and thus exist for compatibility. (They work by implicitly making type limited.) The possibility of explicitly "limited" types is a much more recent innovation. These types that become limited just because of "limited private" also have the nasty property of becoming non-limited when you can see the full declaration. This causes all kinds of semantic complications that we'd rather not repeat, so everything new requires declaring it limited explicitly and staying that way. As to why there aren't limited elementary types (or limited array types, for that matter), no one has had any very compelling use for such a thing. Elementary types are by-copy, while explicitly limited types are by-reference types (see RM 6.2(7/3)). Generally, the "value" of a limited type includes the object identity in some sense, whereas values of elementary types are just values (the containing object being unimportant unless one is writing the value). These sorts of things could be reconciled, but no one has offered any really compelling reasons to do so. And we don't generally do work just for the sake of doing it. Randy.