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. Eg 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.