Jaa


Corrections, explanations, etc.

First, I should apologize for the lack of postings lately.  A combination of
server downtime/outages and apathy have kept me from making postings.  Now that
we're back up, I think I should clarify some of what I've said.

Value types aren't as grand as I make them out to be.  They're
designed by the CLR to be very lightweight, stack-based, blittable items.  Nothing
fancy.  You can't define a default constructor for them.  For Whidbey, we
were attempting to extend the functionality and usefulness of value
types, but the design team has determined that we shouldn't (for a variety of reasons). 
Really, in most cases, you're going to want a ref type.  The value type incurs
extra cost if you want to put it on the gc heap (something I may address later, called boxing). 
The value type is simply the CLR exposing for users the same type that it uses internally
for the fundamental types - ints, floats, etc.  Users should try to hold true
to this concept.  So, the instances where a value type are appropriate are actually
fewer than I originally stated.

My stack example isn't as nice as it ought to be.  I thought
it would well demonstrate what my concept of value types vs. ref types is, but, the
more I look at it, the more I believe I should have made the Node a ref type. 
(Largely in part to a redefinition of my thinking on value types, as explained above.) 
But, I'll leave it up as it is for now.

Someone made a request for explanations of the sources that I'm posting. 
In the future, I'll make an effort to explain what I'm up to in my code.  Another
example should be forthcoming.

Also, if you have any suggestions for what I should try to tackle, post comments or
suggestions, or shoot me an email at arich@microsoft.com.

Comments