www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Phobos for C++?

reply "Lionello Lunesu" <lio lunesu.removethis.com> writes:
Hi..

Wouldn't it be a nice idea to create an implementation of Phobos classes for 
C++?

This could be useful in the current transition phase: people can get used to 
Phobos, comment on Phobos, without being bothered with the new D language 
and its problems. Classes depending havily on D won't get ported, though I 
doubt these are many.

I actually started doing something like this. I'm constantly changing my own 
class library, adding interfaces and types, and lately I've been very 
inspired by D and Phobos, resulting in code at the end of this post.

Now I'm creating file/stream classes inspired from InputStream,Stream,etc..

In fact, there's no reason why Phobos should remain D only. It can be a 
.NET-like class library, but without .NET's overhead.

L.

////////////////////////////

#define _APPEND(a,b) __APPEND(a,b)
#define

// Use this macro to declare a scope with a CS helper which enters and 
leaves automatically.
#define synchronized(__csd) \
    if (citkTypes::DCriticalSectionHelper _APPEND(__cs,__LINE__) (__csd))

template<class T>
union MemoryBlockT
{
    struct {
        size_t size;
        T* ptr;
    };
    uint64 array; // D compatible 64-bit array variable
//......
};
Apr 05 2005
parent Derek Parnell <derek psych.ward> writes:
On Tue, 5 Apr 2005 11:37:55 +0300, Lionello Lunesu wrote:

 Hi..
 
 Wouldn't it be a nice idea to create an implementation of Phobos classes for 
 C++?
 
[ WRONG WAY! Turn back now! ] ;-) -- Derek Parnell Melbourne, Australia http://www.dsource.org/projects/build/ v1.19 released 04/Apr/2005 http://www.prowiki.org/wiki4d/wiki.cgi?FrontPage 5/04/2005 6:48:50 PM
Apr 05 2005