static this sucks, we should deprecate it

Steven Schveighoffer schveiguy at yahoo.com
Thu May 28 08:33:01 PDT 2009


On Thu, 28 May 2009 11:07:02 -0400, BCS <none at anon.com> wrote:

> Hello Steven,
>
>> Probably because Java doesn't use source code as imports.  It is one
>> flaw  of D that I really wish could be fixed.
>
> Here we go again! I don't (and won't, so don't try explaining it)  
> understand why people think file=module is a flaw, I LIKE the idea.

The flaw isn't that file=module.  the flaw is that  
uncompiled-file=import.  When you are importing source files, and then  
linking them to object files that could have been compiled from different  
sources, you run the risk of hard-to-find bugs, and weird crashes (and not  
being able to detect cycles!).  It is one of the things I didn't like  
about source/header separation in C/C++.  D gets one step closer by having  
the implementation and header in one file, but you still are importing the  
source file, which means you have to compile it during import just to  
understand what it means.

If we were importing compiled files (or even generated files), then the  
compiled file could have annotated the "static this" with the dependencies  
it has...

I don't want to start another long thread on this, I understand Walter's  
"I want to use standard linkers" position.  But this is the explanation I  
think for Java being able to succeed where D cannot.

-Steve



More information about the Digitalmars-d mailing list