newbie conceptual question [from haskell list]

Fergus Henderson
Fri, 27 Jul 2001 22:06:14 +1000

On 25-Jul-2001, D. Tweed <> wrote:
> Umm, I wouldn't agree with that exactly. If you ignore stupidities like
> specifying the mod operator % to be implementation defined, I would claim
> that C has/can be given semantics which are virtually as simple as
> Haskell.

But there are so *many* such "stupidities".

If you took out all of the things in C that had
implementation-defined, unspecified, or undefined behaviour,
then what you'd be left with wouldn't be C.

If you were talking about some other C-like language, such as
LP-C, Java, or C#, then I think your point might be valid.
But the differences between C and higher-level imperative (or OOP)
languages should not be ignored.

> Umm, again I'd say this is debatable: the volume of e-mail to/from Simon
> PJ about the haskell 98 report even though there are various Haskell 98
> interpreters/compilers out there suggests this isn't true.

I think almost all of the discussion about the Haskell Report relates to
either (1) library design or (2) questions that affect program legality,
not program behaviour.  It's very very rare for two Haskell implementations
to both accept the same program but for the program to behave differently
on the different implementations.

> Likewise, C and
> C++ have specifications which are met to a reasonable degree by many
> compilers out there, which prompts the question: when was the last time a
> bug in your code in an imperative language was due to an
> implmentation-defined part of the language?  In 5 years of intensive C++
> programming I'd guess I've made maybe 25 bugs due to this, but the number
> of bugs I've fixed in my code must be in the tens of thousands.

If you also include areas which are unspecified or undefined, as well
as those that are implementation-defined, I think it would cover a
very substantial proportion of those tens of thousands of bugs.

How many times have you written code that accidentally referenced
an uninitialized variable, for example?  Or that accessed memory
after it had already been deallocated?  Or that tried to access
past array bounds?  These are very common kinds of errors.

Fergus Henderson <>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <>  |     -- the last words of T. S. Garp.