Re: The linf project (2)
- From: analyst41@xxxxxxxxxxx
- Date: Mon, 9 Jun 2008 16:49:24 -0700 (PDT)
On Jun 9, 1:51 pm, "James Giles" <jamesgi...@xxxxxxxxxxxxxxxx> wrote:
analys...@xxxxxxxxxxx wrote:
On Jun 8, 6:55 pm, "James Giles" <jamesgi...@xxxxxxxxxxxxxxxx> wrote:...
I'd like to nail down the features of strings first:
(1) How should they be declared? Integers, Floats logicals and
character will be declared exactly as in fortran. I guess
String a,b,c
would be the most natural way to declare a b and c to be string
identifiers.
Oh that's right. In order to make the code harder to read
you don't want attributes to be expressed at the same time
as type. So you have to have a separate statement which
requires users to look all around for things instead of
looking in just one place. I'd prefer:
character, string :: a
integer, string :: b
etc.
OK let us tackle declarations next.
Does '*' belong at all - such as Real*8, Logical*1 etc.?
Should regularity be imposed or only to be preferred in declarations?
In other words
if someone wants to do
character a, logical*8 b
dimension a(100),b(200)
and someone else prefers
character a(100) logical*8 b(100)
does that sit well with you?
how about "initializing declarations" such as
integer a,b,c/2,3,5/ (a,b,c being scalars)?
Why did :: come into f90 declarations - was it required for backward
compatibility with f77 while being able to hadling things like
allocatables and structures?
'::' looks awakward to me.
We have several logicals, several integers, several floats and char as
the data-primitives.
We need to be able to declare
Scalars, arrays and strings of any one of these primitives either as
variables or parameters.
We also need to be able to declare arrays of strings.
Is there a schema to uniformly handle all possibilities ?
(2) are these C-type strings, with the null character marking the end?
It's your language. The null marker is slower to process
in general. There are very few things about C that I would
want to copy.
(3) We should be able to stretch and compress a string at will within
a procedure and I assume the null string would be a useful device
also.
Ok. The string should be the same length as whatever
you put into it. It's not clear that you need any other
mechanism for altering the size of the string.
(4) Substring references would be very powerful , and I suppose one
can't help bringing in ':' for that purpose.
Ok. Or some such notation. If you have whole-array
operatons you'll want to be able to make slices and
sections anyway. This notation for strings should
match the notation for arrays (as I say, a string is
mostly the same as a rank-1 array anyway). This
includes strides.
(5) How about arrays of strings - are we entering hairy territory
here?
I would not think so. But since you don't want derived types,
it may not be avoidable.
I was planning on springing it later - but how about exactly one more
structure besides arrays - TABLES ?
Should we have an explicit TRANSFER between strings and rank 1 char
arrays, or should we freely allow mixed assignment statements between
strings and char 1 arrays
I would prefer that strings (of length N) interoperate with
rank-1 arrays (of size N) with no special conversion or
transfer. While I usually like all conversions to be explicit,
a string is so simlar to a rank-1 array it's hard to get all
worked up about distinguishing them in any way except
assignment and comparisons (where they have real
semantic differences).
and does it matter if the array is
explicit shape
assumed shape
automatic
I shouldn't think so. Those three are all ways an array
might be declared. Once declared they should all act
the same. (By the way, I think dummy argument arrays
should *only* be assumed shape and never assumed size
or explicit shape. But, it's your language...)
--
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
.
- Follow-Ups:
- Re: The linf project (2)
- From: James Giles
- Re: The linf project (2)
- References:
- The linf project (2)
- From: analyst41
- Re: The linf project (2)
- From: James Giles
- Re: The linf project (2)
- From: analyst41
- Re: The linf project (2)
- From: James Giles
- Re: The linf project (2)
- From: analyst41
- Re: The linf project (2)
- From: James Giles
- The linf project (2)
- Prev by Date: Re: save statement in a module
- Next by Date: Re: extracting data from a binary database file
- Previous by thread: Re: The linf project (2)
- Next by thread: Re: The linf project (2)
- Index(es):
Relevant Pages
|