Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-21 Thread Ted Neward
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

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-20 Thread Richards,Tom
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

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-20 Thread Streno, Robert
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

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-20 Thread Stefan Holdermans
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

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-20 Thread Richard Blewett
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

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-20 Thread Jeroen Frijters
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

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-20 Thread Stephen Dunn
>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

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-20 Thread Frans Bouma
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

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-20 Thread Ted Neward
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

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-20 Thread Stefan Holdermans
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

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-19 Thread Streno, Robert
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'

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-19 Thread Stefan Holdermans
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

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-19 Thread Woodard, John
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

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-19 Thread Stefan Holdermans
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

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-19 Thread Streno, Robert
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

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-19 Thread Stephen Dunn
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

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-19 Thread Williams, Hugh
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&

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-19 Thread Stefan Holdermans
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

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-19 Thread Frans Bouma
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.

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-19 Thread Bert Roos
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

Re: [ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-19 Thread Jeroen Frijters
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

[ADVANCED-DOTNET] Partially constructed objects in C#

2003-06-19 Thread Stephen Dunn
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