Questions tagged [meta-programming]
Programs or functions that alter the behavior of other programs or functions.
31
questions
-1
votes
1
answer
116
views
Finding intermediate type for conversion
After reading the whole question, you might think why I even need this, but believe me, it has a crucial usage in my project, which is very broad and complex, so I will only include the things ...
5
votes
1
answer
223
views
Is tag dispatch as used in CppCoreGuidelines T.65 antiquated?
The CppCoreGuidelines contain the following:
T.65: Use tag dispatch to provide alternative implementations of a function
[...]
Example
struct pod_tag {};
struct non_pod_tag {};
template<class T&...
1
vote
1
answer
332
views
Common methods of generating code with code
I wish to develop an application that can generate code based on an user input.
Long story short: a user gives a formal description of a Resource (can be viewed as a REST resource) and based on this ...
5
votes
4
answers
372
views
How to deal with different level of abstractions (blurred line between data and models)
My question is about the way to represent data models created at runtime.
To illustrate, let's say we would like to create a CMS-like app in which end-users may create custom forms.
Those forms are ...
107
votes
10
answers
22k
views
Is it ok to use meta-programming even though not all of my colleagues understand it?
I employ a lot of meta-programming to avoid repetitive tasks and build safer-to-use abstractions.
I recently moved to a new job where I am working in a larger team and this worries some of my ...
4
votes
2
answers
4k
views
Was template meta programming really discovered "by accident"? [closed]
When I first saw this meme:
I thought to myself, yeah right, but now I am not sure any more. So was template meta programming in C++ discovered by accident as the meme claims or was it intentional?
...
1
vote
1
answer
202
views
Meta-driven application an anti-pattern in MVC context?
I am working with Ruby on Rails at work and have been reading the Pragmatic Programmer on the side.
I was given the task to create some small registration application with ~10 form fields. From my ...
12
votes
1
answer
2k
views
What practical problem results from lack of hygienic macros in Clojure?
I've heard that Clojure macros are easier to write but not as reliable as Racket's hygienic macros. My question has 2 parts:
How does gensym differ from hygienic macros?
What do Racket macros provide ...
2
votes
1
answer
266
views
Low cost exceptions implementation using metaprogramming [closed]
(preface - boring stuff, feel free to skip down to the implementation details)
I need to provide exception handling to a language I am working on. It "compiles" to a subset of C, and since I ...
1
vote
0
answers
47
views
Meteor allow users to extend application
I'm trying to make a meteor app which every user can extend. Meteor uses hot code swapping which I would like to use, so I'd probably need to save scripts on file system of the server.
Have You got ...
1
vote
1
answer
530
views
C++ Template Metaprogramming and Call By Need Evaluation
I recently wrote a fairly complex C++ meta function that boils down to:
template <size_t N, typename val>
struct Rec {
using type = typename std::conditional<N == 0,
val,
...
2
votes
2
answers
151
views
Method for all objects for checking conditions which also includes method chaining and avoiding variables
(I am currently using groovy but it should apply to most OO languages so I also put the langauge-agnostic tag)
I try to program in a function style which also includes method chaining and avoiding ...
13
votes
3
answers
5k
views
C++: Metaprogramming with a compiler API rather than with C++ features
This started out as a SO question but I realized that it is quite unconventional and based on the actual description on the websites, it might be better suited to programmers.se since the question has ...
24
votes
4
answers
41k
views
Is there a downside to using AggressiveInlining on simple properties?
I bet I could answer that myself if I knew more about tools to analyze how C#/JIT behaves but since I don't, please bear with me asking.
I have simple code like this :
private SqlMetaData[] meta;...
12
votes
3
answers
2k
views
Compile-time IOC
Has anyone started a project to do IOC at compile time (possibly using Roslyn or Linq MethodInfo emit)?
My experience with IOC containers has thus far been great, baring a few small issues
Many IOC ...