comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Advent of Code Day 7
Date: Wed, 9 Dec 2020 00:25:56 +0100	[thread overview]
Message-ID: <rqp224$iri$1@dont-email.me> (raw)
In-Reply-To: <5de252c8-844b-4d1e-9c08-e8ae18b6b043n@googlegroups.com>

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

A string type is just a 1D array type with a character type for components. The 
definition of type String in pkg Standard is given in ARM A.1 as

type String is array (Positive range <>) of Character with Pack;

(http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-A-1.html)

A string literal is a special kind of array aggregate for string types, but 
normal array aggregates also work.

Bag_Description is clearly a constrained string subtype, and S'range is defined 
for all constrained array subtypes.

-- 
Jeff Carter
"Violence is the last refuge of the incompetent."
Foundation
151

      reply	other threads:[~2020-12-08 23:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07 23:03 Advent of Code Day 7 John Perry
2020-12-07 23:44 ` Randy Brukardt
2020-12-07 23:49   ` John Perry
2020-12-08 11:25 ` Jeffrey R. Carter
2020-12-08 16:55   ` John Perry
2020-12-08 23:25     ` Jeffrey R. Carter [this message]
replies disabled

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