BCL for native C++ - possible?

A

Andreas Schmitt

Crazy idea but...

I think everyone could agree with the statement that the CLI standard
Base Class Library is incredibly useful, not to mention the extentions
by microsoft and managed directX and several other stuff that builds on
top of the BCL.

Now.. do you think it would be possible to port the BCL to C++?

Meaning starting with an object class all other classes have to inherit
from, building structs (value classes) around the native types, giving
them the same nice methods as in .net.
Disallowing ref types to be created on the stack (one might think of
declaring the destructor protected and make every smart pointer a
friend, handling smart pointers like the handles in C++/CLI)

Of course some stuff should be conventions then, like always inherit
from Object, and always use smart pointers / handles to instantiate ref
types and so on...

Then on that basis implement the entire BCL for C++ as a class library.

It is very much bigger than the STL but the STL is perfect as a basis
for the implementation... and the Class library could be a basis to
build on top of.
I think much of the productivity of .NET is caused by the enormeous help
the BCL is offering and secondly by the garbage collector.

I think one could reach a similar level on native C++ if having the same
classes available together with the upcoming GC for C++0x.
Memory leaks should not pose a problem anymore if all classes force you
to not instatiate them with a simple pointer but always either using a
smart pointer or with C++0x the native garbage collector.


As I said, crazy idea, especially considering how huge the BCL is, even
without all the useful extentions for it around...

but just as a question.. would this make sense, do you think this would
be something native C++ programmers could benefit from?
Do you think it is possible to implement something like the BCL in
native C++ and kinda "emulate" the .NET BCL behavior close enough?

Looking forward to hearing a few opinions.
 
B

Bruno van Dooren

Now.. do you think it would be possible to port the BCL to C++?
As I said, crazy idea, especially considering how huge the BCL is, even
without all the useful extentions for it around...

but just as a question.. would this make sense, do you think this would be
something native C++ programmers could benefit from?
Do you think it is possible to implement something like the BCL in native
C++ and kinda "emulate" the .NET BCL behavior close enough?

Looking forward to hearing a few opinions.

No.
The world (at least the part that I occupy :) ) is not waiting for Yet
Another Toolkit.
You could never copy the behavior for 100%, which would lead to all kinds of
confusion.
On top of that, what would it add?

Yes the BCL is useful, but only in the context of the whole .NET framework.
Replicating the BCL implies replicating the whole context it is used in.
That brings me back to the question 'Why on earth would you invest millions
of dollars to create something that already exists today' and believe me,
before you'd have something like that programmed and validated through QA,
you are at least 5 years down the line, have invested millions of dollars,
with a functionality of the BCL that is 2 major versions out of touch with
the then current release.

And then you'd have to find paying customers to turn this money drain into a
money fountain.
Which would boil down to convincing customers that they would benefit from
your expensive proprietary version 1.0 implementation than from using a
framework that is stable, and used by (and compatible with) the whole world
and his dog.

For native C++, I'd stick with STL (because it is part of C++) and possibly
the TR1 libraries (for example those of dinkumware) because they will be
part of the next C++ standard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top