On Sun, 29 Apr 2012 08:21:10 -0700, Jacob Carlborg <[email protected]> wrote:

On 2012-04-29 05:03, Adam Wilson wrote:

Ok, I can accept that. Explicit typing is lots of extra pointless typing
when the compiler can just figure it out for me. But that leaves us with
an interesting design question. Right now, DI gen is destructive, which
means any changes I make to the DI file will get destroyed on the next
build if I forget to remove the -H flags. Unfortunately that means that
the DI generator is going to have to somewhat dictate coding style and
we need to make sure that DI gen covers the broadest possible range of
potential uses.

Personally, I have no problem leaving in initializers for module level
variables. Is that an acceptable solution to the community?

No, I think it's way better that the DI generator outputs the actually type instead of just "shared/auto" and the assignment.

In this case:

shared stdin = &_iob[0];

Should be generated as:

shared File stdin;

Anything to the right of the assignment operator is just an implementation detail.

I agree, however, DMD has not yet performed it's semantic analysis at the time of DI generation so I have no clue what the type is when the files are generated. Theoretically that could be changed but such a decision is WAY above my paygrade and would probably require significant rewrites of the DI generation code, as in tearing it down and starting over. My understanding is that the reason for this is that the semantic analysis does significant rewriting of the AST and would probably drastically alter the look and even function of the output code...

Also, there is this comment in the code to start the DI generation:
        /* Generate 'header' import files.
         * Since 'header' import files must be independent of command
         * line switches and what else is imported, they are generated
         * before any semantic analysis.
         */
My guess is that that has to do with the way the command-line switches impact the semantic analysis.

--
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/

Reply via email to