\getcommacommandsize not working in lmtx
Hi, I've just ran into a behaviour that runs against what is shown on the wiki, https://wiki.contextgarden.net/System_Macros/Comma_Separated_Lists Maybe a bug? The wiki says you can use \getcommacommandsize to get the length of a comma separated list, but it does not seem to work. MWE below. Best, Denis \define\somelist {foo, bar, baz} \starttext \getcommacommandsize[\somelist] \commalistsize % Expected : 3 % Actual : 1 \expandafter\getcommalistsize\expandafter[\somelist] \commalistsize % Expected : 3 % Actual : 3 \stoptext
On 5/2/2022 9:37 AM, Denis Maier via ntg-context wrote:
Hi,
I’ve just ran into a behaviour that runs against what is shown on the wiki, https://wiki.contextgarden.net/System_Macros/Comma_Separated_Lists https://wiki.contextgarden.net/System_Macros/Comma_Separated_Lists
Maybe a bug?
More a feature as \define defines a protected macro. \starttext \define\somelist{foo,bar,baz} {\tt\meaningasis\somelist} \getcommacommandsize[\somelist] \commalistsize \defineexpandable\somelist{foo,bar,baz} {\tt\meaningasis\somelist} \getcommacommandsize[\somelist] \commalistsize \starttexdefinition protected somelist foo, bar, baz \stoptexdefinition {\tt\meaningasis\somelist} \getcommacommandsize[\somelist] \commalistsize \starttexdefinition somelist foo, bar, baz \stoptexdefinition {\tt\meaningasis\somelist} \getcommacommandsize[\somelist] \commalistsize \semiprotected\def\somelist{foo,bar,baz} \getcommacommandsize[\somelist] \commalistsize \getcommacommandsize[\semiexpanded{\somelist}] \commalistsize % also in next version: % % \starttexdefinition semiprotected somelist % foo, % bar, % baz % \stoptexdefinition % % {\tt\meaningasis\somelist} % % \getcommacommandsize[\somelist] \commalistsize % \getcommacommandsize[\semiexpanded{\somelist}] \commalistsize \stoptext The semiprotected is something lmtx and only expands when explicitly asked for (like in an \edef or so). Something that we might apply in the core some day. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
denis.maier@unibe.ch
-
Hans Hagen