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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:a6b:12c4:: with SMTP id 65-v6mr15425001ios.31.1525440604451; Fri, 04 May 2018 06:30:04 -0700 (PDT) X-Received: by 2002:a9d:3c4:: with SMTP id f62-v6mr1884705otf.8.1525440604295; Fri, 04 May 2018 06:30:04 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!weretis.net!feeder4.news.weretis.net!newsreader5.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.am4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!u74-v6no371165itb.0!news-out.google.com!b185-v6ni1970itb.0!nntp.google.com!v8-v6no1481214itc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 4 May 2018 06:30:04 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=96.247.198.106; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 96.247.198.106 References: <1c73f159-eae4-4ae7-a348-03964b007197@googlegroups.com> <878t9nemrl.fsf@nightsong.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: =?UTF-8?B?UmU6IEhvdyB0byBnZXQgQWRhIHRvIOKAnGNyb3NzIHRoZSBjaGFzbeKAnT8=?= From: Jere Injection-Date: Fri, 04 May 2018 13:30:04 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 3458 X-Received-Body-CRC: 1749872317 Xref: reader02.eternal-september.org comp.lang.ada:51969 Date: 2018-05-04T06:30:04-07:00 List-Id: On Wednesday, April 18, 2018 at 1:02:18 PM UTC-4, Lucretia wrote: > On Wednesday, 18 April 2018 14:29:30 UTC+1, Jere wrote: > > > 1. It favors static allocation over dynamic whenever possible. This is > > huge for small embedded systems. > > So does Ada. > This is an interesting point. I would agree that programmers here at comp.lang.ada promote avoiding access types whenever possible (Ada access types are more similar to pointers in the Rust world), but the Ada language itself doesn't really promote that. It leaves the implementation of many aspects up to the compiler vendor. Take, for example, discriminated records with a default discriminant. The language standard doesn't direct how to implement that. GNAT uses static allocation and throws an exception if you try to use a discriminant with very large range to create an array within the struct. If I understand Randy's posts from other email chains, in Janus it can use the heap to allocate the array. The secondary stack is another example. It can be implemented as static only (I do this for my bare metal runtimes), heap, or a combination of both based on size (I think GNAT does this normally?). Ada's bounded containers are another example. As far as I can see in the standard, they don't require the use of static allocation and can be heap implemented by the vendor. The implementation advice asks that they are implemented without heap, but it isn't binding (Which makes them a portability nightmare for bare metal environments). NOTE: That is my understanding based on emails here and what I have read in the RM. I apologize if I have misread. I'm not saying this because I think Ada is bad (on the contrary, I prefer Ada over Rust), but as a bare metal developer, Ada is frustratingly not specific on how memory is allocated by many basic language building blocks. In the core Rust language, I know where the heap memory comes into play, so it is much easier to develop bare metal.