[Issue 1475] allow to use intrinsic math functions (e.g. trigonometry) in CTFEs

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 5 14:10:53 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1475





------- Comment #2 from wbaxter at gmail.com  2007-09-05 16:10 -------
Of course you can already do this by writing your own CTFE functions to
approximate those via Taylor series and the like.  One of the first CTFE demos
was a compile-time sqrt function.

But yeh, the compiler has access to a better way to evaluate those functions
than running what amounts to an interpreted language, so it would be nice to be
able to access it.  I can imagine some sort of plugin system where you'd write
some D-code, compile it to a dll, and expose new compile-time functions to the
compiler via that dll (much as you write extensions for other scripting
languages).  And of course those initial CTFE compiler extensions could be used
to compile further CTFE compiler extensions... and so on.


-- 



More information about the Digitalmars-d-bugs mailing list