Buscar en Mind w/o Soul

martes, octubre 23, 2007

Metaprogramación HOWTO


Tutorial de uso de macros para generación automática de código, usando el lenguaje Nemerle (un derivado funcional de C# con licencia BSD).

Macros - Nemerle Homepage
You can think about macros as of a system of compile-time transformations and automatic generation of code with regard to some rules. It can be used either to automate manipulations performed on similar data-types and fragments of code or to add syntax shortcuts to the language, optimize and make some computations safer by moving them from runtime to compile-time.

The idea of making simple inline operations on the code comes from preprocessor macros, which many languages (especially C, C++) have contained since early times of compiler design. We are following them in the direction of much more powerful, and at the same time more secure (type-safe) solutions like Haskell Template Meta-programming.

No hay comentarios: