Re: Character strings and arrays
- From: "James Giles" <jamesgiles@xxxxxxxxxxxxxxxx>
- Date: Mon, 24 Oct 2005 19:33:39 GMT
Richard E Maine wrote:
> James Giles <jamesgiles@xxxxxxxxxxxxxxxx> wrote:
>
>> But, we're tal;king about a hypothetical path the language
>> *could* have taken.
>
> Oh. I see. That wasn't clear to me from the original mention. (I don't
> appear to have been alone in missing this intended meaning).
Well, actually I wasn't originally talking about a hypothetical
development of the language, but merely responding to the
basic issue of where the ambiguity lies with respect to the
desire to omit the colon for single character substrings.
The thread subsequently developed into a hypothetical
discussion of what the language *could* have done. In that
context, the language *could* have done a lot of things. I've
just expounded the nature of some of the things I'd like to
have seen. In addition, I'd like for character assignment
*not* to pad with spaces, I'd like for character assignment
*not* to silently truncate, I'd like for character compares
*not* to extend with blanks, etc. So:
Character(10) :: str1, str2
...
str1 = "abc" ! LEN(str1) is now three, no blanks
str2 = "abc " ! LEN(str2) is four, with the single blank
write(*,*) str1<str2 ! outputs .true. since a short string
! is less than a longer one
str2 = str1 // " xyz" ! LEN(str2) is now seven
str1 = str2 // "lmno" ! halts with run-time error, str1
! can't hold eleven characters
... and so on ...
Quite a number of the most frequently asked questions about
strings would be settled if these had been the rules. It still
permits static allocation of character variables, which was
an F77 requirement. Again: water under the bridge. Other
languages still have time to learn from F77's mistakes though.
The same water passes under lots of bridges.
--
J. Giles
"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare
.
- References:
- '(*)' and List Directed I/O
- From: Ron Shepard
- Re: '(*)' and List Directed I/O
- From: Ken Plotkin
- Re: '(*)' and List Directed I/O
- From: Richard Maine
- Re: '(*)' and List Directed I/O
- From: Ken Plotkin
- Re: '(*)' and List Directed I/O
- From: Richard E Maine
- Re: '(*)' and List Directed I/O
- From: Jan Vorbrüggen
- Re: '(*)' and List Directed I/O
- From: John Harper
- Re: '(*)' and List Directed I/O
- From: Richard Maine
- Re: '(*)' and List Directed I/O
- From: James Giles
- re: Character strings and arrays
- From: robin
- Re: Character strings and arrays
- From: Dan Nagle
- Re: Character strings and arrays
- From: robin
- Re: Character strings and arrays
- From: Jugoslav Dujic
- Re: Character strings and arrays
- From: Ron Shepard
- Re: Character strings and arrays
- From: James Giles
- Re: Character strings and arrays
- From: Richard E Maine
- '(*)' and List Directed I/O
- Prev by Date: Re: Salford FT95
- Next by Date: Re: IMPLICIT NONE (F2k8+/-)
- Previous by thread: Re: Character strings and arrays
- Next by thread: Re: Character strings and arrays
- Index(es):
Relevant Pages
|