I am writing a DSL using boo and I would like to keep it as DRY as possible. I was wondering if there is any way to reuse nested macro. E.g. in
topmacro1:
submacro:
topmacro1['submacro'] = 'defined'
topmacro2:
submacro:
开发者_运维技巧 topmacro2['submacro'] = 'defined'
The submacro macro just sets a value in the parent macro's hash. Is there any way to avoid redefining submacro in every parrent macro?
Thanks in advance,
Thomas
I think the best you can do is to break out the body of the submacro
into a function and simply call that function. That should be DRY enough.
精彩评论