static unittest

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 30 15:14:49 PDT 2014


On 4/30/2014 2:34 PM, Meta wrote:
> On Wednesday, 30 April 2014 at 21:04:19 UTC, Walter Bright wrote:
>> On 4/30/2014 1:38 PM, Meta wrote:
>>> Also, while we're thinking about static unittest, what about contracts? I've
>>> seen Bearophile suggest it quite a few times, and I agree that it'd be very
>>> useful to have contracts that are able to check a subset of function
>>> contracts/object invariants at compile time.
>>
>> Already have them - template constraints.
>
> Your function needs to be a template for that.

Adding () turns a function into a function template. Also, static asserts.

> Also, object invariants.

Easily handled with static asserts.



More information about the Digitalmars-d mailing list