jll63 / yomm2

Fast, orthogonal, open multi-methods. Solve the Expression Problem in C++17.
Boost Software License 1.0
343 stars 18 forks source link

Dispatch table generation? #3

Closed naasking closed 5 years ago

naasking commented 5 years ago

I enjoyed your articles on the algorithms and data structures you used to generate yomm11's dispatch tables. I don't see any comparable description for yomm2, and the comparison to yomm11 suggests the internals are substantially different. If this is the case, do you expect to write an article or summary of yomm2's algorithms?

jll63 commented 5 years ago

Thanks.

I have been thinking about it. The problem is that I have the impression that Code Project's audience is thinning, and I don't know of a good place where to publish the revised articles. I wish DDJ, CUJ and the C++ Report were still around. Do you have an idea?

The algorithms and data structures for building the dispatch tables are exactly the same in yomm11 and yomm2. They are described in part 3 of the series and that article probably would not change. The novelty in yomm2 is that it uses advanced macro techniques to implement methods as ordinary functions (not function objects), and a perfect integer hash to find the method tables for the objects. That would be the subject of part 4 - which I never got around to write.

naasking commented 5 years ago

An article written on github and posted at reddit and HN would probably generate interest and discussion.

jll63 commented 5 years ago

Thanks for the suggestion. I did post on reddit to announce the lib (https://www.reddit.com/r/cpp/comments/7qm2qw/announce_yomm2_open_methods_in_a_library/) but indeed releasing a series and making noise with each installment would probably bring some interest.

jll63 commented 5 years ago

By the way I'll talk about yomm2 at CppCon. Do you plan to attend?

jll63 commented 5 years ago

In the meantime, the CppNow slides (https://jll63.github.io/yomm2/slides/) describe how it works quite accurately.

naasking commented 5 years ago

Cool, thanks. My interest is mostly in the dispatch technique you used for some personal projects since I don't use C++ very much. Your original article was a great explanation. Open multimethods for C++ would be a great feature with many benefits though, so you should definitely advertise!

jll63 commented 5 years ago

Indeed, the perfect integer hash trick can be used to implement all sorts of extension of RTTI, and, like the calculation of the dispatch table, it is mostly language independent. If you haven't noticed, yomm2 exists in D, actually it is a port of it.