followingup-rejected.tex /size: 3352 b    last modification: 2021-10-28 13:50
1% language=us runpath=texruns:manuals/followingup
2
3\startcomponent followingup-rejected
4
5\environment followingup-style
6
7\startchapter[title={Rejected}]
8
9\startsection[title={Introduction}]
10
11During the development of \LUATEX\ some extensions were considered but rejected
12after some experiments. I already forgot about some that were tried the last
13decade. I will not discuss what has been added already to \LUATEX.
14
15\stopsection
16
17\startsection[title={Conditionals}]
18
19The \LUATEX\ manual describes a few conditional primitives that were added. One
20thing I played with was a native definer, think of \type {\idef} but in the end
21rejected it, because in practice it was seldom needed. Another useful one would
22be \type {\ifnothing} but the current implementation of \type {\ifx} is already
23pretty efficient so there is nothing to gain here. Another rejected one is \type
24{\ifxcase} which takes a token and compares that with a sequence, like
25
26\starttyping
27\ifxcase\foo\alpha
28\or\beta
29\or\gamma
30\else
31\fi
32\stoptyping
33
34As this was never available, in \CONTEXT\ already different strategies were
35followed so I could only find a few places where this could make code more
36readable. But who knows, I might change my mind when I split the code base and can
37adapt code accordingly although it doesn't make much sense for the more high
38level modules because it would only affect a few lines and maintaining duplicate
39files is no fun. \footnote {But playing with extensions that make for better code
40{\em is} fun.}
41
42\stopsection
43
44\startsection[title={Dimensions}]
45
46A primitive that returns the height plus depth would make sense (\type {hd}) but
47one can easily define one and the gain can be neglected. So, for now this has
48been rejected. Also, one can use the token scanners to implement that kind of
49primitives but of course that then does have a penalty in terms of performance.
50\footnote {Okay, in the end I decided to just add a primitive for this, but only
51as part of a larger set of box related primitives.}
52
53\stopsection
54
55\startsection[title={The something}]
56
57I played a bit with intercepting \type {\the} so that we could define commands
58that also respond to this expander. It didn't work out well because full
59expansion happens, even with protected macros:
60
61\starttyping
62\protected\def\foo{...] \the\foo
63\stoptyping
64
65We just have to accept this and it's no big deal.
66
67\stopsection
68
69\startsection[title={Primitives}]
70
71Occasionally I'm wondering if we should have a way to flag primitives and macros
72as being frozen but in the end it might not pay off. At some point I decided that
73at least the \type {\primitive} and \type {\ifprimitive} could go away as they
74are not really working as expected. It's better to have nothing than something
75bad. Also, we can easily clone the whole set of primitives in a new namespace
76with \LUA\ if we want. \footnote {But \unknown\ in the end we got something else
77back.}
78
79\stopsection
80
81\stopchapter
82
83\stopcomponent
84
85% very limited use case and not easy in nested definitions (which is where is
86% would have been used
87%
88% } else if (cur_cmd == begin_local_cmd && cur_chr == local_control_now_code) {
89%
90%\def\foo#1#2%
91%  {test #1
92%   test #2
93%   test
94%   \localcontrolnow{\scratchcounter\catcode\hashasciicode \catcode\hashasciicode\othercatcode}
95%   #
96%   \localcontrolnow{\catcode\hashasciicode\scratchcounter}
97%   test}
98