Modules named "object" with DMD 0.153

Chris Nicholson-Sauls ibisbasenji at gmail.com
Tue Apr 11 14:15:21 PDT 2006


It isn't perfect, but it appears there is now a way to have modules named 'object' or at 
least according to a cheap little test I just ran.  The trick is to explicitly import 
'object' in your own 'object'.  Let me show you what I mean:

# module test;
#
# private import std.stdio ;
#
# private import foo.object ;
#
# void main () {
#   FooObject foo = new FooObject ;
#   writefln("%s", foo.toString);
# }

# module foo.object;
#
# import object;
#
# class FooObject : Object {
#   public char[] toString () { return "<<FooObject>>"c; }
# }

This compiles and runs fine for me, DMD 0.153 on Windows.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d-announce mailing list