|
|
Orchid XP v8 escreveu:
>> By how many lines is $ defined by?
>
> One. (See my earlier reply.)
No. I suggest you go through the GHC code and discover by yourself.
> If it's not statically-typed, how do you know that all your types match
> up correctly?
Oh, *I* know. Question is: does the compiler/interpreter knows where I
want to go to? Is it assuming right my decisions?
In C++/Java I have to carefully feed such decisions to the dumb
compiler, in Haskell I have to be sure its correctly following and
inform it when it isn't -- by running into runtime type mismatches, when
the compiler incorrectly assumed something.
In Scheme/Python/Ruby, the interpreter just don't care and it's all up
to you.
> Oh yeah, that's right - you run it and hope you tested every possible
> code path. Until you release the code, and 3 years later discover that
> hidden away in some corner is a type mismatch.
Not different at all from any logic mismatch between what you want to
say and what you actually say. You may type your whole program
correctly and still have logical inconsistencies. Sure, type
inconsistencies are catched early, but they sound to me like trivial
errors. They were certainly non-trivial in C/C++ and their multitude of
pointer arithmetic, they are non-trivial in Java and its multitudes of
deep OO nestings and inter-module dependencies, and they are also
non-trivial in Haskell because of the way how its advanced and complex
type system allows for much of the behaviour of a program to be directly
embedded in the type declarations themselves.
They are trivial though in Scheme, where types are just basic data types
and simple groupings and most of the program behaviour is still
algorithmic in the traditional sense. Type mismatches are the very
minor of headaches here. So, I guess the importance of type systems is
relative.
Anyway, I don't know exactly how this discussion would fit an embedded
scripting language running in a host app. Would Haskell do any better
as an embedded scripting language? All its type safeties don't quite do
much in a non-compiled interactive environment: if you ever did
anything at a Hugs or GHCi console, you'll see you may constantly run
into runtime type errors just as in a dynamically typed language.
Post a reply to this message
|
|