comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: non record limited type
Date: Wed, 21 Feb 2018 19:29:46 -0600
Date: 2018-02-21T19:29:46-06:00	[thread overview]
Message-ID: <p6l6eb$ln1$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 3a2e91d4-f563-4843-9c80-5a76732626d3@googlegroups.com


"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.


  parent reply	other threads:[~2018-02-22  1:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-21 15:58 non record limited type Mehdi Saada
2018-02-21 21:42 ` Jere
2018-02-21 22:29   ` Mehdi Saada
2018-02-21 23:08     ` Jere
2018-02-21 23:14     ` Jere
2018-02-22  0:09       ` Mehdi Saada
2018-02-22  0:26         ` Mehdi Saada
2018-02-22  2:57           ` Jere
2018-02-22 16:45         ` Jeffrey R. Carter
2018-02-22 17:06           ` Dmitry A. Kazakov
2018-02-22  7:56       ` Simon Wright
2018-02-22  1:20     ` Randy Brukardt
2018-02-22  1:29 ` Randy Brukardt [this message]
2018-02-22  8:25   ` Dmitry A. Kazakov
2018-02-22 23:24     ` Randy Brukardt
2018-02-23  8:58       ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox