Re: Character strings and arrays



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


.



Relevant Pages

  • Re: A note on computing thugs and coding bums
    ... It would handle international characters if the execution character ... method I used in "Build Your Own .Net Language and Compiler". ... work areas and counting on Nul is an illusion. ...
    (comp.programming)
  • Thunderbird bugs [was: lots of other topics]
    ... Question marks are very, very specific thing and has very, very specific cause - written down in my previous e-mail - or in my Outlook Express instruction (same issue in Thunderbird and OE): ... interest in non-ASCII character sets comes partly from the fact that I ... It's a problem because the web browser designers ... specify a language at the sending end and a preferred language at the ...
    (alt.usage.english)
  • Re: The linf project
    ... except in character literals. ... A language needs clarity, succinctness, ... you *could* say that no continuation is allowed. ... A simple language should have only one of these features. ...
    (comp.lang.fortran)
  • Re: what does "serialization" mean?
    ... Sorry eddie, but you're dead wrong there as usual. ... >>How about ASCII character 0xB0, ... > Totalitarians and Fascists are often self-appointed language police. ...
    (comp.programming)
  • Re: Integrating a new language in Tex
    ... What steps should I take to integrate a new language in Tex system?? ... Character set, output side. ... Together with allowable syllable and word length for hyphenation, ...
    (comp.text.tex)