Boost logo

Boost Users :

Subject: [Boost-users] I'm creating an abstraction layer to work with C++, thought you might be interested
From: Alan Tennant (alan2here_at_[hidden])
Date: 2010-03-10 16:43:34


I'm creating an abstraction layer to work with C++, thought you might be
interested. Attached are the files required to use it. What it does should
be apparent by reading from the top of main () and running the code, you
might have to redirect the 4 #includes if you set up your directory
structure differently from me.

Note stuff.h only contains one function that is required. The program uses
an object called obj to achieve the things it does, it does not add this
functionality into the bottom level of C++.

The key concepts of an obj include:

Access members of objects using std::string's
Strings can be transferred and stored a lot more easily than types.
They can also be combined more easily, a trivial example is ".toString"
being made of two parts.
Finally they can easily be used as parameters so a function could take some
data and member names as parameters.

Individual obj members can be added and removed one at a time.

One member function can easily be used by several different types.

A function can look at aspects of the object it belongs to in order to work
out how to behave without any problems or inconsistencies created by the
underlying workings of C++.

There is no need for all the empty (or otherwise meaningless) member
functions that occur near the top of the tree in programs with lots of
inheritance, although inheritance possibilities work differently the same
sorts of results can be achieved just as easily with less code.

CSS like parameters with names and values where any number of them can be
used without having to specify the information in advance.

Uses boost::any's extensively but you don't have to wrap and unwrap them
yourself, less needing to repeat and know definite information about types
all the time.

Little difference between accessing different types of members such as
objects or functions.

Want obj's to behave in a fundamentally different way, write members
yourself for object without having to edit my files and add them to obj's
you create.

I'm sure some of this is possible in other ways and put into code as you
need it instead of being one big chunk but I think this abstraction layer is
useful. I could also use #defines to simplify and enhance the feel of
writing code for the user, for example adding some symbols to represent key
features instead of having to write a whole word between .'s.

It's not as great as it could be at the moment. I think it does everything
by copy making it slow and making it so you can't change members when you
access them, I wish for it to do everything by pointer to new memory is such
a way as it has the Java feal of doing everything the fast way without
having to think about it, it could even be smart enough to notice that bools
are not efficient this way. I'm not sure how I will fix these things
regarding things like how "template <typename T*>" works. Also when you do
have to use normal types it might be hard to implement template functions on
the obj functions you write.

later I will implement removing a member, setting up a type containing
various members, more easily creating objects with lots of miscellaneous
members (using only one line of code) etc...

p.s. I don't have lots of time at the moment to implement due to other
commitments, if you like this consider helping with some of it.







Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net