DIP33: A standard exception hierarchy

Jonathan M Davis jmdavisProg at gmx.com
Wed Apr 3 12:21:37 PDT 2013


On Wednesday, April 03, 2013 21:05:19 Dicebot wrote:
> On Wednesday, 3 April 2013 at 18:37:09 UTC, Jonathan M Davis
> 
> wrote:
> > ... you could do something like
> > 
> > Verify!T verifyFoo(T param)
> > {
> > 
> > //do checks...
> > return Verify!T(param);
> > 
> > }
> > 
> > void foo(T param)
> > {
> > 
> > foo(verifyFoo(param));
> > 
> > }
> > 
> > void foo(Verified!T param)
> > {
> > 
> > ...
> > 
> > }
> > 
> > That would be rather intrusive, but you _could_ do it if you
> > wanted to.
> 
> What problems do you see with this (or similar) approach? I find
> it very straightforward and no overhead is really necessary.
> Isn't it exactly what type system is for - enforcing static
> guarantees in between different parts of application?

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


More information about the Digitalmars-d mailing list