azazel75/macropy

[enh] Abbreviating macro names

Technologicat opened this issue · 0 comments

On some occasions it would be useful to abbreviate macro names.

Particularly ast_literal is a rather long name, and if a short quasiquoted expression includes several of them, this can make the structure of the expression difficult to see.

Example from the cond macro in unpythonic (example, implementation):

return hq[ast_literal[then] if ast_literal[test] else ast_literal[_cond(more)]]

This would read better as:

a = abbrev[ast_literal]
return hq[a[then] if a[test] else a[_cond(more)]]

if there was an abbrev macro.

[edit: fix link]
[edit2: fix doc link]