More exception classes into Phobos?

rikki cattermole via Digitalmars-d digitalmars-d at puremagic.com
Thu Mar 23 04:14:33 PDT 2017


On 24/03/2017 12:09 AM, Jonathan M Davis via Digitalmars-d wrote:
> On Thursday, March 23, 2017 23:26:38 rikki cattermole via Digitalmars-d
> wrote:
>> On 23/03/2017 11:20 PM, Георгий wrote:
>>> On Thursday, 23 March 2017 at 09:48:54 UTC, Jonathan M Davis wrote:
>>>> On Thursday, March 23, 2017 09:31:23 Георгий via Digitalmars-d wrote:
>>>>
>>>> If a function exists but has no implementation yet, it should use
>>>> assert(0).
>>>
>>> I didn't know that.
>>
>> That will throw an AssertError. You should try not to catch Error's.
>> So there still needs to be an exception of some kind.
>
> My point was that it's bad design to be throwing an exception because
> something isn't implemented. If something isn't implemented, it's a bug.
> assert(0) is a great way to indicate that something isn't implemented yet
> and have the program die (like it should) if that function inadvertently
> gets called.
>
> I know that there are cases in Java land where folks (even the standard
> library in some cases) have a class implement an interface but not truly
> implement all of it and have the functions that aren't properly implemented
> throw an exception. But I don't see how that can be anything but bad design,
> and I don't think that we should be promoting such behavior in D's standard
> library.
>
> - Jonathan M Davis

Nobody said that there had to be code in Phobos that used it, just a 
standard set of exceptions for a variety of purposes. That is what was 
proposed.



More information about the Digitalmars-d mailing list