Rik Kabel via ntg-context schrieb am
15.11.2021 um 19:06:
So, some follow-up questions:
1. What do you mean by "only one setup" in the description of
directsetup and fastsetup? I have examples of using two
different directsetup in one after key, so it does not seem to
mean that.
With \directsetup, \fastsetup and \setup (I'm correcting Hans here) you
can pass only the name of a single setups-environment as argument, e.g.
\directsetup{my_fancy_setup}
while \setups allows you to pass a list of names, e.g.
\setups[custom_setup_a,custom_setup_b,...]
2. What is meant by saying that directsetup supports
gridsnapping? Do you mean that fastsetup does not? (If that is
the case, should a module writer not use fastsetup because it
might be used in a document that requires a grid?)
The \startsetups environment has a optional argument which accepts (at
the moment) the "grid" keyword to set values which are only used when
grid snapping (\setuplayout[grid=yes]) is enabled, e.g.
\startsetups [grid] [my_fancy_setup]
% settings which are used when grid mode is enabled
\stopsetups
\startsetups [my_fancy_setup]
% settings which are used when grid mode is disabled
% or when no grid related setups with the same name exist
\stopsetups
When you now use \directsetup{my_fancy_setup} (or \setup[...]) ConTeXt
checks if grid mode is enabled and selects the right settings but
\fastsetup never performs this check and always uses the non grid
settings. The \fastsetup command is even more basic because it doesn't
even check if there is a setups environment with the given name which is
done by the other commands.
3. Is the
support for {} and [] in setup simply to maintain
legacy support for {}, or are there reasons to choose one over
the other? I do see consistently faster times with the curlies.
You can run Hans example with MkIV and the differences should be even
bigger because the check for [] is slower here while in LMTX it's a
engine feature. The main difference in LMTX is a extra expansion for
\setup compared to \directsetup.
4. Are there operations that are supported in directsetup that
are not supported in setup or fastsetup? Are there operations
supported in fastsetup that are not supported in setup or
directsetup?
There is no difference between \setup and \directsetup but \fastsetup
should only be used when you can ensure the requested environment
exists.
5. Is it fair to say that setup can do the most, directsetup a
bit less, and fastsetup is the most restrictive? Except for the
most performance-constrained documents, setup is a safe choice,
but when constructing modules or performance tuning, the others
might be tested?
As I already wrote before there is no difference between \setup and
\directsetup. When you care about performance \directsetup is the wrong
start because you won't notice a difference.
Wolfgang