ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Rik Kabel via ntg-context <ntg-context@ntg.nl>
Cc: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>,
	Rik Kabel <rik@panix.com>
Subject: Re: directsetup vs setups
Date: Mon, 15 Nov 2021 19:54:59 +0100	[thread overview]
Message-ID: <2bcacade-324c-26c1-16cf-293168c8ca3f@gmail.com> (raw)
In-Reply-To: <9ca345bf-bcb7-0e13-262e-830563326384@panix.com>


[-- Attachment #1.1: Type: text/plain, Size: 2962 bytes --]

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


[-- Attachment #1.2: Type: text/html, Size: 4033 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2021-11-15 18:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15  5:24 Rik Kabel via ntg-context
2021-11-15  8:21 ` Denis Maier via ntg-context
2021-11-15  9:38 ` Hans Hagen via ntg-context
2021-11-15 18:06   ` Rik Kabel via ntg-context
2021-11-15 18:54     ` Wolfgang Schuster via ntg-context [this message]
     [not found]       ` <c4306f2b-3555-cb6f-787b-fafb98fe2c79@rik.users.panix.com>
2021-11-15 22:48         ` Wolfgang Schuster via ntg-context
2021-11-15 21:33     ` Hans Hagen via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2bcacade-324c-26c1-16cf-293168c8ca3f@gmail.com \
    --to=ntg-context@ntg.nl \
    --cc=rik@panix.com \
    --cc=wolfgang.schuster.lists@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).