metaprogramming
Metaclasses in Python: a couple of questions to clarify
After crashing with metaclasses i delved into the topic of metaprogramming in Python and I have a couple of questions that are, imho, n开发者_如何学编程ot clearly anwered in available docs.[详细]
2023-03-17 11:49 分类:问答Why did Python 3 changes to exec break this code?
I looked through the myriad \'Python exec\' threads on SO, but couldn\'t find one that answered my issue. Terribly sorry if this has been asked before. Here\'s my problem:[详细]
2023-03-17 11:14 分类:问答Is there any way to get all the method's aliases in Ruby?
Suppose I\'ve got a class: class MyClass def my_method # cool stuff end alias :my_method2 :method end 开发者_Go百科And now I want to get all the aliases for method my_method without comparison with[详细]
2023-03-17 09:18 分类:问答Access local variables from a different binding in Ruby
In Ruby, you can easily access local variables programmatically by using local_variables and eval. I would really 开发者_如何学编程like to have meta-programming access to these variables using a singl[详细]
2023-03-17 07:02 分类:问答Dynamically define named classes in Ruby
I am writi开发者_如何转开发ng an internal DSL in Ruby.For this, I need to programmatically create named classes and nested classes.What is the best way to do so?I recon that there are two ways to do s[详细]
2023-03-17 04:28 分类:问答How to determine what compiler does with a metaprogram? (for boost.proto)
How do I determine what my compiler (g++) is doing with template code? I am using boost.proto (an expression-template library) to evaluate some maths expressions at compile time.The code evaluates th[详细]
2023-03-16 16:34 分类:问答Different template syntax for finding if argument is a class or not
While reading this question , I came across @Johannes\'s answer. template<typename> struct void_ { typedef void type; };[详细]
2023-03-16 10:22 分类:问答CoffeeScript dynamic methods
I\'m trying to create methods dynamically in coffee script, but as my code shows, the iterator I use to create the methods doesn\'t rese开发者_Go百科t its variables between iterations and so I en up w[详细]
2023-03-16 03:10 分类:问答Python instancemethods & decorators
I\'ve got the following pro开发者_Python百科blem: I need to write a decorator that would be able to detect a situation where it is used around a method and around a regular function.[详细]
2023-03-15 17:29 分类:问答Select every even (or odd) argument in template parameter pack
I would like to allow use of the class I\'m writing to specify as a template parameters a list of types along with a list of allocators of those types in a manner that types are at odd positions and a[详细]
2023-03-15 13:21 分类:问答