How about a 100% CTFE?

deadalnix deadalnix at gmail.com
Tue Nov 8 05:44:22 PST 2011


Le 08/11/2011 14:31, Gor Gyolchanyan a écrit :
>> Well except that module can modify a and not be in the tree.
>
> A single compilation includes only two parts: compiling D source code
> and linking in object files or static libraries. object files and
> static libraries are by no means involved in compile-time activity,
> which leaves us with with compiling D source code. A single
> compilation of D source code can be viewed as a list of import trees,
> originating from the enlisted modules to be compiled. After
> eliminating duplicates we have a list of small trees, which can be
> rooted together to form a single tree, which in turn can be processed
> as described above. Optionally, in order to allow separate
> compilations, a cache can be maintained to hold the results of
> previous compile-time computations to be used in the next ones inside
> a "project" (to be defined).
>

module a;

int a = 0;

-------------------

module b;

import a;

int somefunction() {
	return ++a;
}

static assert(somefunction() = 1);

-------------------

module c;

import a;

int somefunction() {
	return ++a;
}

static assert(somefunction() = 1);

Which assert will fail ? Does one will fail ? Note that two different 
instances of the compiler will compile b and c, and they are exscluded 
of one another import tree so each instance isn't aware of the other.

>> If you have hard time to figure out what the problems are, it is unlikely that you come up with a satisfying solution, except by being lucky.
>
> When i say, i don't see problems, that means, that you didn't present
> me a problem, which i could not resolve. You point to a problem, i
> resolve it and vice verse until one of us fails. This is called a
> discussion.
>

Well that my whole point. You are not aware of the problem on the topic 
you try to solve. You are not qualified for the job. I have no 
responsability on educating you.

YOU are comming with a solution, YOU have to explain how it solves every 
problems. Everything else is flawed logic.


More information about the Digitalmars-d mailing list