comp.lang.ada
 help / color / mirror / Atom feed
From: "Ehud Lamm" <mslamm@mscc.huji.ac.il>
Subject: Re: Constraint error?
Date: Tue, 5 Jun 2001 00:44:51 +0300
Date: 2001-06-05T00:44:51+03:00	[thread overview]
Message-ID: <9fgvts$l8r$1@news.huji.ac.il> (raw)
In-Reply-To: 0SSS6.4214$v4.215546@www.newsranger.com


Ted Dennison <dennison@telepath.com> wrote in message
news:0SSS6.4214$v4.215546@www.newsranger.com...
> In article <wccvgmc6kc4.fsf@world.std.com>, Robert A Duff says...
> >I don't disagree with any of your advice.  But I couldn't resist pointer
> >out that string handling is a pain in Ada as well.
>
> Well..perhaps you are more used to specialized string-handling languages
than I
> am. I don't find it a pain at all, as long as you can keep things in
> perfectly-sized fixed strings. Generally, that is no problem, but I mostly
do
> system programming. I'll admit there are probably some domains where its a
lot
> tougher than I'm used to.
>
> So I guess I'm saying I disagree with you, but I might not have the whole
> picture either.
>

I feel that we use the term string to refer to many different abstractions.
In fact  the only thing common to all of them is that they represent
sequences of characters (even the character set question opens a can of
worms).

I rememeber that working with Rexx on an IBM mainframe I kept thinking
"hell, Snobol or Perl are much more powerful when it comes to strings." -
since the Rexx parse command is basically better suited to handle strings
with fixed layout. But this is the kind of records you usually find in the
kind of world Rexx was (originally) created for.

Now consider the confusion of someone coming from a Pascal or C background,
and seeing Ada strings for the first time.
They are called strings so he is sure that they are basically the same
abstraction as he is used to. So the C hacker will try to insert \0 all over
the place, and think that legnth should be found using something like
strlen. 'length is going to look crzay as hell, always returning the same
length...
The Pascal programmer implicitly assumes that strings remember their current
length, shrinking and expanding as needed.
The Ada string type, being an unconstrained array type, is of course
different than both of these.
Is it more natural to use? I don't think so. This is not meant as a
criticism. The other approaches described above are unnatural too - only
some times people learn them first.

I think that most poeple looking from a fresh point of view on the problem
would want some form of unbounded strings. Most language designers find such
strings too abstract, and prefer to start from more basic array of
characters types. This usually means that the library supplied string types
(like Unbounded in Ada) are less elegant to use, and don't have as nice a
syntax.

This is one reason why string handling languages are usually niche
languages, with specially designed syntax, suporting a  richer string
abstraction.


P.S
But do check the GNAT Spitbol packages.


--
Ehud Lamm   mslamm@mscc.huji.ac.il
http://purl.oclc.org/NET/ehudlamm <==  Me!








  reply	other threads:[~2001-06-04 21:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-03 22:30 Constraint error? McDoobie
2001-06-03 23:13 ` David C. Hoos, Sr.
2001-06-03 23:26   ` McDoobie
2001-06-04 15:42     ` Ted Dennison
2001-06-04 16:12       ` Marin David Condic
2001-06-04 20:52         ` Robert A Duff
2001-06-04 20:50       ` Robert A Duff
2001-06-04 21:13         ` Ted Dennison
2001-06-04 21:44           ` Ehud Lamm [this message]
2001-06-05 12:21       ` Marc A. Criley
2001-06-05 15:22         ` Ted Dennison
replies disabled

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