dmd 1.074 and 2.059 release
Jonathan M Davis
jmdavisProg at gmx.com
Fri Apr 13 17:24:50 PDT 2012
On Saturday, April 14, 2012 02:13:45 Andrej Mitrovic wrote:
> On 4/14/12, Alex Rønne Petersen <xtzgzorex at gmail.com> wrote:
> > That sounds like an error in TDPL. AFAIK nothrow means "may only throw
> > Error".
>
> But Error is a subclass of Throwable.
A nothrow function cannot throw anything derived from Exception. It _can_
throw types derived from Error. Normally, no one should be using exception
types which aren't derived from Exception or Error. So, this should be a
complete non-issue.
It looks like TDPL lists Throwable as throwable in nothrow functions (so,
basically any Throwable which is _not_ derived from Exception), whereas the
compiler specifically makes Error throwable but disallows throwing Throwable.
Honestly, it probably doesn't really matter which it is. Certainly, it won't
matter in good code, since I'm pretty sure there's no valid reason for
throwing anything which is not derived from Exception or Error.
But clearly TDPL and the compiler need to be brought in line with one another
(either by changing TDPL or changing the compiler). I'd be inclined to go with
TDPL on this one, but I don't see how it matters all that much, since it
shouldn't impact any real world code either way.
- Jonathan M Davis
More information about the Digitalmars-d-announce
mailing list