Fixing cyclic import static construction problems
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Fri Nov 30 07:18:06 PST 2012
On 11/30/12 9:09 AM, foobar wrote:
> On Thursday, 29 November 2012 at 23:02:17 UTC, Walter Bright wrote:
>> On 11/30/2012 9:43 AM, Walter Bright wrote:
>>> It is possible for each static constructor to specify independently of
>>> the other static constructors which imports must be constructed first.
>>> But do we really want to go that far?
>>
>> One way to do that might be to borrow syntax from classes:
>>
>> static this() : std.stdio, a, c
[snip]
> Why not simplify?
[snip]
Why not further simplify?
static this()
{
// JUST AS BEFORE
...
}
There is no need to redundantly specify what modules are used because...
well they are right there in the body of the static constructor.
* no extra syntax
* no change in the symbol visibility rules (why are symbols invisible by
default in static cdtors?)
* no change to the manual
* no breakage of existing code (only code that was broken will be accepted)
* no acceptance of actual circular dependencies go through compilation
This would be purely an improvement to the implementation that would
allow more correct programs to compile. It's a removal of limitation -
the best kind of language change there ever is.
We should have a "bootcamp" area with small compiler and library
projects (such as this after we reach consensus). People who are
interested in helping D, whether or not they've done it before, could
find this area things that are well defined and will definitely be
accepted if properly executed.
Andrei
More information about the Digitalmars-d
mailing list