Should masked exceptions be an error?

Ary Borenszweig ary at esperanto.org.ar
Tue Nov 24 03:46:41 PST 2009


Michal Minich wrote:
>> Andrei Alexandrescu wrote:
>>
>>> Consider:
>>>
>>> try {
>>> ...
>>> } catch (Exception) {
>>> ...
>>> } catch (StdioException) {
>>> ...
>>> }
>>> The second handler never matches because StdioException is a subclass
>>> of Exception, so the first handler will always match whatever the
>>> second matches.
>>>
>>> Should that be a compile-time error? I think so.
>>>
>>> Andrei
>>>
>> Yes, it works like that in Java.
> 
> 
> Yes, it works like that in C#.
> 
> 

Yes, it works like that in D.



More information about the Digitalmars-d mailing list