mutable compile-time data proposal

Gor Gyolchanyan gor.f.gyolchanyan at gmail.com
Wed Dec 28 23:55:54 PST 2011


You missed the point. The case with dynamic libraries is just too
obvious: they're "dynamic" for a reason. The case of base classes not
knowing their derived classes is also kinda obvious because the
mutable aliases would allow for derived classes to add themselves to
the tuple by mixin in some compile-time stuff. You could do that if
aliases would be compile-time rebindable, but you can't do it
otherwise.

On Thu, Dec 29, 2011 at 11:31 AM, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> 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



-- 
Bye,
Gor Gyolchanyan.


More information about the Digitalmars-d mailing list