Sub-classing exceptions
Jonathan M Davis via Digitalmars-d
digitalmars-d at puremagic.com
Thu Oct 15 19:08:52 PDT 2015
On Friday, 16 October 2015 at 01:52:12 UTC, Shriramana Sharma
wrote:
> Jonathan M Davis wrote:
>
>> On Thursday, 15 October 2015 at 18:07:24 UTC, Shriramana
>> Sharma wrote:
>>> So, any thoughts? Any way this could be improved? Would be
>>> nice if that mixin got into the standard library somehow...
>>
>> Writing a mixin to create a standard constructor for exception
>> types is trivial. The problem is that you can't document code
>> that's mixed in. So, the constructors wouldn't end up in the
>> documentation. And while it's a bit annoying, copy-pasting the
>> two standard constructors for exceptions is pretty trivial.
>
> Can't we just include the /++ +/ block within the Wysiwyg
> string in the mixin? Does DDoc not process mixins?
ddoc doesn't process mixins. If it did, then mixing in the
constructors would work just fine. But because it doesn't, mixing
in the constructors only works if you don't care about them being
documented, which isn't exactly good practice.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list