www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - ? regression (class constructor/private)

reply Thomas =?UTF-8?B?S8O8aG5l?= <thomas-dloop kuehne.cn> writes:
http:///svn.kuehne.cn/dstress/www/dstress.html#constructor_04

I am not sure if this is a bug or an newly introduced feature.
See also the gnu.D messages on "scope of auto generated ctor".

Thomas
Nov 09 2004
next sibling parent reply Buchan <kbuchan xtra.co.nz> writes:
On Tue, 09 Nov 2004 11:06:06 +0100, Thomas Kühne <thomas-dloop kuehne.cn>  
wrote:

 http:///svn.kuehne.cn/dstress/www/dstress.html#constructor_04

 I am not sure if this is a bug or an newly introduced feature.
 See also the gnu.D messages on "scope of auto generated ctor".

 Thomas
lose the 3rd / (http://svn.kuehne.cn/dstress/www/dstress.html#constructor_04) how can you get the addon? (preferably by browser... dont want to have to learn SVN yet) -- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 09 2004
parent Thomas =?UTF-8?B?S8O8aG5l?= <thomas-dloop kuehne.cn> writes:
Buchan schrieb am Dienstag, 9. November 2004 15:34:
 lose the 3rd /
 (http://svn.kuehne.cn/dstress/www/dstress.html#constructor_04)
yeah...
 how can you get the addon? (preferably by browser... dont
 want to have to learn SVN yet)
module dstress.addon.constructor_04_A; -> http://svn.kuehne.cn/dstress/addon/constructor_04_A.d You get the idea, don't you ;) You are working on a Window box? Get a nice Explorer extendsion: http://tortoisesvn.tigris.org/ Thomas
Nov 09 2004
prev sibling parent reply "Walter" <newshound digitalmars.com> writes:
"Thomas Kühne" <thomas-dloop kuehne.cn> wrote in message
news:cmq4jp$49v$1 digitaldaemon.com...
 http:///svn.kuehne.cn/dstress/www/dstress.html#constructor_04

 I am not sure if this is a bug or an newly introduced feature.
 See also the gnu.D messages on "scope of auto generated ctor".
What's the problem? The code on the web page is incomplete.
Nov 09 2004
parent reply Thomas =?UTF-8?B?S8O8aG5l?= <thomas-dloop kuehne.cn> writes:
Walter schrieb am Dienstag, 9. November 2004 20:26:

 
 "Thomas Kühne" <thomas-dloop kuehne.cn> wrote in message
 news:cmq4jp$49v$1 digitaldaemon.com...
 http:///svn.kuehne.cn/dstress/www/dstress.html#constructor_04

 I am not sure if this is a bug or an newly introduced feature.
 See also the gnu.D messages on "scope of auto generated ctor".
What's the problem? The code on the web page is incomplete.
It's one of the few multi file testcases: http://svn.kuehne.cn/dstress/run/constructor_04.d http://svn.kuehne.cn/dstress/addon/constructor_04_A.d See the note in the dstress.addon.constructor_04_A module. Thomas
Nov 09 2004
parent reply "Walter" <newshound digitalmars.com> writes:
"Thomas Kühne" <thomas-dloop kuehne.cn> wrote in message
news:cmr6cc$1o2d$1 digitaldaemon.com...
 Walter schrieb am Dienstag, 9. November 2004 20:26:

 "Thomas Kühne" <thomas-dloop kuehne.cn> wrote in message
 news:cmq4jp$49v$1 digitaldaemon.com...
 http:///svn.kuehne.cn/dstress/www/dstress.html#constructor_04

 I am not sure if this is a bug or an newly introduced feature.
 See also the gnu.D messages on "scope of auto generated ctor".
What's the problem? The code on the web page is incomplete.
It's one of the few multi file testcases: http://svn.kuehne.cn/dstress/run/constructor_04.d http://svn.kuehne.cn/dstress/addon/constructor_04_A.d See the note in the dstress.addon.constructor_04_A module.
I think the problem is that the constructor is private.
Nov 11 2004
parent reply Sean Kelly <sean f4.ca> writes:
In article <cn0cp5$if9$2 digitaldaemon.com>, Walter says...
I think the problem is that the constructor is private.
That's what's causing the error, but I think it's still a compiler bug. If you move the class definitions in constructor_04_A into constructor_04 then the code compiles just fine. Also, if you change the definition of Derived to this: } then the code compiles fine as well. The problem seems to have something to do with import. Sean
Nov 11 2004
next sibling parent "Walter" <newshound digitalmars.com> writes:
No problem, I found and fixed it. Thanks, -Walter
Nov 11 2004
prev sibling parent reply Thomas =?UTF-8?B?S8O8aG5l?= <thomas-dloop kuehne.cn> writes:
Sean Kelly schrieb am Donnerstag, 11. November 2004 20:55:
[snip]
I think the problem is that the constructor is private.
That's what's causing the error, but I think it's still a compiler bug. If you move the class definitions in constructor_04_A into constructor_04 then the code compiles just fine.
The import behavior is expected. Remember everything in one source file is "friendly" to eachother. In my view the problem is that a ctor is silently generated in the Derived class. If it needs to be created I'd expect the same access rights as for the super(Base class) constructor. The remaining problem is of course the module member ship and it's consequences. Sample: Base is in module A with a private ctor. Derived is in module B and has no explicit ctor. Is Derived's silent ctor accessible from module A? Is Derived's silent ctor accessible from module B? Thomas PS: Sean, I've added your sample. http://svn.kuehne.cn/dstress/run/constructor_06.d http://svn.kuehne.cn/dstress/addon/constructor_06_A.d
Nov 11 2004
parent Sean Kelly <sean f4.ca> writes:
In article <cn0i8e$rmj$1 digitaldaemon.com>, Thomas =?UTF-8?B?S8O8aG5l?= says...
Sean Kelly schrieb am Donnerstag, 11. November 2004 20:55:
[snip]
I think the problem is that the constructor is private.
That's what's causing the error, but I think it's still a compiler bug. If you move the class definitions in constructor_04_A into constructor_04 then the code compiles just fine.
The import behavior is expected. Remember everything in one source file is "friendly" to eachother.
Oops! I'd forgotten.
In my view the problem is that a ctor is silently generated in the Derived
class.
I don't have a problem with an auto-generated ctor, but it should be public by default. If the programmer wants his class to not be publically contructible then he should put a default contructor in private scope. But as Walter has already fixed this, I suppose we can test the new behavior in .107 :) Sean
Nov 11 2004