www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4102] New: 'object' name in module declaration

http://d.puremagic.com/issues/show_bug.cgi?id=4102

           Summary: 'object' name in module declaration
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: repeatedly gmail.com



17:31:36 PDT ---
Now, I am writing serialization library for Phobos(repository is located
bitbucket http://bitbucket.org/repeatedly/msgpack4d ). I create msgpack.object
module but compilation error occurs. The module that contains 'object' can't
use some classes defined in default object module. Following code is example:

-----
module foo.object;

class FooException : Exception { this(string msg) { super(msg); } }
-----

% dmd main.d foo/object.d
foo/object.d(3): Error: identifier 'Exception' is not defined
foo/object.d(3): Error: Exception is used as a type
foo/object.d(3): Error: class foo.object.FooException base type must be class
or interface, not void
foo/object.d(3): Error: identifier 'Object' is not defined
foo/object.d(3): Error: Object is used as a type
Assertion failed: (b->type->ty == Tclass), function semantic, file class.c,
line 454.

foo.object hides default object module. Is this a bug or doesn't module
declaration contain 'object'?

To avoid this problem uses 'import object;' in foo.objcet.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 17 2010