comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: array of strings in a function
Date: Thu, 16 Oct 2003 17:58:08 GMT
Date: 2003-10-16T17:58:08+00:00	[thread overview]
Message-ID: <Q_Ajb.3191$s93.1793@newsread3.news.pas.earthlink.net> (raw)
In-Reply-To: <u3rjb.783826$Ho3.210237@sccrnsc03>

tmoran@acm.org wrote:

>>You can't have a subprogram with an unknown number of parameters, which
>>is what you've been trying to write.
> 
>   But you can certainly have a set of subprograms with the same name
> but differing number of parameters:
>   procedure my_fun(s1 : in string) is ...
>   procedure my_fun(s1,s2 : in string) is ...
>   procedure my_fun(s1,s2,s3 : in string) is ...
>   procedure my_fun(s1,s2,s3,s4 : in string) is ...
> or you could use default values
>   procedure my_fun(s1 : string;        -- require at least one parameter
>                    s2 : string := "";
>                    s3 : string := "";
>                    s4 : string := "") is ..

Certainly. But to handle an arbitrary number of parameters, you have to 
write an arbitrary number of something (subprograms or parameters with 
defaults), which is impossible. An unconstrained array type allows you 
to handle an unbounded number of items with a single parameter 
(unbounded in the same sense as Unbounded_String).

-- 
Jeff Carter
"Perfidious English mouse-dropping hoarders."
Monty Python & the Holy Grail
10




  parent reply	other threads:[~2003-10-16 17:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-14 20:54 array of strings in a function Antonio Martínez
2003-10-15  2:55 ` Robert I. Eachus
2003-10-15  3:29   ` Jeff C,
2003-10-15  3:08 ` Jeffrey Carter
2003-10-16  6:40   ` tmoran
2003-10-16  9:31     ` Craig Carey
2003-10-16 18:13       ` Craig Carey
2003-10-16 21:44         ` Marius Amado Alves
2003-10-17 19:48           ` Craig Carey
2003-10-18 10:05             ` Marius Amado Alves
2003-10-18 20:05               ` Craig Carey
2003-10-30  9:42                 ` Craig Carey
2003-10-16 17:58     ` Jeffrey Carter [this message]
2003-10-16 20:00       ` tmoran
2003-10-17  0:51         ` Jeffrey Carter
2003-10-15 11:49 ` Antonio Martínez Álvarez
2003-10-15 12:29   ` Preben Randhol
2003-10-15 14:19   ` Ole-Hjalmar Kristensen
2003-10-16 14:30   ` Robert I. Eachus
2003-10-16 17:53     ` Jeffrey Carter
2003-10-17  0:48       ` Robert I. Eachus
2003-10-17 18:41         ` Jeffrey Carter
replies disabled

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