package.d
Leandro Motta Barros
lmb at stackedboxes.org
Wed Dec 18 01:33:52 PST 2013
Here's another rather interesting case:
// mylib/util.d
module mylib.util;
class Foo { }
// mylib/package.d
module mylib;
public import mylib.util;
// main.d
import std.stdio;
import mylib;
void main()
{
auto f = new mylib.Foo;
writefln("%s", f.classinfo.name);
}
This prints 'mylib.util.Foo'. So far so good, that's the name I originally
expected.
Then I try to instantiate a 'Foo' using this very fully-qualified name the
compiler told me:
auto f = new mylib.util.Foo;
And DMD doesn't like it anymore:
main.d(6): Error: undefined identifier 'util'
main.d(6): Error: mylib.util.Foo is used as a type
Fishy, isn't it? Maybe I should report this as a bug?
Cheers,
LMB
On Wed, Dec 18, 2013 at 6:09 AM, Andrej Mitrovic <andrej.mitrovich at gmail.com
> wrote:
> On 12/17/13, Leandro Motta Barros <lmb at stackedboxes.org> wrote:
> > Is there any documentation describing the expected to behavior in regard
> to
> > the fully-qualified names of the publicly imported symbols in package.d?
>
> It might have been an oversight, but we'll have to wait for (I think
> Kenji) to reply since he implemented packages.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20131218/cba2d6e9/attachment.html>
More information about the Digitalmars-d-learn
mailing list