From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=0.8 required=3.0 tests=BAYES_50 autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:a05:620a:a1d:: with SMTP id i29mr32471431qka.369.1607446543327; Tue, 08 Dec 2020 08:55:43 -0800 (PST) X-Received: by 2002:a05:620a:347:: with SMTP id t7mr31493185qkm.164.1607446543093; Tue, 08 Dec 2020 08:55:43 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!feeder1.feed.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 8 Dec 2020 08:55:42 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=2601:3c3:401:f550:e99c:b2d0:34bb:b0ed; posting-account=JSxOkAoAAADa00TJoz2WZ_46XrZCdXeS NNTP-Posting-Host: 2601:3c3:401:f550:e99c:b2d0:34bb:b0ed References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <5de252c8-844b-4d1e-9c08-e8ae18b6b043n@googlegroups.com> Subject: Re: Advent of Code Day 7 From: John Perry Injection-Date: Tue, 08 Dec 2020 16:55:43 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:60761 List-Id: On Tuesday, December 8, 2020 at 5:25:57 AM UTC-6, Jeffrey R. Carter wrote: > Humans are notoriously bad at counting things, and even worse at counting things > they can't see, so this kind of literal can be a source of errors, especially > during modification. (At least with Ada these tend to be compiler errors, not > run-time errors.) > > Of course, Ada offers a Better Way. You can write > > Description: Bag_Description := (Bag_Description'range => ' '); > > or > > Description: Bag_Description := (others => ' '); > > and be proof against any changes to Bag_Description's bounds. Very much appreciated! I was aware of "others =>" for arrays and records but didn't think to try it with strings. "Bag_Description'range =>" is entirely new to me.