This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Implementing multi-methods for C++ in GCC


A few years ago I implemented multi-methods as a C++ library and it has served us pretty well. The implementation proves that multi-methods can be implemented for C++ in a way that is flexible and useful, e.g. allows the method "family" to be changed by dynamically loading and unloading libraries, calls are dispatched in reasonable time, and there's no need to take lots of memory.

However the implementation also proves that it's very ugly to do without compiler support. So I would now like to pursue a proposal for the standards committee. I think I could make my case a bit stronger if there also was an (experimental) implementation in some compiler.

I'd like to try my hand at this with GCC, with anyone else who would have interest in this area -- any help would be tremendously welcome. If I do manage to find the time to do this, I'd like to know what's the best way to get there. I imagine I would first start working on a patch privately, but longer term I'd like to know if there was interest and possibility of integrating such as feature in the compiler proper -- assuming of course that the patch itself was clean, well-designed, documented and otherwise well received?

I would probably keep majority of the implementation in the run-time library, and only add to the compiler proper the required sugar to recognise and register multi-methods members with the run-time. I believe the required RTTI info already exists -- there is no public access to it, but that doesn't mater to the run-time.

I'll work in parallel on a proposal to the standards committee.

If there's interest I can describe the implementation and how it's been used in more detail.

Do not meddle in the affairs of dragons,
for you are crunchy and good with ketchup.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]