[dev-context] A few questions

Fri Aug 7 14:33:23 CEST 2009

On Fri, 7 Aug 2009, Hans Hagen wrote:

>>>> i get the feeling we're moving towards latex3 (brr), before this happens
>>>> drop the whole
>>>> thing and i don't like \getvariable in this context anyway
>>>
>>> don't want to have something like that; it's more that in context we have
>>> this system of [optional]{whatever} that we might want to support
>>
>> me neither, the latex3 system is too complicated and one has to remember
>> what n, N, x ... means etc.
>
> indeed, and also kind of redundant as the name should denote the usage, i.e.
> imagine that in e.g. lua we did  myfunction_takes_num_and_num
>
> i would not be surprised if it's also quite slow (esp when used in core code)
> and core code is not used by users anyway
>
>> there are a few interesting things like namespaces for module/macros but
>> that's not worth the effort they take
>
> indeed, but keep in mind that in context we seldom have other interfaces that
> [] and {}, no optoinal * etc

One good thing with LaTeX 3 syntax is that something like

\DeclareDocumentCommand\foo { o o m } will be (from what I understand)
equivalent to

\def\foo
{\dodoubleempty\dofoo}

\def\dofoo[#1][#2]#3{...}

When I started using context, I was surprised that context did not have
anything for optional arguments. We could have something like

\definesinglearugment\foo[#1]#2{...}

to be equal to

\def\foo{\dosingleargument\dofoo}
\def\dofoo[#1]#2{...}

and

\definesingleempty\foo[#1]#2{...]

to be equal to

\def\foo{\dosingleempty\dofoo}
\def\dofoo[#1]#2{...}

and similar things for \definedoublearugment, \definetripleargument, etc.
I am not convinced that this is a good thing, but using something like
this in the core may result in a 10% reduction in the code size and might
kill a few dodos :)