4 ms·
I must be pedantic and separate the definition of "metaprogramming," and "dynamic programming;" of which this is the latter. The reason this difference is impo
by agentultra 13y ago
I must be pedantic and separate the definition of "metaprogramming," and "dynamic programming;" of which this is the latter.
The reason this difference is important is that metaprogramming is structured and explicitly defines the change in the program's semantics.
Thankfully I have never seen code like what was posted in my experience with Python so far. Explicit is better than implicit which the code example in this post would fail to pass IMO. Dynamically dispatching to names that don't exist in a class' published interface at call-time is a big no-no in my book.
Although practicality beats purity.
I haven't seen it yet but that doesn't mean there is a practical reason to use this method of dynamic dispatch. If there were one and it gets a problem solved NOW rather than waiting to find a better solution -- it might be worthwhile.
However it's a price you have to pay.
I think the grep-test is at least a good way to test the waters with a bit of code. I don't think it's a universal end-all-discussions rule.
- x3ord 13y agoSorry to be pedantic, but this is not dynamic programming.
- agentultra 13y agoNo need to be sorry
- wtetzner 13y agoDynamic programming already has a meaning: https://en.wikipedia.org/wiki/Dynamic_programming https://en.wikipedia.org/wiki/Dynamic_programming
- agentultra 13y agoRight, thanks for pointing that out. That makes this what, then? Hash-blob programming? :)