开发者

Reusable nested macro in boo?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜