I love the reference types. Why the great one never allowed reference
counting or smart pointers or whatever to be built into C++ is a
decision our team will regret for all time. But you can keep your
concept of boxing and string - StringBuilder - jeez!
Well, it's not my concept, but boxing is a necessary evil if you are to have
a singly rooted OO type system where you optimize the primitive types (value
types) by allocating them inline on the stack (when that's the declaration
context). StringBuilder is a necessary evil also when your string types are
immutable.
On another totally unrelated note ... I am using the .net mutex for
the
first time and I am forced to read and actually make a decision on the
following description of a parameter of the WaitOne method:
exitContext
true to exit the synchronization domain for the context before
the wait (if in a synchronized context), and reacquire it;
otherwise,
false.
This has to do with COM+'s activities, IIRC. Yeah, I agree this is an icky
parameter.
Are their no default values in this f-ing language?
Experience has shown that default values are a horrible design, as the implementation
embeds the default value into the client code. This is a huge problem when
my component changes it semantics (IOW, I want a new default value as the
parameter), because I version my component, but I am unable to rebuild your
client app. This worked fine in monolithic C++ apps of the days of old, but
no longer in today's world. As a side note, Clemens Syperski has a great
book called "Component Software - Beyond Object-Oriented Programming " which
does a great job of showing why OOP is quite dead for modern applications.
It has its place, of course, but for modern applications the promise of OOP
has fallen short. I'll leave it at that so we don't get into a religious
debate, as that's not my intent
This is programming for the masses?
Ummm, that's hard to say. That's what the x86 ASM die-hards said of C, and
then what the die-hard C programmers said of C++.
I had these finely crafted syncronization
classes in C++/Win32. To block on a mutex you simply needed one
statement to be place within a scoped block of code. the constructor
and destructor did it all. ah what the hell!!
Hmm, sounds like you designed an API for the masses, no?
This gets back to the notion of deterministic finalization and how we don't
necessarily have it in the CLR. This is a trade off. The CLR uses garbage
collection as the framework for memory management, rather than the C runtime
library (or C++). The CLR memory management architecture (with GC) is much
faster than how it is done in C++. And as icing on the cake, you no longer
have the problems of memory leaks and double deletes, among other subtle
memory related bugs. The tradeoff? Well, for non-memory resources you still
need to explicity manage the resource, such as closing a file handle, closing
a DB connection, releasing a mutex, etc. The best thing we have is the IDisposable
and using statement. I agree, it's not as clean feeling as the stack instance
wrapper class that we all used to build and use.
sounds good. I will conform.
Ah ha! Microsoft will pay handsomly for yet another convert. You hear that
Bill? ((heh, j/k))
Thanks for the post -- these are the fun issues to discuss. Good luck.
-Brock
DevelopMentor
http://staff.develop.com/ballen