On 2013-11-21 01:16, Simen Kjærås wrote:

The result of re-validating is performance loss. The result of missed
validation is a bug. Also, in just a few lines, you can make a version
that will *not* decay to the original type:

   struct Validated(alias fn, T) {
       private T _value;
       @property inout
       T value() {
           return _value;
       }
   }

   // validated() is identical to before.

Sure, using it is a bit more verbose than using the unadorned type,
which is why I chose to make the original version automatically decay.
This is a judgment where sensible people may disagree, even with
themselves on a case-by-case basis.

It's still accessible via "value".

--
/Jacob Carlborg

Reply via email to