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,34d47d048b177d0b X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: limited/non-limited in Ada95 Date: 1997/10/21 Message-ID: #1/1 X-Deja-AN: 282344896 References: <3442C2A3.3781@bix.com> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-10-21T00:00:00+00:00 List-Id: In article , Matthew Heaney wrote: >What "important capabilities" do limited types have? ... The important capability of limited types is that you can't do assignment. Maybe you don't call that a "capability", but I think it is. Perhaps the right way to put it is: the programmer (of some abstraction) has the capability to document the fact that no assignments will happen on this type. And one can trust that documentation, since the compiler verifies it (as opposed to comments). It's like asking, "What capability do constants have?" After all, variables are just like constants, but can do more things (like have their value change). So what's the point of constants? Mainly, the point is that the reader of the code knows "this thing won't change". (There's also an efficiency point -- the compiler can take advantage of the fact that so-and-so won't change.) One could view "constant" as a restriction (you can't say "X := 3;") but I think it's just the opposite -- the Ada 'constant' feature allows the programmer to express something useful. There's no restriction -- if you want to change it, just say so (ie just don't make it a constant). Likewise, for limitedness. The fact that you can't assign to a limited thing is not a restriction, but, on the contrary, allows the programmer to express an interesting fact. If you *want* to assign to it, fine, don't make it limited. - Bob