comp.lang.ada
 help / color / mirror / Atom feed
From: Mehdi Saada <00120260a@gmail.com>
Subject: Re: how to do things like procedure foo(A: string) is bar: string := A; begin; ...;end;
Date: Mon, 18 Dec 2017 07:34:48 -0800 (PST)
Date: 2017-12-18T07:34:48-08:00	[thread overview]
Message-ID: <dceffe89-10a1-4a76-b0a3-767e4afcd1a1@googlegroups.com> (raw)
In-Reply-To: <3c367d8d-351e-4c72-b259-c04a5285d025@googlegroups.com>

I got it pretty early (was clear in the course) that array, and strings for the matter, can have arbitrary bounds. So with unconstrained formal parameters I always use 'LENGHT, 'First and 'Last, and no 'Range in for loop.
But your "" & S was mind-boggling... It does have the effect of changings bounds without touching the content. Very useful, thanks !
Not sure about the constrained formal parameter part. What happens when you call something like
function FOO(T: String range 5..9) return String;
with a parameter whose index subtype's bounds are say, 1..4 ? You say it would raise Constraint_Error ? If so I can see the point. There's never too much facultative checks.


  reply	other threads:[~2017-12-18 15:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-16 20:56 how to do things like procedure foo(A: string) is bar: string := A; begin; ...;end; Mehdi Saada
2017-12-16 21:49 ` Jeffrey R. Carter
2017-12-17 12:40   ` Mehdi Saada
2017-12-17 13:25     ` Jere
2017-12-17 13:49       ` Jere
2017-12-17 13:51     ` Jeffrey R. Carter
2017-12-18 22:22     ` Randy Brukardt
2017-12-18  6:39 ` Robert Eachus
2017-12-18 15:34   ` Mehdi Saada [this message]
2017-12-18 17:31     ` Anh Vo
2017-12-18 21:14     ` Robert Eachus
2017-12-19 22:52   ` Robert Eachus
replies disabled

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