Needing templates/compile-time functions for debugging

Denis Koroskin 2korden at gmail.com
Tue May 26 05:37:28 PDT 2009


On Mon, 25 May 2009 23:37:30 +0400, Ary Borenszweig <ary at esperanto.org.ar> wrote:

> Hi!
>
> I'm in need of heavy (long, complicated, interesting, whatever)  
> templates and/or compile-time functions to help me debug the  
> compile-time debugger I'm writing. Can you paste/attach some here, or  
> give me links?
>
> Thanks,
> Ary

Take a look at ctrace by h3: http://h3.team0xf.com/ctrace/

A quote from the webpage:

> Total rendering/compilation time: 26148 seconds (on my 1.7GHz laptop) 
>
> alias Tuple!(
> 		Sphere!(Vec3!(-4.f, 1.5f, -8.f),    3.2f,  Vec3!(1.f, .3f, .1f)),
> 		Sphere!(Vec3!(2.5f,  1.5f, -5.0f),  1.2f,  Vec3!(.2f, 1.f, .4f)),
> 		Sphere!(Vec3!( .7f, -1.5f, -4.2f),  1.5f,  Vec3!(.2f, .4f, 1.f)),
> 		Plane! (Vec3!( 0.f,  1.f,   0.f),   4.f,   Vec3!(.5f, .5f, .5f))
> ) scene;
>
> alias Tuple!(
> 		PointLight!(Vec3!(8.f, 8.f, 10.f), scale!(Vec3!(0.7f, 0.7f, 0.6f), 30.f)),
> 		PointLight!(Vec3!(-2.f,  2.5f, 0.f), scale!(Vec3!(.6f, .4f, .1f), 8.f))
> ) lights;
>
>
>
> Note: ctrace was developed when D didn't have Compile Time Function Evaluation
> and uses only the functional sub-language of template metaprogramming. Using CTFE,
> ctrace could be made hundreds of times faster and look like normal runtime code.
> But then it wouldn't be fun anymore.
>

Enjoy :)



More information about the Digitalmars-d mailing list