Most of the AOP engines in Java don't use dynamic proxies anymore; they prefer to do direct bytecode manipulation, which really doesn't give a whit whether methods are virtual or not. (See Javassist and AspectJ for references.)
Frankly, the argument of performance is moot--in the JVM, virtual method dispatch can be optimized away in scenarios where the JVM realizes that there is only one subtype of a given class loaded (thereby eliminating the ambiguity around what the actual derived type is). The CLR could certainly offer the same kinds of optimizations if it desired. The argument of versioning is somewhat tenuous, IMHO, since we now walk into the aesthetic argument of whether we want people to version code without our knowledge--sometimes this is desirable, sometimes it isn't. I'm content to chalk Anders' decision up as "he had to make a choice, and he did", on the grounds that if I *really* don't like it, it's not rocket science to change it. Anybody feel like hacking on Rotor's C# compiler for a bit? :-) Ted Neward Java, .NET, XML Services Consulting, Teaching, Speaking, Writing http://www.tedneward.com > -----Original Message----- > From: Discussion of advanced .NET topics. [mailto:ADVANCED- > [EMAIL PROTECTED] On Behalf Of Frans Bouma > Sent: Sunday, February 25, 2007 5:20 AM > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM > Subject: Re: [ADVANCED-DOTNET] Virtual methods in .NET - was Implementing > an Interface - C# vs. VB.NET > > > On the IL level there are various call* instructions like call, callvirt > and > > calli. The former two are the ones which interest us most in this > > discussion. As you probably know, a virtual call has a level of > indirection > > through a so-called v-table structure ("method table"), which makes such > a > > call more expensive. If you need more information on this, drop a > follow-up > > mail or browse the internet or the CLI spec. > > > > As Tony pointed out, Anders Hejlsberg has pointed out the reasons for > the > > choice of non-virtual by default on > > http://www.artima.com/intv/nonvirtual.html. Performance and versioning > are > > the main reasons as pointed out by Anders. > > Still, it's sad this decision was made, because AOP is a tad more > difficult because subclassing at runtime to create dyn. proxies now relies > on > the developer to make things virtual, while in Java for example, > everything is > virtual by default, so it's more natural: the developer can just write > code > and it's weavable at runtime. > > dyn. proxy at runtime has many advantages, and because MS doesn't > realize that a dyn. proxy mechanism is really needed in the CLR, all kinds > of > tricks have to be used which aren't really transparent. This IMHO limits > .NET > when compared to Java. > > FB > > ------------------------------------------------------------------------ > Lead developer of LLBLGen Pro, the productive O/R mapper for .NET > LLBLGen Pro website: http://www.llblgen.com > My .NET blog: http://weblogs.asp.net/fbouma > Microsoft MVP (C#) > ------------------------------------------------------------------------ > > > > > > -Bart > > > > -----Original Message----- > > From: Discussion of advanced .NET topics. > > [mailto:[EMAIL PROTECTED] On Behalf Of Tony Nassar > > Sent: zondag 25 februari 2007 4:26 > > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM > > Subject: Re: [ADVANCED-DOTNET] Virtual methods in .NET - was > Implementing an > > Interface - C# vs. VB.NET > > > > Assuming your question isn't simply rhetorical, the reason is very > simple: > > the CLS didn't make it its business to force *every* language to be like > > Java in this respect. Anders Hjellberg has explained exactly why C# is > this > > way; check out the interviews with him at artima.com. > > > > > Anybody know why methods aren't virtual by default in .NET? > > > It seems like a really bad default to have all methods non-virtual. > > > > =================================== > > This list is hosted by DevelopMentor. http://www.develop.com > > > > View archives and manage your subscription(s) at > http://discuss.develop.com > > > > =================================== > > This list is hosted by DevelopMentor. http://www.develop.com > > > > View archives and manage your subscription(s) at > http://discuss.develop.com > > =================================== > This list is hosted by DevelopMentor. http://www.develop.com > > View archives and manage your subscription(s) at > http://discuss.develop.com > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.446 / Virus Database: 268.18.3/699 - Release Date: 2/23/2007 > 1:26 PM > -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.4/702 - Release Date: 2/25/2007 3:16 PM =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com