On 2018-01-31 09:54, Wolfgang Schuster wrote:
Rik Kabel schrieb:
\starttexdefinition doTableRowExpB #SET
\define\A{\getvariable{#SET}{a}}
\define\B{\getvariable{#SET}{b}}
\define\C{\getvariable{#SET}{c}}
\bTR
\expanded{\bTC\A\eTC}
\expanded{\bTC\B\eTC}
\expanded{\bTC\C\eTC}
\eTR
\stoptexdefinition
You can’t use \define but it creates non expandable commands
(which can be solved when you use \defineexpandable instead)
and there is no need for this extra step.
\starttexdefinition doTableRowExpB #SET
\bTR
\expanded{\bTC\getvariable{#SET}{a}\eTC}
\expanded{\bTC\getvariable{#SET}{b}\eTC}
\expanded{\bTC\getvariable{#SET}{c}\eTC}
\eTR
\stoptexdefinition
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry
to the Wiki!
maillist : ntg-context@ntg.nl /
http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
Great. This does the job, and allows assigning more
semantically-meaningful names to the elements.
\starttexdefinition doTableRowExpB #SET
\defineexpandable\A{\getvariable{#SET}{a}}
\defineexpandable\B{\getvariable{#SET}{b}}
\defineexpandable\C{\getvariable{#SET}{c}}
\bTR
\expanded{\bTC\A\eTC}
\expanded{\bTC\B\eTC}
\expanded{\bTC\C\eTC}
\eTR
\stoptexdefinition
I see no performance difference on a much larger test, and I think that
the readability is improved (and thus the opportunity for simple
mistakes) when the hundreds of \getvariable macros are refactored into a
few macro definitions.
Thank you once again.
--
Rik
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________