comp.lang.ada
 help / color / mirror / Atom feed
From: john@assen.demon.co.uk (John McCabe)
Subject: Re: [Q] Returning Strings From A Function
Date: 1997/04/06
Date: 1997-04-06T00:00:00+00:00	[thread overview]
Message-ID: <33478738.2129057@news.demon.co.uk> (raw)
In-Reply-To: dewar.860265459@merv


dewar@merv.cs.nyu.edu (Robert Dewar) wrote:

>John McCabe said
<..snip..>

>John, it is still very difficult to understand what you are asking for.
>Your code above makes perfect sense if you want File_Name to be 12 characters
>long, and of course the assignment will check for 12 characters.

Exactly - but I want the assignment to check for <=12 characters.

>That is apparently NOT what you want, so it is not clear what "this" is
>that is "obviously impossible". You need to say what you have in mind.
>
>Do you want to pad the name with blanks to make the length 12? In that
>case you could write
>
>   File_name :=
>     Ada.Strings.Fixed.Head (Text_IO.Name (File), File_Name'Length));
>
>which seems pretty clear.

And not in Ada83, and not what I want.

>If you what you wanted was a string whose maximum length was 12, but to
>which smaller strings could be assigned, then Ada.Strings.Bounded is just
>the ticket.

EXACTLY - but it's not in Ada83.

>It is simply not at all clear to me from the above code what you have in
>mind. When you write some perfectly legal, perfectly sensible Ada code,
>and say "What I wanted was to do that, but it is impossible, you are
>obviously trying to say that you expected some other semantics from the
>code than the semantics defined in Ada. That's fine, anyone is allowed
>to say such things, and it is often interesting to know what features 
>people want, but it is inmpossible to *guess* from this perfectly 
>reasonable Ada code what you wanted it to do that was different from
>what it actually does in Ada.

I don't really know what you're waffling on about here since
all I originally asked for really was an example of how to use
functions that return strings in Ada83 (if you check my original
article, it mentions LRM83, not ARM95, hence if you think about it, it
should be obvious I'm using Ada83 despite it not being explicitly
stated).

>So why not try again saying exactly what you have in mind in a clear form.

See above.

>Don't try to write Ada, since apparently you think you can't do what you
>want to in Ada.

Yes, but in all your postings I have noticed you interpret Ada to mean
Ada95, and in that language I believe I can do what I'm trying to do.
Ada83, however does not let me, but I can get by without doing that.
As someone mentioned, string handling in Ada83 has its little
annoyances, and its obvious there has been major revisions placed in
the Ada95 definition.

>Instead describe informally what it is that you think you cannot do that
>you would like to do.



Best Regards
John McCabe <john@assen.demon.co.uk>




  reply	other threads:[~1997-04-06  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-04  0:00 [Q] Returning Strings From A Function John McCabe
1997-04-04  0:00 ` Joakim Olsson
1997-04-05  0:00 ` johnherro
1997-04-05  0:00   ` Mark & Zurima McKinney
1997-04-07  0:00     ` johnherro
1997-04-07  0:00       ` Robert Dewar
1997-04-07  0:00     ` Jon S Anthony
1997-04-07  0:00       ` johnherro
1997-04-08  0:00     ` Jeff Carter
1997-04-09  0:00     ` Looking for an Ada SCIENTIFIC UNITS checking package Ron House
1997-04-05  0:00   ` [Q] Returning Strings From A Function Robert Dewar
1997-04-06  0:00     ` John McCabe
1997-04-06  0:00       ` Robert Dewar
1997-04-05  0:00 ` John McCabe
1997-04-05  0:00   ` Robert A Duff
1997-04-05  0:00   ` Robert Dewar
1997-04-06  0:00     ` John McCabe [this message]
1997-04-06  0:00       ` Matthew Heaney
1997-04-06  0:00       ` Robert Dewar
1997-04-06  0:00         ` Nick Roberts
1997-04-07  0:00           ` Robert A Duff
1997-04-08  0:00             ` Nick Roberts
1997-04-07  0:00               ` Matthew Heaney
1997-04-06  0:00 ` John McCabe
replies disabled

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