There seems to be a Current and Standard way to define new (core) commands in ConTeXt. For example, an e-mail by Wolfgang states:
Many of the \define... and \setup... commands are now auto generated from \installcommandhandler which generates only one setup-command which can be used for global (i.e. \setup…[..,..=..,..]) and local (i.e. \setup...[...][..,..=..,..]) settings. For backward compatibility you can find things like this: \let\setupnotes\setupnote
I cannot wrap my head around the source code, and I cannot find any documentation on the commands involved.
For example, the code that creates \startnarrower and \setupnarrower, from spac-hor.mkiv:
\installcorenamespace{narrower}
\installcorenamespace{narrowermethod}
% ... (some code skipped)
\installcommandhandler \??narrower {narrower} \??narrower
\appendtoks
%% this means: \def\startmynarrower{\spac_narrower_start{mynarrower}}
\setuevalue{\e!start\currentnarrower}{\spac_narrower_start%
{\currentnarrower}}%
%% this means: \def\startmynarrower{\spac_narrower_stop}
\setuevalue{\e!stop \currentnarrower}{\spac_narrower_stop}%
\to \everydefinenarrower
% \??narrowermethod is the narrowermethod corenamespace?
\unexpanded\def\installnarrowermethod#1#2%
{\setvalue{\??narrowermethod#1}{#2}}
% ...
\installnarrowermethod \v!left {\global\advance\s_spac_narrower_left%
\narrowerparameter\c!left \relax}
\installnarrowermethod \v!middle{\global\advance\s_spac_narrower_mid%
\narrowerparameter\c!middle\relax}
So, what do these commands do/mean?
\installcorenamespace\??...\installcommandhandler, and possibly its buddies defined in mult-aux.mkiv and elsewhere:\installswitchcommandhandler,\installautocommandhandler,\installsimplecommandhandler,\installframedautocommandhandler, etc.\setuevalue
installcorenamespaceis reserved for Hans, useinstallnamespaceordefinenamespaceinstead. There’s also a section on the wiki dedicated to module namespacing. Also look at syst-aux.mkiv for the constants\c!...,\v!.... – Philipp Gesang Jun 05 '12 at 15:14\installcorenamespaceis also interesting even though I can't use it; especially because it is not user-facing and therefore less documented. – Esteis Jun 05 '12 at 15:33\csname...\endcsnameexpands its contents, sticks a backslash in front, and TeX then pretends that that was what you wrote. See this SE answer. It's used inside\setuevalue, for example, to piece together\e!start\currentnarrowerinto\startnarrower, or\startmynarrower, or `\demarrecompoetroite". – Esteis Jun 06 '12 at 10:32