n Tue, 15 Sep 1998 [log in to unmask] wrote:
<SNIP>
The example
a==b==c==d --> ((a==b)==c)==d
would of course only work for logical values since (a==b) has logical result
and if c is not a logical type this is an error.
<SNIP>
> The question is why are Fortran's rules awkward? The other rules make some
> sense, in an error prone way, when other languages explicitly treat true and
> false as other names for numeric values, for example, 0 and 1, but generally I
> want the concepts of logical and numeric types clearly distinguished.
When thinking of C and C++ (or even Pascal), I agree that those languages
make a mess of things. But if the language treats logical values as an
unordered "enumerated" type with only two possible values (without any
knowledge about the internal representation as Fortran does) a relational
equality makes perfect sense since it keeps the rules more uniform
and reduces surprises.
But back to my original question: It seems the rules in Fortran are
rooted in its history and nobody seems to have bothered about the
break of symmetry they imply. And a different set is perfectly possible
(see Ada).
BTW, I saw on Brian Meek's page
(http://www.kcl.ac.uk/kis/support/cc/staff/brian/taxosn.html)
(see also http://www.kcl.ac.uk/kis/support/cc/staff/brian/boolean.html)
a report on a taxonomy of data types that were considered for a language
independent standard/classification. He mentions a state type since
unordered two-valued types such as logical or (on/off), (right/left), etc.
are quite common in practical programming problems. And yes those should be
implemented without knowledge about the internal (integer?) representation.
Thanks all for your comments.
Cheers,
WWS
-----------------------------------------------------------------------
| Werner W Schulz |
| Dept of Chemistry email: [log in to unmask] |
| University of Cambridge Phone: (+44) (0)1223 336 502 |
| Lensfield Road Secretary: 1223 336 338 |
| Cambridge CB2 1EW Fax: 1223 336 536 |
| United Kingdom WWW: |
-----------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|