DIP33: A standard exception hierarchy

Jonathan M Davis jmdavisProg at gmx.com
Wed Apr 3 14:44:19 PDT 2013


On Wednesday, April 03, 2013 22:00:17 Dicebot wrote:
> On Wednesday, 3 April 2013 at 19:21:53 UTC, Jonathan M Davis
> 
> wrote:
> > It's verbose. You're adding a fair bit of boilerplate just to
> > statically
> > determine whether verification has been done or not. It may
> > very well be worth
> > it in many cases, but it's enough extra code that I don't think
> > that I'd
> > advise it as a general solution.
> > 
> > - Jonathan M Davis
> 
> Erm, really? In most cases only wrapper type is needed. Almost
> all functions should accepts either verified or raw type version
> so no real boilerplate here (otherwise something is most likely
> wrong with your module responsibility organization). Wrapper
> types themselves are trivial and can be created automagically
> with some template/mixin. What else?

The main issue I have with the wrapper is the fact that you're then forced to 
overload your function if you want it to test the argument for validity if 
it's not wrapped and not test if it's wrapped. So, you're creating an extra 
overload with every function that's using the wrapper to determine whether it 
should test or not. And if you're not creating those overloads, then there was 
no point in creating the wrapper in the first place.

- Jonathan M Davis


More information about the Digitalmars-d mailing list