Class generation

Jan 5, 2010 at 5:37 AM
Edited Jan 5, 2010 at 5: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

http://wiki.github.com/richhickey/clojure-clr/to-do.

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

 

Coordinator
Jan 5, 2010 at 7:18 AM

Hi

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.

Thanks

leppie

Jan 5, 2010 at 2: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.