Thread overview
? regression (class constructor/private)
Nov 09, 2004
Thomas Kühne
Nov 09, 2004
Buchan
Nov 09, 2004
Thomas Kühne
Nov 09, 2004
Walter
Nov 09, 2004
Thomas Kühne
Nov 11, 2004
Walter
Nov 11, 2004
Sean Kelly
Nov 11, 2004
Walter
Nov 11, 2004
Thomas Kühne
Nov 11, 2004
Sean Kelly
November 09, 2004
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
November 09, 2004
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/
November 09, 2004
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
November 09, 2004
"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.


November 09, 2004
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
November 11, 2004
"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.


November 11, 2004
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:

# class Derived : Base{
# private:
# // constructor will be wrongly generated here, so it is private.
# public:
}

then the code compiles fine as well.  The problem seems to have something to do with import.


Sean


November 11, 2004
No problem, I found and fixed it. Thanks, -Walter


November 11, 2004
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
November 11, 2004
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