I am going to write a groovy script to generate a buttload of constants in a javascript file. ;)
Maybe cross-language metaprogramming? meta-language meta-programming?
To be clear, I am asking what category this falls under
...
I'm just wondering if anyone has already created a tool that will take a given JSON string and write the code for an identical struct in C along with the parser code specific to that struct.
I'm about to do this myself using JSON-C, but I thought I'd ask first.
...
I want the following module to be included in a class I have:
module InheritanceEnumerator
def self.included(klass)
klass.instance_eval do
instance_variable_set('@subclasses',[])
def self.subclasses
@subclasses
end
original_method = self.respond_to?(:inherited) ? self.pub...
I want to be able to define a block, and later evaluate that block from within a dynamically generated module/class. It seems like I could accomplish this somehow using eval and block.binding, but I haven't figured it out.
I have this as the base:
def define_module(name, &block)
name = name.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.g...
Perl's quotemeta operator typically works on the SEARCH side of s///, but in generating code to be compiled with eval, how should I protect the REPLACEMENT that should be used literally but may contain bits such as $1?
With code of the form
my $replace = quotemeta $literal_replacement;
my $code = eval <<EOCode;
sub { s/.../$replace/...
A simple example:
template<typename _X> // this template parameter should be usable outside!
struct Small {
typedef _X X; // this is tedious!
X foo;
};
template<typename SomeSmall>
struct Big {
typedef typename SomeSmall::X X; // want to use X here!
SomeSmall bar;
X toe;
};
Is there a way to access the template paramet...
Is there any way to reference the collection of parameters passed to a stored proc, without referencing each one by name?
The context here is error logging. I'd like to develop a generic CATCH clause, or sub-clause, that grabs all parameter values as well as other error and execution info and logs it to a table (one or more).
The basic...
Possible Duplicate:
What's the use of metaprogramming?
I see a lot of guys here talking about Template Metaprogramming here at SO. But I still don't get how is it useful? Where can it be used and why?
Please don't close this question as a dupe to this because the latter does not answer my question.
...
I looked at boost's mpl::string, but there doesn't seem to be an easy way of converting string literals to the single-quotation-integer-based format of mpl::string. What I am trying to do is to generate at compile time an XML realization of some simple data structures using compile time strings. I am striving for having macros generate t...
Hello folks,
I am trying to declare my Class as Metatype for Qt but figuring out some problems. It seems that after the MetaType declaration he wants to get access to a copy constructor or something like this which is explicitly not allowed for QObjects as I thought.
This is my header:
#include <QtCore/QObject>
#include <QtCore/QMetaT...
In the process of developing a new language. How can be related the "high level" concepts such as "LALR parser", "abstract syntax tree", "context-free grammars", etc. with other "low level" concepts like the specific grammar rules "A -> B".
I mean as some kind of metalanguage relationship, or similar. Any ideas or suggestions to look m...
I'm trying to figure why this code:
class BaseClass
end
module Extensions
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def message(message)
@@message = message
end
end
end
BaseClass.send(:include, Extensions)
class ExtendedClass < BaseClass
message "hello world!"
def say_me...
Mormally setting up one-to-many associations is easy. Take for example:
class Author {
String firstName
String lastName
static hasMany = [books: Book]
static constraints = {
books(nullable: true)
}
}
class Book {
String title
Author author
Publisher publisher
static constrai...
I have worked with MS CRM. There we can design our custom entity graphically and then we can also build a visual form to perform CRUD operations on that entity.
This feels so simple from end user's perspective. However I am interested to know how can I develop the similar kind of application where I design my table on the fly and the de...
This does not seem to work:
class Test
private
define_method :private_method do
"uh!"
end
end
puts Test.new.private_method
...
I am new to Ruby, and have a gem that I am making to interact with a JSONRPC API and basically all calls and responses are similar enough, that every API call can be handled with one function, like:
Module::api_command('APINamespace.NamespaceMethod')
but I would like to also (for convenience sake) be able to do:
Module::APINamespace.N...
Hi,
I have some colleagues at work, they arrive at the morning, switch off email, phone, close the door, etc. Then they close their eyes and during 30 minutes try to focus on their programming (C++, C, etc) and remember what they did yesterday. Then and somehow the process or imagine the code on they mind, with closed eyes. And some tim...
In Scala, there are metaobjects like java.lang.Class and java.lang.reflect.Method. But what metaobject exists for traits?
class Foo {
def foo = "foo"
}
var obj = classOf[Foo]
obj // java.lang.Class[Foo] = interface Foo
It prints interface. What is this?
...
The meaning of most nodes from mri's syntax tree can be easily infered. However the list is quite long (source: bin/parse_tree_abc):
:attrasgn, :attrset, :dasgn_curr, :iasgn, :lasgn, :masgn,
:and, :case, :else, :if, :iter, :or, :rescue, :until, :when, :while,
:call, :fcall, :super, :vcall, :yield,
:args, :argscat, :array, :begin, :block...
Hello!
I have the following problem:
Suppose I have some basic counter class Counter. And suppose we also have some sets of classes, that can be counted. Let's name some of them class CountedA and class CountedB.
Now, every class, which can be counted (such as CountedA and CountedB) has the following statically declared parts: one enu...