From: David Vallner Date: 2006-12-06T08:10:59+09:00 Subject: Re: "more than enough rope" --------------enig0882218D20CFBC7770F54816 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Giles Bowkett wrote: > Obviously this is a judgement call -- but does anyone know good > resources for those questions like, when do I use metaprogramming, > when do I just use more normal techniques? >=20 My personal take to the when is: Depends, sparingly if in doubt. If you're not engaging in external code-clobbering, knock yourself out. If you can keep your own private language to your code, then if you feel that your code is indeed cleaner with metaprogramming, just go ahead and use it. The worst thing that can happen is that you'll shoot yourself in the foot, get a subtle bug, fix it, and learn how to avoid doing it again - a gift that keeps on giving! *ducks* However, watch it in interfaces to external code. Code to be consumed by third parties, or with high probability maintained by third parties should if nothing else keep a well-defined interface that doesn't change on a whim except by explicit library client request with methods to do precisely that. (This doesn't apply to libraries that are mainly metaprogramming aids like traits et al.) For code with others maintaining it, writing more exhaustive documentation is a good self-test. If you can trace back your own code like you do with the harder snippets on the mailing list in your head and unravel the workings into words up to the "Ah-hah!" point, and then put a digest of your mind's core dump into docs, you should be set - this would imply there's actual sense behind the meta code structure instead of just threading hacks together in something that works out yet is just a shiny notation for something trivial. David Vallner --------------enig0882218D20CFBC7770F54816 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (MingW32) iD8DBQFFdfyAy6MhrS8astoRAhHNAJ94RuN9iErjPt+1p2lsvPWkawc+PACfRyWa ekXEvXKZoYzG9mOLc6mXPZE= =63tH -----END PGP SIGNATURE----- --------------enig0882218D20CFBC7770F54816--