Count your blessings!
bearophile
bearophileHUGS at lycos.com
Wed Jun 10 15:24:31 PDT 2009
Paul D. Anderson:
> 1. The list of changes is small and shrinking. Only five will make
> the cut.
It's a very small list. So I ask myself why they have chosen some of the few things thay have chosen.
One of those five precios things is the "Elvis" operator:
Exp1 ?: Exp2
That means:
If Exp1 is non-null, use that, otherwise evaluate and use Exp2
Adding it to D looks easy, but is such operator so important to be in the list of the only 5 things to add? I don't currently feel the need of it.
> 2. Many of the requested syntax changes already exist in D. (Of course.)<
Some people have asked for invokedynamic, that is already present in C#4 in a different form.
We'll not see that soon in D.
-------------------------
This is a nice thing they have added:
Annotations on types: enable pluggable type systems like null-checkers
"Preventing Bugs with Pluggable Type Checking", (TS-3798) Michael Ernst, Today, 4:40-5:40
But there's a better solution for this problem, that I hope to see into the D typesystem someday (and sooner the better, because it requires a significant change in how the D2 language is used and written).
-------------------------
Andrei Alexandrescu:
>what can we do about the feature on slide 33?<
You are talking about catching more than an exception in the same catch(), discussed here (it also has improved checking for rethrown exceptions):
http://mail.openjdk.java.net/pipermail/coin-dev/2009-February/000003.html
This is useful and handy, but I think it's not an essential feature, there are more important things to think&discuss about (like a type system where object references are non-null by default, and able to avoid most null exceptions in programs).
They propose:
try {
doWork(file);
} catch (final Except1 | Except2 ex) {
logger.log(ex);
throw ex;
}
They also say:
>To avoid the need to add support for general disjunctive types, but leaving open the possibility of a future extension along these lines, a catch parameter whose type has more than one disjunct is required to be declared * final*.<
(Very recently they have fixed the Python syntax to allow a tidier catch of multiple exceptions, but the syntax is not compatible to D, so I don't show it here).
But using a comma in some way is better than a bitwise or. A possible D syntax:
import std.stdio: writefln;
class Except1 : Exception {
this() { super(this.classinfo.name); }
}
class Except2 : Exception {
this() { super(this.classinfo.name); }
}
void main() {
try {
throw new Except2();
} catch (Except1, Except2 ex) {
writefln(ex.classinfo.name);
}
}
I don't like that syntax because the list of exceptions before "ex" isn't a gestalt separated enough from "ex".
A possible alternative:
} catch ([Except1, Except2] ex) {
Bye,
bearophile
More information about the Digitalmars-d
mailing list