From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,691bbbf0ab0cc67e X-Google-Attributes: gid103376,public From: john@assen.demon.co.uk (John McCabe) Subject: Re: [Q] Returning Strings From A Function Date: 1997/04/06 Message-ID: <33478738.2129057@news.demon.co.uk>#1/1 X-Deja-AN: 231068904 X-NNTP-Posting-Host: assen.demon.co.uk References: <33454165.1658515@news.demon.co.uk> <33468b81.762963@news.demon.co.uk> Newsgroups: comp.lang.ada Date: 1997-04-06T00:00:00+00:00 List-Id: 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