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

BCS BCS at pathlink.com
Wed Sep 5 14:24:20 PDT 2007


d-bugmail at puremagic.com wrote:
> 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.
> 
> 

As long as you aren't cross compiling, The compiler could take the 
version of the function it's going to put in the obj, plop it down in 
memory and run it. Why use DLLs?


More information about the Digitalmars-d-bugs mailing list