Top "Metaprogramming" questions

Metaprogramming is the capability to reprogram ones programming environment, as with macros or metaclasses.

Ruby: Inherit code that works with class variables

The situation: I have multiple classes that should each hold a variable with a configuration hash; a different hash for …

ruby class inheritance metaprogramming
Remove/undef a class method

You can dynamically define a class method for a class like so: class Foo end bar = %q{def bar() "bar!" …

ruby metaprogramming
Executing code for every method call in a Ruby module

I'm writing a module in Ruby 1.9.2 that defines several methods. When any of these methods is called, I want each …

ruby methods module metaprogramming
Why compile error with enable_if

Why this does not compile with gcc48 and clang32? #include <type_traits> template <int N> struct …

c++ templates metaprogramming sfinae enable-if
Python on Rails?

Would it be possible to translate the Ruby on Rails code base to Python? I think many people like Python …

python ruby-on-rails metaprogramming code-translation
Accessing function as attribute in a Python class

I'm in a situation where it would be extremely useful (though not strictly necessary) to access a class' instancemethod as …

python django metaprogramming
Dynamically set local variables in Ruby

I'm interested in dynamically setting local variables in Ruby. Not creating methods, constants, or instance variables. So something like: args[:…

ruby metaprogramming local-variables
Undefine variable in Ruby

Let's say I'm using irb, and type a = 5. How do I remove the definition of a so that typing a …

ruby metaprogramming local-variables
Getting template metaprogramming compile-time constants at runtime

Background Consider the following: template <unsigned N> struct Fibonacci { enum { value = Fibonacci<N-1>::value + Fibonacci<…

c++ templates runtime metaprogramming
Change the context/binding inside a block in ruby

I have a DSL in Ruby that works like so: desc 'list all todos' command :list do |c| c.desc …

ruby metaprogramming block