comp.lang.ada
 help / color / mirror / Atom feed
From: Darren New <dnew@san.rr.com>
Subject: Re: FAQ and string functions
Date: Sat, 03 Aug 2002 16:53:53 GMT
Date: 2002-08-03T16:53:53+00:00	[thread overview]
Message-ID: <3D4C0ABA.F38204E3@san.rr.com> (raw)
In-Reply-To: 3D4BCEC9.9030108@telepath.com

Ted Dennison wrote:
> 
> Darren New wrote:
> > Tell me how you declare a variable for an array whose bounds you don't know
> > until after you're past the declaration?
> 
> That's not what you said before. Its also a nearly irrelevant point,
> since you can almost always place declaration at the point where you
> *do* know the length.

Unless it's global to a package. I mean, if you never really need
variable-length arrays, why did Ada95 include unbounded strings? Clearly
there *is* a need for it.

> > Tell me how you add more elements to the end of an array?
> 
> In Ada the idiom isn't to add elements to the end of an existing array;
> its to build a new one with the two old arrays catenated. If this needs
> to be done progressively, one uses recursion.

OK, so when I said "you can't add one more element to the end of this array"
and you said "yes you can", then you were mistaken.

> > You can't do something like
> >   X := X & Y
> 
> No, but you can easily do:
> 
> declare
>     New_X : constant String := X & Y;

Which doesn't help if the point is to change X.
 
> > Yes, actually, it can be a huge hardship, if that's how you think about
> > things. If you've got a variable of global lifetime (or whatever Ada calls
> 
> We're back to my earlier point: Perhaps you should change how you think
> about things, rather than demand we "move the mountain to Mohhamed".

Well, I'm not demanding anything. I'm quite happy working within the bounds
of Ada when I need to use something Ada is strong at. I'm just trying to
point out that saying "it's not there because you don't need it" is probably
not going to get many people used to more convenient languages interested in
Ada.

> > Well, X idiom is kind of what we're talking about here. Of course Ada
> It shouldn't be.

In the sense that it was the OP's original question. Surely you can't mean
"don't ask that question."

> If you can do the same tasks Idiom X is used for in Ada
> with idiom Y, and idiom Y isn't a royal pain comparativly, then I don't
> see a problem (except perhaps with training).

I think how painful it is depends on what you're trying to do and how you're
trying to do it. Personally, I see *no* relationship between
  X := X & A
and
  declare new_X : blah := X & A

I mean, wouldn't the same argument hold if someone said "Why doesn't
language Blah have a while loop?" and you gave the answer "Well, the idiom
in Blah is to use conditional gotos, which is not a royal pain."

> > But this works poorly in many places where, for example, you want to
> > accumulate a bunch of results into an array. Like, I want to read lines from
> > the terminal into an array of strings until I get a blank line.
> 
> Only if you refuse to use recursion. 

Recursion is not always possible either, if other tasks need to be handled
coherently, if (say) other tasks need to look at the value of the list while
you're waiting for more input to come in, if you want to update a GUI based
on the lines of text, if you're filling in the array based on the processing
of a state machine (like a parser), etc etc. I.e., if you have something
that's difficult to program in a functional style.

> But as we said, that is something that will (hopefully) be corrected in
> the next Ada revision.

Yep. That would be nice.

-- 
Darren New 
San Diego, CA, USA (PST). Cryptokeys on demand.
   ** http://images.fbrtech.com/dnew/ **

They looked up at me like I was a T-bone steak
  walking into an all-you-can-eat seafood buffet.



  reply	other threads:[~2002-08-03 16:53 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-30  6:32 FAQ and string functions Oleg Goodyckov
2002-07-30  8:52 ` Colin Paul Gloster
2002-07-30 13:48 ` Ted Dennison
2002-07-31  4:52   ` Brian May
2002-08-01 16:09     ` Ted Dennison
2002-08-02  0:21       ` Brian May
2002-08-02  1:56         ` tmoran
2002-08-02 13:59         ` Ted Dennison
2002-07-31  7:46   ` Oleg Goodyckov
2002-07-31  9:04     ` Lutz Donnerhacke
2002-07-31  9:39       ` Pascal Obry
2002-07-31 15:06         ` Oleg Goodyckov
2002-07-31 16:50       ` Oleg Goodyckov
2002-07-31 20:16     ` Simon Wright
2002-07-31 20:56       ` Robert A Duff
2002-08-01  0:11         ` Darren New
2002-08-01  1:08           ` tmoran
2002-08-01  9:25           ` Brian May
2002-08-01 11:20           ` Oleg Goodyckov
2002-08-01 15:43             ` Darren New
2002-08-01 21:37               ` Robert A Duff
2002-08-03  0:42                 ` Ted Dennison
2002-08-03 13:51                   ` Robert A Duff
2002-08-03 16:43                   ` Darren New
2002-08-05 13:37                   ` Stephen Leake
2002-08-02  8:01               ` Oleg Goodyckov
2002-08-02 16:09                 ` Darren New
2002-08-01 11:09         ` Oleg Goodyckov
2002-08-01 14:08           ` Frank J. Lhota
2002-08-01 15:06             ` Robert A Duff
2002-08-01 16:05             ` Oleg Goodyckov
2002-08-01 14:57         ` Georg Bauhaus
2002-07-31 22:04     ` Dmitry A.Kazakov
2002-07-31 15:23       ` Oleg Goodyckov
2002-08-01 21:57         ` Dmitry A.Kazakov
2002-08-01 13:10           ` Oleg Goodyckov
2002-08-02 23:29             ` Dmitry A.Kazakov
2002-08-02 16:35               ` Oleg Goodyckov
2002-08-05 11:50                 ` Dmitry A. Kazakov
2002-08-05 14:29                   ` Larry Kilgallen
2002-08-05 14:57                     ` Dmitry A. Kazakov
2002-08-05 15:12                   ` Oleg Goodyckov
2002-08-05 16:20                   ` Darren New
2002-08-05 17:01                     ` Georg Bauhaus
2002-08-05 17:48                       ` Darren New
2002-08-05 19:06                         ` tmoran
2002-08-05 20:08                           ` Darren New
     [not found]                     ` <slrnakv3q9.p2.lutz@taranis.iks-jena.de>
     [not found]                       ` <3D4FEFCB.3B74F5E5@san.rr.com>
2002-08-14  0:07                         ` Randy Brukardt
2002-08-01 14:29     ` Ted Dennison
2002-08-01 16:47       ` Oleg Goodyckov
2002-08-02 14:05         ` Ted Dennison
2002-08-02 16:11           ` Darren New
2002-08-03  0:30             ` Ted Dennison
2002-08-03  0:58               ` Darren New
2002-08-03  2:04                 ` Dale Stanbrough
2002-08-03  2:32                 ` Ted Dennison
2002-08-03  2:47                   ` Darren New
2002-08-03 12:41                     ` Ted Dennison
2002-08-03 16:53                       ` Darren New [this message]
2002-08-04  1:08                         ` Ted Dennison
2002-08-04 16:23                           ` Darren New
2002-08-05  2:16                             ` Robert Dewar
2002-08-05  3:45                               ` Darren New
2002-08-05  9:56                     ` Lutz Donnerhacke
2002-08-05 16:02                       ` Darren New
2002-08-14  0:42                         ` Randy Brukardt
2002-08-14  1:45                           ` Darren New
2002-08-14 19:37                             ` Randy Brukardt
2002-08-14 20:25                               ` Stephen Leake
2002-08-14 20:22                           ` Stephen Leake
2002-08-15 19:24                             ` Randy Brukardt
     [not found]                         ` <jb1vkustkugeutalhvrhv1n0k9hqn2fpip@4ax.com>
     [not found]                           ` <3D4FF351.8F4A6C0A@san.rr.com>
2002-08-14  1:03                             ` Randy Brukardt
2002-08-14  1:05                       ` Robert A Duff
     [not found]                       ` <3D4EA1AC.80D17170@s <wccofc6b66u.fsf@shell01.TheWorld.com>
2002-08-14 20:29                         ` Stephen Leake
2002-08-26 17:53                           ` Robert A Duff
2002-08-26 18:40                             ` Chad R. Meiners
2002-08-26 18:52                               ` Robert A Duff
2002-08-26 21:46                                 ` Chad R. Meiners
2002-08-05 13:29                     ` Stephen Leake
2002-08-03  5:07                   ` achrist
2002-08-03 12:52                     ` Ted Dennison
2002-08-05 15:34                       ` Ted Dennison
2002-08-05 13:24                 ` Stephen Leake
2002-08-05 16:02                   ` Darren New
2002-08-05  7:18           ` Oleg Goodyckov
2002-08-02  1:04     ` tmoran
replies disabled

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