John Lam 1997 — 2026

New Reflection Layer ported to C++/CLI

I initially wrote the new Reflection layer for RubyCLR in C#. But for a variety of reasons, all of the code for RubyCLR must live in a single assembly, so I decided to port the C# code to C++/CLI this morning.

It took me 98 minutes to port 583 lines of C# code to 667 lines of C++/CLI, for an overall rate of 6.8 lines / minute.

When doing a port like this, you get to see just how close C++/CLI feels is to C# (or at least as close as you can get while preserving existing language semantics). It was mostly mechanical, with a few moments of thinking mixed into the fray. That said, I wouldn’t want to do this as my day job … :)

3 archived reader comments

evan (2006/08/17)

Couldn’t you have just created c# assembly as a module and add it to the c++ assembly?

John Lam (2006/08/18)

Yes I could have, but I felt that it wasn’t a bad tradeoff of 98 minutes in return for all of the managed implementation code being in C++/CLI. That and my edit / debug / compile experience takes a hike unless I hacked the MS Build script (VS doesn’t really support this scenario).

Justin (2006/08/18)

John, Will you please bit the bullet and release a gem? Or at least put a new daily build up. I can’t get to the latest RubyCLR because I don’t have SVN installed at work (and I suspect it won’t work anyways because of our proxy). I really want to play with the new features but I’m locked out! Justin