| | 1 | == Abstract == |
| | 2 | |
| | 3 | The project that I propose is centered in adding to Boost a library that allows the programmer to include extensions/plugins. Additionally this will be the start point to implement reflection concepts. |
| | 4 | |
| | 5 | My proposal has two parts: |
| | 6 | |
| | 7 | 1. Bring Boost.Extensions [1] to completion and enhance it |
| | 8 | |
| | 9 | As I will say in the next sections, I wanted to add to Boost a library that allows an application to have dynamic plugins/extensions within an infrastructure. |
| | 10 | |
| | 11 | A member of the Boost mailing list told me about a library by Jeremy Pack called Extension. Jeremy and I agreed that the best approach would be to complete and enhance this library. In short, the |
| | 12 | completion consists in preparing the library to be sent for review in Boost. The enhancements are several, and will be described later. |
| | 13 | |
| | 14 | 2. Implement Reflection [2] using Extensions functionality |
| | 15 | |
| | 16 | The Extensions functionality is the perfect platform to implement Reflection in C++. I've analyzed several papers about this topic and having Extensions complete will be great to start building this new features. Also, the Boost Community showed a great interest saying that it would be a great addition to Boost. Discussing Reflection with Jeremy we agreed that it could be very useful to use the dynamic (run-time) method loading features in Extensions to give reflection functionality to normal C++ classes. I'll detail this point later. |
| | 17 | |
| | 18 | == Proposal history == |
| | 19 | |
| | 20 | Last year, I've been working in a GIS project. It needed a very open architecture, and our decision was |
| | 21 | to implement some kind of software plugin infrastructure. This project was being written in C++ and with a |
| | 22 | very intensive use of Boost. At that point, I checked out if Boost had a Plugin Library.... without results. |
| | 23 | |
| | 24 | So I designed and implemented an original infrastructure. It was useful and I've learnt a lot during |
| | 25 | the development. Also I've noted its pros/cons. |
| | 26 | |
| | 27 | Since that time, I have been thinking about adding an Extensions library to Boost, because I really like |
| | 28 | Boost philosophy, and I use it very frequently (nowadays I'm using it in at least three C++ projects, |
| | 29 | and advocating its use to my colleagues). |
| | 30 | |
| | 31 | Luckily, Summer of Code 2007 was about to start. Then I tried to get in touch with the boost community. Since |
| | 32 | early March I've been discussing my ideas in the lists with positive feedback. They showed a lot of interest |
| | 33 | and, as I said before, quickly pointed me out that there was some work done in that area. With more luck, |
| | 34 | Jeremy contacted me very quickly. |
| | 35 | |
| | 36 | We started to work together that week. I started to review his approach and he checked some of my |
| | 37 | old code. Obviously, his approach is simpler, more concrete and really clean. He told me that my code was |
| | 38 | very clear too, comparing it with another libraries. |
| | 39 | |
| | 40 | Then, we started to set the concrete goals for the project. The result of that work is this proposal. |
| | 41 | |
| | 42 | |
| | 43 | == Detailed objectives == |
| | 44 | |
| | 45 | Objectives could be split in two parts. My first goal is to bring to completion Boost.Extensions and then |
| | 46 | explore Reflection functionalities. |
| | 47 | |
| | 48 | Some of the improvements that are needed to complete Boost.Extensions (in order to submit it |
| | 49 | for revision) were addressed in our work with Jeremy. I think that some more will appear when |
| | 50 | we start the work. |
| | 51 | |
| | 52 | Then the actual tasks of this part are: |
| | 53 | |
| | 54 | 1. Preprocessor techniques to remove template redundancy. Nowadays some parts of the library |
| | 55 | are duplicated because the use of variable-arguments templates. The idea is to use |
| | 56 | the preprocessor library to avoid this. I've done it in another project, so I think that it'll |
| | 57 | be easy (but costly). |
| | 58 | |
| | 59 | 2. Provide (optionally) automatic closing of unneeded linked libraries. We think that |
| | 60 | this feature is important for many people to justify adding it in the standard library. |
| | 61 | Also, it can be added with 'convenience' functions quite smoothly - just as smoothly as |
| | 62 | directly adding the functionality. |
| | 63 | |
| | 64 | 3. Various integrations with other Boost libraries for convenience (like boost::function). |
| | 65 | |
| | 66 | 4. Finish up documentation. |
| | 67 | |
| | 68 | 5. Write lots of more unit tests, as well as larger tests. |
| | 69 | |
| | 70 | 6. Submit to Boost for review. |
| | 71 | |
| | 72 | Having that complete, I'll focus on the Reflection part. My main idea is allow the C++ programmer to |
| | 73 | access a meta-level infrastructure where he/she can load new classes/methods at run-time and get |
| | 74 | information about them. |
| | 75 | |
| | 76 | For that purpose I need to define an API that allows exporting methods and then the infrastructure |
| | 77 | to load them on demand. The difference with the Extensions approach is that in this part this methods |
| | 78 | won't be a virtual function declared in a base class. I mean, you should export the methods that could |
| | 79 | be used to access this meta-level and then Extensions will have the responsibility of loading the |
| | 80 | necessary dynamic shared objects. Additionally, this will allow creating objects that aren't derived |
| | 81 | of any class of the executable; instead they are loaded on demand from a linked library. |
| | 82 | |
| | 83 | A possible use of this API could be, for example, the development of a C++ 'interpreter'. |
| | 84 | |
| | 85 | Another interesting line of work could be having the ability to compile code at runtime and use it |
| | 86 | ( i.e. compile it into a linked library and link to it at runtime). If bjam was required to be in the path, |
| | 87 | and BOOST_BUILD_PATH was all set up, this just might work well. |
| | 88 | |
| | 89 | I know that this objectives are big but really interesting. I'll detail in the schedule and deliverables section |
| | 90 | what I want to achieve for sure, and what could be developed if the time allows me. |
| | 91 | |
| | 92 | |
| | 93 | == Schedule == |
| | 94 | |
| | 95 | * Weeks in the interim period between being accepted as student and program start |
| | 96 | |
| | 97 | Try to get more and more feedback from the community and try to detail the |
| | 98 | plan with Jeremy and my mentor. Maybe some prototype could be done |
| | 99 | if I have spare time. |
| | 100 | |
| | 101 | * Week 1 |
| | 102 | |
| | 103 | Do a careful study of Boost.Extensions. I've checked it out, but I need a deep |
| | 104 | understanding before starting. Get in touch with my mentor (as with Jeremy I'm |
| | 105 | in touch nowadays). See carefully the requirements to review the library. |
| | 106 | |
| | 107 | * Weeks 2 - 4 |
| | 108 | |
| | 109 | First tasks, 1. to 3., and task 5. Initial unit tests will be written. |
| | 110 | |
| | 111 | * Weeks 5 - 6 |
| | 112 | |
| | 113 | Finish the first part (tasks 4. to 6.), submitting the library to boost for revision. |
| | 114 | |
| | 115 | * Weeks 7 - 8 |
| | 116 | |
| | 117 | Explore reflection and do the first prototypes of the functionalities. Make |
| | 118 | some units tests along the development. |
| | 119 | |
| | 120 | * Weeks 9 - 10 |
| | 121 | |
| | 122 | Go on with reflection, trying to fit it as a working and useful library. |
| | 123 | |
| | 124 | * Weeks 11 - 12 |
| | 125 | |
| | 126 | Fix bugs. Document. Make more unit tests. According to the remaining time add some |
| | 127 | functionalities of the other optional tasks. Plan the future after-program work. |
| | 128 | |
| | 129 | == References == |
| | 130 | |
| | 131 | [1] Boost.Extension: [http://sourceforge.net/projects/boost-extension/] |
| | 132 | |
| | 133 | [2] Some reflection ideas: [http://www.vollmann.com/pubs/meta/meta/meta.html] |
| | 134 | |
| | 135 | [3] Boost mailing list |
| | 136 | * [http://article.gmane.org/gmane.comp.lib.boost.devel/155445] |
| | 137 | * [http://archives.free.net.ph/thread/20070314.225134.19510931.en.html] |