Re: Variables in for loop (style issue)
Walter Bright wrote:
Andrei Alexandrescu (See Website For Email) wrote:
Walter Bright wrote:
Yes, I agree it's just like optional strong typing - I can imagine what
a pain that would be. It's probably why there aren't such languages.
Tsk tsk. A language designer should be on studying other languages like
brown on brown rice. Cecil has optional strong typing, and Perl 6 will
have. I happen to think it's a powerful feature, plus it's interesting
what design challenges are in devising such a language and how other
languages have addressed them.
"Cecil's type declarations are optional. Where type
declarations are present, static type checking ensures that the type
declarations are internally consistent. Where omitted, dynamic type
checking guarantees run-time type safety."
--http://www.cs.washington.edu/research/projects/cecil/www/cecil.html
That's not optional strong typing. It's optional *static* typing.
We'll see how Perl 6's future features work out. <g>
Sorry, we are having a terminology mismatch, and I believe yours is the
less accepted terminology. (I use the Cardelli/Wegner terminology, see
http://citeseer.ist.psu.edu/cardelli85understanding.html.) At least you
are misquoting the Cecil manual.
"Static type checking" does not amount, or lead to, "static typing".
Hence the misquote. In the most accepted terminology:
"Static typing" = the types of all expressions are exactly known by
static analysis. Pascal is that. C++ is not that because of dynamic
polymorphism, unions, and perhaps other constructs.
"Strong typing" = all expressions are type-consistent although the type
itself might not be known. For example, think of C++ dynamic
polymorphism at work: if you say p->Foo(), then you know the call is
type-correct (i.e., you can't call Foo() unless it's part of p's
interface), but because you can't know the exact type of p, you don't
know where the call will land. You know that it will land someplace
"safe" nevertheless.
Andrei
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]