ent: Friday, June 20, 2003 1:35 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [ADVANCED-DOTNET] Partially constructed objects in C#
>
> Ted Neward wrote:
> [...]
> > Gosling, on the other hand, felt that C++'s approach to virtual
method
> > dispatch was inconsistent--th
Message-
From: Streno, Robert [mailto:[EMAIL PROTECTED]
Sent: Friday, June 20, 2003 5:57 AM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Partially constructed objects in C#
I love discussions of this nature! :)
I guess what it comes down to is that "you get what you pay for.&qu
PROTECTED]
Sent: Friday, June 20, 2003 5:45 AM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Partially constructed objects in C#
Richard,
>Actually the field initializer of log will run before the base
>class ctor [...]
Well, you're right about that offcourse. I was making the e
Moderated discussion of advanced .NET topics.'
>Subject: RE: [ADVANCED-DOTNET] Partially constructed objects in C#
>
>
>Actually the field initializer of log will run before the base
>class ctor - I guess precisely because of this situation (well
>this is true in C# but not i
m: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] On Behalf
>Of Streno, Robert
>Sent: Thursday, June 19, 2003 9:30 PM
>To: 'Moderated discussion of advanced .NET topics.'
>Subject: RE: [ADVANCED-DOTNET] Partially constructed objects in C#
>
>
>I'm not sure I
Ted Neward wrote:
[...]
> Gosling, on the other hand, felt that C++'s approach to virtual method
> dispatch was inconsistent--that at any given point in the object's
> lifetime, the dispatch resolution for a virtual method should
> always be
> the same, regardless of whether you're in a constructo
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] On Behalf Of Streno,
>Robert
>Sent: Thursday, June 19, 2003 9:30 PM
>To: 'Moderated discussion of advanced .NET topics.'
>Subject: RE: [ADVANCED-DOTNET] Partially constructed objects in C#
>
>
>I'm not
What I then wonder is, why is it allowed to call virtual / abstract
methods from a constructor (directly or indirectly) ? If you define a
constructor as the method to initialize the object so it can be used by
its instantiator, it's obvious that calling a hierarchy of methods from
the constructor i
s. [mailto:ADVANCED-
> [EMAIL PROTECTED] On Behalf Of Williams, Hugh
> Sent: Thursday, June 19, 2003 9:12 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [ADVANCED-DOTNET] Partially constructed objects in C#
>
> Interesting -- I tried it in Java too; it behaves the same as C#.
Perhap
ilto:[EMAIL PROTECTED] On Behalf
>Of Streno, Robert
>Sent: Thursday, June 19, 2003 9:30 PM
>To: 'Moderated discussion of advanced .NET topics.'
>Subject: RE: [ADVANCED-DOTNET] Partially constructed objects in C#
>
>
>I'm not sure I see the harm in pro
Thursday, June 19, 2003 3:11 PM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Partially constructed objects in C#
John,
>You missed his point.
Then, exactly, what is his point?
>So break the init into critical and non-critical, with the
>non-critical being virtal.
That won'
John,
>You missed his point.
Then, exactly, what is his point?
>So break the init into critical and non-critical, with the
>non-critical being virtal.
That won't do the trick though. Calling the virtual method from the
constructor is not reliable. That's why FxCorp issues a warning. The method
ementation thing or not.
John
-Original Message-
From: Stefan Holdermans [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 19, 2003 1:32 PM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Partially constructed objects in C#
Robert,
>I concur with a previous respondent who mentioned tha
Robert,
>I concur with a previous respondent who mentioned that it's
>simply a bad idea to call a potentially-overridden method from
>within your constructor, if that method does something
>critical to the object construction.
Simply stating that is not enough, I'm afraid. The point is that,
a
t: Re: [ADVANCED-DOTNET] Partially constructed objects in C#
it is indeed weird that C# would call from the base class the derived
method. That kind of behaviour you'd expect from calling abstract methods in
the base class.
FB
> Thanks to FxCop, I've just discovered quite a fundamental
&g
I agree with Stefan in that it's not an issue of right or wrong.
I suppose it boils down to the fundamental decision/opinion as to whether an
object is an object, despite not having all of its constituent parts.
If you were to follow a sheet of metal along a car production line, at what
point would
constructed objects in C#
Thanks to FxCop, I've just discovered quite a fundamental difference between
C++ and C#.
Check out the following code.
class Base
{
public Base( )
{
Method( ) ;
}
public virtual void Method( )
{
Console.Write("I&
Stephen,
Well, I don't think it's an issue of being correct here. The downside of the
way it is implemented in .NET is that you can call a method of a partially
constructed object---just as you have pointed out. The negative thing about
the C++ approach is that you wind up with different semantics
it is indeed weird that C# would call from the base class the derived
method. That kind of behaviour you'd expect from calling abstract
methods in the base class.
FB
> Thanks to FxCop, I've just discovered quite a fundamental
> difference between
> C++ and C#.
>
> Check out the following code.
e-
From: Stephen Dunn [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 19, 2003 3:59 PM
To: [EMAIL PROTECTED]
Subject: [ADVANCED-DOTNET] Partially constructed objects in C#
Thanks to FxCop, I've just discovered quite a fundamental difference between
C++ and C#.
Check out the foll
Both approaches have ups and downs. It's probably best not to call
virtual methods from the constructor.
The reason C# (and Java too) do it this way is probably because of
efficiency. Changing the vtable pointer (what C++ does) isn't possible
in C#/Java because that would confuse the garbage colle
Thanks to FxCop, I've just discovered quite a fundamental difference between
C++ and C#.
Check out the following code.
class Base
{
public Base( )
{
Method( ) ;
}
public virtual void Method( )
{
Console.Write("I'm the Base");
}
}
class Derived
: B
22 matches
Mail list logo