metaprogramming

Can you add a Class Method to the Core Module Class in Ruby?

Is it possible to add a core method to the Module class in Ruby? I want to do something like this (messed around with the idea yesterday, just whipped this together in a second): module MyModule base do has_many :something end end # implementation, doesn't work though... reason for the question Module.class_eval do def self....

has_member_of_type - template metaprogramming in C++

I suspect this is not possible under the current C++ standards but I'll ask anyway. What I'm trying to achieve is to get the compiler to figure out during compile time if a class contains any member variable of type Base (along with its derivations). e.g. struct Base { }; struct Derived : public Base { }; struct Foo { int x; ...

How do I inject new tags into a TagLib?

Lets assume that I have the following configuration in my conf/InjectionConfig.groovy file: x { a = { attrs, body -> out << "hello" } b = { attrs, body -> out << "goodbye" } } and that I have a simple taglib such as class XTagLib { static namespace = "x" } What I want to do is that when I type <x:a /> to any of my view...

User-defined literals (Extended literals) of C++0x... what compiler does support it?

In other thread I introduced some techniques we would use for Model-Driven-Development in C++ once the C++0x, in particular user-defined literals, is available. I just revised the plans for GCC 4.5 and even 4.6 and it shows that this particular feature is not supported. Anyway, do you know if I even have any compiler to test that featur...