How do you use templates in D?

Marco Leise Marco.Leise at
Wed Oct 19 11:51:13 PDT 2011

Am 19.10.2011, 05:14 Uhr, schrieb Martin Nowak <dawg at>:

> On Tue, 18 Oct 2011 21:17:56 +0200, bearophile  
> <bearophileHUGS at> wrote:
>> Andrew Pennebaker:
>>> The D version will be called  
>>> dashcheck<>
>> QuickCheck is one of the good things of Haskell.
>> I have raised the topic few times:
>> I remember someone has already written one or two D versions of  
>> QuickCheck-like (probably D1), but it didn't get a lot of interest in  
>> the D newsgroups. One of them:
>> Bye,
>> bearophile
> I wrote a pretty complete port of Haskell's Quickcheck some month ago.
> The main function quickcheck takes the testee as first template parameter
> and a bunch of policies. It will use getArbitraryTuple to construct the  
> parameters
> of the testee. It should be able to construct a random instance of any  
> type out of the box,
> but you can also pass generators with the policies and they will be used  
> instead.
> There is also a Policy RandomizeMembers which will set aggregate members  
> to random values
> after construction.
> The testee might return a boolean result or an enum QCheckResult which  
> has a third entry
> QCheckResult.Reject.
> martin

There is a lot of nice code floating around. I wish there was a place  
where Andrew and others would have easily found your work under tags like  
"QuickCheck", "Haskel" and "unit test". Some website with a package  
manager that can also check if my checked out version of the code is still  
up-to-date or if there are updates and new features. It doesn't matter if  
the 'package' is marked as experimental.
Sometimes you just get an idea for a library and want to see if someone is  
already working on it. Or you just browse the available packages for D to  
get some inspiration on topics like unit testing, serialization or web  

More information about the Digitalmars-d mailing list