DIP33: A standard exception hierarchy
Jacob Carlborg
doob at me.com
Thu Apr 4 07:21:07 PDT 2013
On 2013-04-03 23:44, Jonathan M Davis wrote:
> 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.
Then you're doing it wrong. The point is that you should validate the
data in one place. Then pass the validated data around. You can also
turn it around. Instead of having Verified!(T) you could have Raw!(T).
Where ever you get the input data from should return Raw!(T). You have
one function accepting Raw!(T), validate. The rest of the functions
accepts T.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list