Checked vs unchecked exceptions

Crayo List via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 5 08:48:33 PDT 2017


On Tuesday, 4 July 2017 at 10:14:11 UTC, Ola Fosheim Grøstad 
wrote:
> On Monday, 3 July 2017 at 20:22:39 UTC, Crayo List wrote:
>> On Thursday, 29 June 2017 at 21:06:12 UTC, Ola Fosheim Grøstad 
>> wrote:
>>> On Thursday, 29 June 2017 at 19:34:22 UTC, Crayo List wrote:
>>>> Checked exceptions are a horrible idea because they leak 
>>>> internal implementation details as part of the signature of 
>>>> a method directly and in a transitive manner, which of 
>>>> course is one huge aberration!
>>>
>>> What do you mean? Exceptions that leave a module clearly 
>>> aren't internal implementation details…
>>
>> Correct!
>> But I said 'checked exceptions' are.
>
> How does "checked" affect whether something is internal or not?

int open(string file)
{
      if(!exists(file))
         throw new SomeException;

     ...
}

a few weeks later;

int open(string file)
{
     if(file == null)
        threw new NullSomethingException;

      same as before
}

What happens to the 3000 direct and indirect calls to open() ?

Notice how the 'interface' has not changed, only the 
implementation.







More information about the Digitalmars-d mailing list