Skip to main content

Questions tagged [meta-programming]

Meta-programming is the writing of computer programs with the ability to treat programs as their data. It means that a program could be designed to read, generate, analyze and/or transform other programs, and even modify itself while running.

1 vote
2 answers
165 views

TL;DR This question examines an over-engineered example of python metaclasses and dataclasses to create a LiteralEnum (for validating a stringly-typed keyword ...
SumNeuron's user avatar
  • 291
8 votes
2 answers
1k views

I am writing a java class file parsing & serialization library. As part of that i needed to implement a structure for the JVM bytecode instructions as well as come up with a way to parse & ...
p0sa's user avatar
  • 81
1 vote
3 answers
497 views

I have a list of functions whose parameters in the signature should be validated with the same criteria each time. ...
SeF's user avatar
  • 199
1 vote
1 answer
70 views

In Python you can use print(locals()) to print a dictionary of all the local variables, but this has 3 shortcomings: Double underscore variables will be included ...
Caridorc's user avatar
  • 28.2k
1 vote
1 answer
748 views

Idea is to have an AutoBind decorator which you could append in front of any method to have it preserve its own this, instead of manually binding it when called. <...
Ilija Ivic's user avatar
9 votes
1 answer
833 views

I ran across an issue that proved to be more complicated than I thought: Changing an arbitrary argument of a function purely based upon its name in Python - possibly via a decorator. I tried to ...
s-m-e's user avatar
  • 273
3 votes
1 answer
212 views

Here is my take at a lightweight interface implementation, where I focus on discoverability of suitable classes from strings (for simplicity, class name is used as an id). Each interface has it's own &...
Roman Susi's user avatar
2 votes
1 answer
231 views

I wrote this method a few years ago in a Ruby on Rails project, which I think I am not proud of. How can I make this code better to show in-depth professionalism in Ruby? lib/merchant/web_csv_importer....
Afolabi Olaoluwa's user avatar
1 vote
1 answer
74 views

I have created a module that validates the credentials against different databases. ...
Rajkaran Mishra's user avatar
3 votes
0 answers
135 views

Tried to do my own implementation of reflection(introspection) for using in my next projects. Is it optimized at compile time? If no, how can I improve it? This macro is good interface for adapting ...
Vladyslav Mozhvylo's user avatar
6 votes
2 answers
524 views

Motivation In the standard Python library enum, a subclass of Enum would create all its members upon class creation. This can ...
user141240's user avatar
4 votes
1 answer
157 views

This is a recreational project, I was trying to make a parser generator with a grammar inspired from: https://docs.python.org/3/reference/grammar.html Unfortunately, understanding that specific ...
Jeacom's user avatar
  • 125
3 votes
1 answer
183 views

I am following a guide that specifies how to manage different configurations (DB_URI, LOGGER_NAME, etc...) per development environments. I create a config module ...
moshevi's user avatar
  • 270
2 votes
0 answers
107 views

I'm working on a web framework in C++ and there's this part that I need to do something like this: ...
The Moisrex's user avatar
3 votes
1 answer
161 views

I write decorators a lot in my work. Sometimes you need to write "decorator that takes arguments", it usually turns out to be something like this: ...
rabbit.aaron's user avatar

15 30 50 per page
1
2 3 4 5
9