Walter Bright wrote:
Nick Sabalausky wrote:
To put it simply, I agree with this even on mere principle. I'm
convinced that the current D behavior is a blatant violation of
strong-typing and smacks way too much of C's so-called "type system".
You're certainly not the first to feel this way about implicit
conversions. Niklaus Wirth did the same, and designed Pascal with no
implicit conversions. You had to do an explicit cast each time.
Man, what a royal pain in the ass that makes coding in Pascal.
Straightforward coding, like converting a string of digits to an
integer, becomes a mess of casts. Even worse, casts are a blunt
instrument that *destroys* type checking (that wasn't so much of a
problem with Pascal with its stone age abstract types, but it would be
killer for D).
That's funny that you're saying this. Casts are totally messed up in D.
Some casts do safe operations (casts between objects and interfaces),
some are absolutely ridiculous and only useful in low level situations
(casting array slices), some are safe whenever the compiler feels like
it (array casts of array literals versus array slices), and some
fundamentally break other language features, even accidentally (immutable).
casts are easily grepable, but you never know what a specific cast
actually does. Think about what this means for generic templated code.
In summary, I'd say casting rules in D are the worst spawn of hell.
I mean, that's ok, it doesn't exactly make D useless. And you can always
introduce your own safe (exe bloating, sigh) casting template functions.
But I still find it funny that you say this.
Implicit integral conversions are not without problems, but when I found
C I threw Pascal under the nearest bus and never wrote a line in it
again. The taste was so bad, I refused to even look at Modula II and its
failed successors.
For your information, programming in Delphi (modern Pascal dialect) was
quite a joy. It combined the advantages of the low level programming of
C (pointers, inline assembler), was safer than C, and included a sane
object model similar to Java/C#. Sounds familiar?
(Yeah, the template fetishists must have been very unhappy with it.)
I really don't understand why you're bashing Pascal at large. You must
have had only experience with early Pascal dialects... and then never
looked at anything that smelled like Pascal... and this as a language
designer??
D has 12 integral types. Disabling implicit integral conversions would
make it unbearable to use.
PS: while you guys are talking about new "absolutely necessary" language
features, people new to D are despairing to get a working D installation
and *trying* to use external libraries from dsource (that kind of
struggling really isn't nice to watch), and people "old" to D are
desparing over compiler regressions and random bugs that have global
effects on middle-sized to large codebases (circular dependency and
optlink bugs come to mind). The situation is slowly improving, but too
slow and problems *never* get completely eliminated.
/rant
Well, I'm out of here.