|
|
>>> 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.
Why? It's not defined in GHC, it's defined in the libraries. :-P
[Checking the language standard document, it's actually defined as two
lines, because it gives a type signature as well.]
>> If it's not statically-typed, how do you know that all your types
>> match up correctly?
>
> Oh, *I* know.
Right. Sure. Because you're super-human. :-P
> 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 Haskell, you can't *have* runtime type mismatches. :-P
> In Scheme/Python/Ruby, the interpreter just don't care and it's all up
> to you.
Exactly. If you make a mistake, it's your fault, and the interpreter
gives you no help at all to fix it.
>> 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.
Does the type system catch every possible problem? No.
Will any automated system ever catch every possible problem? No.
Does that mean that automated systems for catching problems are a waste
of time? Again, no.
> 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.
For writing small, simple things on the fly, something vague and
unstructured is probably the best way to go. (This is why scripting
languages exist.)
Personally, I don't tend to write that kind of code.
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|