www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Needing templates/compile-time functions for debugging

reply Ary Borenszweig <ary esperanto.org.ar> writes:
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
May 25 2009
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Ary Borenszweig 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

Have you considered Phobos2 itself? E.g. http://dsource.org/projects/phobos/browser/trunk/phobos/std/algorithm.d Andrei
May 25 2009
parent Ary Borenszweig <ary esperanto.org.ar> writes:
Andrei Alexandrescu escribió:
 Ary Borenszweig 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

Have you considered Phobos2 itself? E.g. http://dsource.org/projects/phobos/browser/trunk/phobos/std/algorithm.d Andrei

Thanks, but only D1. I forgot to mention.
May 26 2009
prev sibling next sibling parent BCS <ao pathlink.com> writes:
Reply to Ary,

 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

HECK yes!!!!! http://www.dsource.org/projects/scrapple/browser/trunk/units http://www.dsource.org/projects/scrapple/browser/trunk/dparser Be warned, the first one more or less pollaxes decent just by loading it. If it has errors please reply as I will fix them so you can use it as a test case (I /Really/ want stuff lake that to work).
May 25 2009
prev sibling next sibling parent Robert Clipsham <robert octarineparrot.com> writes:
Ary Borenszweig 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

I'd give tools and xf.* a shot, they seem to have their fair share of template/ctfe usage. http://team0xf.com:8080/ - xf.* - If you don't know where to start try hybrid ( http://hybrid.team0xf.com/wiki/Main/GettingStarted ) as that pulls in a fair amount of the xf stuff. http://dsource.org/projects/scrapple/browser/trunk/tools/ - tools, there seems to be a dsss.conf for it, that should give you all you need for compiling it.
May 25 2009
prev sibling next sibling parent "Denis Koroskin" <2korden gmail.com> writes:
On Mon, 25 May 2009 23:37:30 +0400, Ary Borenszweig <ary 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 :)
May 26 2009
prev sibling parent Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
Ary Borenszweig wrote:
 Hi!

ohai!
 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?

xpose2 is pretty mad: http://team0xf.com:1024/xf/file/cc374abe6ab4/xpose2/ -- Tomasz Stachowiak http://h3.team0xf.com/ h3/h3r3tic on #D freenode
May 26 2009