Re: The D Programming Language
Andrei Alexandrescu (See Website For Email) wrote:
James Kanze wrote:
Andrei Alexandrescu (See Website For Email) wrote:
James Kanze wrote:
AJ wrote:
One other serious legacy flaw in D (inherited from C/C++) is that it
doesn't do away with undefined behavior. It's close, I think, but it's
unfortunate that the holes aren't closed entirely.
No language manages to completely do away with undefined
behavior. Although C++ could surely do better in this regard;
there's a lot of unnecessary undefined behavior.
(Late in the thread, but this cannot be let slip away.) Whatever
happened to all languages that do manage to completely do away with
undefined behavior?
Name one. I'm unaware of any.
Java, Lisp, Scheme, ML, Haskell, Ocaml.
Java definitly has undefined behavior. The little I've seen of
Lisp and Scheme do as well, or at least, I've not seen how the
behavior is defined. I don't know the others at all, so I
cannot comment.
I'm asking this again: it would be best if we all refrained from "I'll
qualify it on-demand" statements.
Well, I suppose that if you exclude support for threading, it
might be possible.
Java has threads and no undefined behavior.
Java has undefined behavior.
I don't know Ocaml but I
recall there is a parallel version of it, which probably also doesn't
have undefined behavior.
But as far as I know, no language even comes
close. If nothing else, most older languages don't define the
case of insufficient ressources---some dialects of Lisp, for
example, say that in case of overflow in integral arithmetic,
they switch to an extended format, but they don't say what
happens when the extended format gets too big to fit in memory.
And most modern languages support threads, and I'm fairly
convinced that it is currently impossible to support threads
without undefined behavior---it would mean being able to
statically diagnose thread-safety.
That's simply wrong. Java does not check thread safety
statically, yet is able to define behavior of even incorrect
multithreaded code.
Writing to a double while another thread is reading it is
undefined behavior in Java.
--
James Kanze (Gabi Software) email: james.kanze@gmail.com
Conseils en informatique orient?e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S?mard, 78210 St.-Cyr-l'?cole, France, +33 (0)1 30 23 00 34
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]