digitalmars.D.announce - Modules named "object" with DMD 0.153
- Chris Nicholson-Sauls (22/22) Apr 11 2006 It isn't perfect, but it appears there is now a way to have modules name...
- Hasan Aljudy (4/31) Apr 11 2006 but this module is foo.object, which is totally different from object.
- AgentOrange (2/33) Apr 12 2006 I think the original problem was you cannot declare a class with the nam...
- Chris Nicholson-Sauls (22/65) Apr 12 2006 You can, however, declare a class named foo.object.Object, or even just ...
- Chris Nicholson-Sauls (10/45) Apr 12 2006 It didn't use to matter. A project of mine, codename Lyra, had a module...
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: This compiles and runs fine for me, DMD 0.153 on Windows. -- Chris Nicholson-Sauls
Apr 11 2006
Chris Nicholson-Sauls wrote: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: This compiles and runs fine for me, DMD 0.153 on Windows. -- Chris Nicholson-Saulsbut this module is foo.object, which is totally different from object. There shouldn't be a problem with creating a module foo.object, it wouldn't conflict with object anyway. At least that's what I think.
Apr 11 2006
In article <e1i6gi$14oj$2 digitaldaemon.com>, Hasan Aljudy says...Chris Nicholson-Sauls wrote:I think the original problem was you cannot declare a class with the name ObjectIt 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: This compiles and runs fine for me, DMD 0.153 on Windows. -- Chris Nicholson-Saulsbut this module is foo.object, which is totally different from object. There shouldn't be a problem with creating a module foo.object, it wouldn't conflict with object anyway. At least that's what I think.
Apr 12 2006
AgentOrange wrote:In article <e1i6gi$14oj$2 digitaldaemon.com>, Hasan Aljudy says...You can, however, declare a class named foo.object.Object, or even just foo.Object. You just have to be very careful about the declerations of other classes in modules that import your module declaring an "Object" class. In other words, in any module importing "foo" (which declares "Object") you cannot declare "orphan" classes because they are actually silently declared as children of ".Object". Now, it is possible that one could now do this: -- Chris Nicholson-SaulsChris Nicholson-Sauls wrote:I think the original problem was you cannot declare a class with the name ObjectIt 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: This compiles and runs fine for me, DMD 0.153 on Windows. -- Chris Nicholson-Saulsbut this module is foo.object, which is totally different from object. There shouldn't be a problem with creating a module foo.object, it wouldn't conflict with object anyway. At least that's what I think.
Apr 12 2006
Hasan Aljudy wrote:Chris Nicholson-Sauls wrote:It didn't use to matter. A project of mine, codename Lyra, had a module named "lyra.db.object" which caused the problem to show itself. I ended up renaming it to "lyra.db.lobject" (note the "l" prefix) to get around it, and renamed the contained class to "LObject" as well. I would not expect having a local (ie, not under any package at all) "object" module to /EVER/ work, because the standard library "object" module is not under any package, therefore the two will /ALWAYS/ conflict in name, no matter what one might do. (I still say the solution is to move the standard "object" to "std.object" and be happy.) -- Chris Nicholson-SaulsIt 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: This compiles and runs fine for me, DMD 0.153 on Windows. -- Chris Nicholson-Saulsbut this module is foo.object, which is totally different from object. There shouldn't be a problem with creating a module foo.object, it wouldn't conflict with object anyway. At least that's what I think.
Apr 12 2006