This project is read-only.

Class generation

Jan 5, 2010 at 6:37 AM
Edited Jan 5, 2010 at 6:37 AM

I just was wondering if there was support for creating c++ classes directly from scheme.

If not, then you might want to take a look at this. In the todo list, it says gen-class and gen-interface have been completed

Might be some nice reference code. Im assuming it does what the clojure gen-class does, i.e. create a new class.


Jan 5, 2010 at 8:18 AM


While this is quite easy to do procedurally (iow just calling Reflection.Emit), I am hoping to create a full-blown macro for it in the future.

If you just want simple .NET classes (and basic inheritance), you can use define-record-type from R6RS.

This will create a .NET class with fields as provided. You can then use this class's instances via reflection/databinding (probably will need a custom property descriptor).

Please let me know what additional functionality you require beyond the above-mentioned.



Jan 5, 2010 at 3:23 PM

I was actually just curious. I remember in some article you said you wanted to rewrite the entire thing in scheme but first you would have to figure out how to create classes in scheme. I assume the creation of classes means creating classes which are just as efficient as those you would write in pure c#. Just wondering what your thoughts were on this.