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!weretis.net!feeder4.news.weretis.net!news.albasani.net!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: Why stack can hold indefinite objects but records cannot? Date: Tue, 28 Nov 2017 16:51:01 -0600 Organization: JSA Research & Innovation Message-ID: References: Injection-Date: Tue, 28 Nov 2017 22:51:02 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="8342"; 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:49228 Date: 2017-11-28T16:51:01-06:00 List-Id: "Victor Porton" wrote in message news:ovkh24$1bh5$1@gioia.aioe.org... > Why is it OK to create an indefinite object as a local variable ("on > stack") > but not OK to put an indefinite object into a record? > > How records are less powerful than the stack? Because records can be composed into other data structures, while a local variable cannot be composed into something else. > By the way, how indefinite local variables can be implemented? (just > curious) Depends on the compiler. Janus/Ada allocates them from a special storage pool (which really just wraps the normal heap), then frees them when the scope is left. Some other compilers change the size of the stack frame instead. > Moreover, wouldn't it to be a good idea to allow indefinite objects in > records (thus making the record itself indefinite, even if it has no > discriminants)? I realize that then it would be difficult to track which > records are definite and which indefinite. But what's about the idea? It would be very hard to implement in composite objects: imagine an multi-dimensional array of such records. That would be especially true for implementations that try to avoid using storage pools at all costs (which is necessary for some safety-critical customers). Randy.