mutable compile-time data proposal

Jonathan M Davis jmdavisProg at gmx.com
Wed Dec 28 23:31:44 PST 2011


On Thursday, December 29, 2011 10:23:11 Gor Gyolchanyan wrote:
> The mutability of compile-time data would essentially enable fully
> imperative compile-time computation. Right now it's almost purely
> functional with the small exception of CTFE functions. Sometimes
> functional style can't do the trick. For instance, you can't make a
> template which "returns" a TypeTuple of derived classes of the given
> class.

You can't do that because the compiler doesn't have that information, not 
because of the functional nature of much of the compile time stuff. Classes 
don't know about their derived classes, and with the C linking model (which D 
uses), you can't possibly know what they all are until link time - and with 
dynamically loaded libraries, you won't even know then, because more can be 
loaded and linked in at runtime.

You should be able to do pretty much anything in a functional style that you 
can do with an imperative style. You just have to go about it differently.

- Jonathan M Davis


More information about the Digitalmars-d mailing list