D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 625 - [module] static import and renamed import of mixin don't work
Summary: [module] static import and renamed import of mixin don't work
Status: RESOLVED WONTFIX
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: All All
: P2 enhancement
Assignee: Walter Bright
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-01 19:37 UTC by Bill Baxter
Modified: 2014-02-15 13:19 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Bill Baxter 2006-12-01 19:37:54 UTC
[resubmission of issue http://d.puremagic.com/issues/show_bug.cgi?id=506 as an enhancement.]

static import and renamed import of a mixin don't work if the mixin itself has
imports.

This is a continuation of 
http://d.puremagic.com/issues/show_bug.cgi?id=498
which covers the basic import case.  The fix for that however does not fix the
static import and renamed import cases (import sigs=std.signals) cases.

Here's examples:

------
import sigs=std.signals;
class SigObj
{
    mixin sigs.Signal!();
}
void main()
{
}

----

static import std.signals;
class SigObj
{
    mixin std.signals.Signal!();
}
void main()
{
}
Comment 1 Martin Nowak 2012-02-14 04:54:11 UTC
cat > a.d << EOF
module a;
mixin template foo()
{
    import std.stream;
    Stream stream;
}
EOF

cat > b.d << EOF
module b;
static import impa=a;

class Klass
{
    mixin impa.foo!();
}
EOF

cat > c.d << EOF
module c;
static import a;

class Klass
{
    mixin a.foo!();
}
EOF

dmd -c b.d
dmd -c c.d

----------
Comment 2 Martin Nowak 2012-02-16 18:35:13 UTC
Got that bug report wrong the first time.

Mixin templates are evaluated at instantiation scope.
Libraries need to make sure that all their dependencies
are self-contained, i.e. by import needed modules within
the mixin or by combining templates and mixin templates.